Always issue a new completions request when typing a trigger character

We'll interpolate the anchor range of original request, but it's still a good idea to be up-to-date in case the language server is influenced by the content preceding the location. This doesn't *seem* to be the case with rust-analyzer so far, but it's how VS Code works so let's do it this way.
This commit is contained in:
Nathan Sobo 2022-01-31 18:34:20 -07:00
parent ae0237c21b
commit 327ddbe2b4

View File

@ -1390,15 +1390,13 @@ impl Editor {
}
fn trigger_completion_on_input(&mut self, text: &str, cx: &mut ViewContext<Self>) {
if self.completion_state.is_none() {
if let Some(selection) = self.newest_anchor_selection() {
if self
.buffer
.read(cx)
.is_completion_trigger(selection.head(), text, cx)
{
self.show_completions(&ShowCompletions, cx);
}
if let Some(selection) = self.newest_anchor_selection() {
if self
.buffer
.read(cx)
.is_completion_trigger(selection.head(), text, cx)
{
self.show_completions(&ShowCompletions, cx);
}
}
}