Merge pull request #668 from zed-industries/no-lsp-when-following

Avoid making LSP requests when moving cursor due to following
This commit is contained in:
Max Brunsfeld 2022-03-23 11:54:45 -07:00 committed by GitHub
commit 8f7966bf35
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5064,6 +5064,7 @@ impl Editor {
cx,
);
if local {
let completion_menu = match self.context_menu.as_mut() {
Some(ContextMenu::Completions(menu)) => Some(menu),
_ => {
@ -5076,7 +5077,8 @@ impl Editor {
let cursor_position = new_cursor_position.to_offset(&buffer);
let (word_range, kind) =
buffer.surrounding_word(completion_menu.initial_position.clone());
if kind == Some(CharKind::Word) && word_range.to_inclusive().contains(&cursor_position)
if kind == Some(CharKind::Word)
&& word_range.to_inclusive().contains(&cursor_position)
{
let query = Self::completion_query(&buffer, cursor_position);
cx.background()
@ -5094,6 +5096,7 @@ impl Editor {
}
self.refresh_code_actions(cx);
self.refresh_document_highlights(cx);
}
self.pause_cursor_blinking(cx);
cx.emit(Event::SelectionsChanged { local });