don't send completion request again before response is back (#1746)

This commit is contained in:
Dongdong Zhou 2022-11-23 20:49:26 +00:00 committed by GitHub
parent 289e5d13c8
commit 50216c42b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 11 deletions

View File

@ -305,18 +305,17 @@ pub fn current(&self) -> Option<&str> {
self.current_item().map(|item| item.item.label.as_str())
}
#[allow(clippy::too_many_arguments)]
pub fn request(
&self,
&mut self,
proxy: Arc<LapceProxy>,
request_id: usize,
path: PathBuf,
input: String,
position: Position,
) {
self.input_items.insert(input.clone(), im::Vector::new());
proxy
.proxy_rpc
.completion(request_id, path, input, position);
.completion(self.request_id, path, input, position);
}
pub fn cancel(&mut self) {

View File

@ -770,7 +770,6 @@ fn update_completion(
let start_pos = self.doc.buffer().offset_to_position(start_offset);
completion.request(
self.proxy.clone(),
completion.request_id,
self.doc.content().path().unwrap().into(),
"".to_string(),
start_pos,
@ -781,7 +780,6 @@ fn update_completion(
let position = self.doc.buffer().offset_to_position(offset);
completion.request(
self.proxy.clone(),
completion.request_id,
self.doc.content().path().unwrap().into(),
input,
position,
@ -800,7 +798,6 @@ fn update_completion(
let start_pos = self.doc.buffer().offset_to_position(start_offset);
completion.request(
self.proxy.clone(),
completion.request_id,
self.doc.content().path().unwrap().into(),
"".to_string(),
start_pos,
@ -810,7 +807,6 @@ fn update_completion(
let position = self.doc.buffer().offset_to_position(offset);
completion.request(
self.proxy.clone(),
completion.request_id,
self.doc.content().path().unwrap().into(),
input,
position,

View File

@ -763,9 +763,8 @@ pub fn completion(
let core_rpc = self.core_rpc.clone();
let language_id =
Some(language_id_from_path(path).unwrap_or("").to_string());
self.send_request(
None,
None,
self.send_request_to_all_plugins(
method,
params,
language_id,