mirror of
https://github.com/zed-industries/zed.git
synced 2024-09-20 02:47:34 +03:00
Address panic when completions requested and returned to outdated buffer
This commit is contained in:
parent
564225c401
commit
afbddc1bcd
@ -2331,6 +2331,13 @@ impl Project {
|
||||
};
|
||||
|
||||
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
|
||||
.request::<lsp::request::Completion>(lsp::CompletionParams {
|
||||
text_document_position: lsp::TextDocumentPositionParams::new(
|
||||
|
Loading…
Reference in New Issue
Block a user