Address panic when completions requested and returned to outdated buffer
This commit is contained in:
parent
564225c401
commit
afbddc1bcd
1 changed files with 7 additions and 0 deletions
|
@ -2331,6 +2331,13 @@ impl Project {
|
||||||
};
|
};
|
||||||
|
|
||||||
cx.spawn(|_, cx| async move {
|
cx.spawn(|_, cx| async move {
|
||||||
|
let clipped_position = source_buffer_handle
|
||||||
|
.read_with(&cx, |this, _| this.clip_point_utf16(position, Bias::Left));
|
||||||
|
if clipped_position != position {
|
||||||
|
log::info!("Completion position out of date");
|
||||||
|
return Ok(Default::default());
|
||||||
|
}
|
||||||
|
|
||||||
let completions = lang_server
|
let completions = lang_server
|
||||||
.request::<lsp::request::Completion>(lsp::CompletionParams {
|
.request::<lsp::request::Completion>(lsp::CompletionParams {
|
||||||
text_document_position: lsp::TextDocumentPositionParams::new(
|
text_document_position: lsp::TextDocumentPositionParams::new(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue