Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Autocompletion results do not get filtered #41

Closed
josa42 opened this issue May 23, 2017 · 4 comments
Closed

Autocompletion results do not get filtered #41

josa42 opened this issue May 23, 2017 · 4 comments

Comments

@josa42
Copy link
Contributor

josa42 commented May 23, 2017

Currently the autocompletion results do not get filtered or sorted. This behavior is confusing and breaks the tab completion, because the first item is used, not the best matching one.

That's what it currently looks like or me:

unfiltered

That's what I would expect:

filtered

I created a PR to implement filtering using atom/fuzzaldrin.

Which basically does this:

autocomplete-adapter.js

static completionItemsToSuggestions(completionItems: Array<CompletionItem> | CompletionList, request: atom$AutocompleteRequest): Array<atom$AutocompleteSuggestion> {
  return filter(
    (Array.isArray(completionItems) ? completionItems : completionItems.items || [])
      .map(s => AutocompleteAdapter.completionItemToSuggestion(s, request)),
    request.prefix,
    {key: 'filterText'}
  );
}

Please let me know what you think.

@damieng
Copy link
Contributor

damieng commented May 23, 2017

Really the language provider should be re-queried after each keypress to provide the best updated options.

I'm aware of a bug in the Omnisharp provider (language-csharp) that currently prevents this - are you seeing this problem in other language servers too?

@josa42
Copy link
Contributor Author

josa42 commented May 23, 2017

Thanks for the answer.

I am implementing a client for emberwatch/ember-language-server. I think the language provider is re-queried after each keypress. But the results are not getting filtered.

While it sounds absolutely reasonable that the language server should filter the results, at least VSCode seems to filter the results somewhere. This is what I see with same language server in VSCode:

vscode

I may have to dig deeper into this 😃

@damieng
Copy link
Contributor

damieng commented May 23, 2017

Yeah I'm not opposed to having something like this baked into atom-languageclient although I think people would need to opt-in for when their language server doesn't do it for them. Otherwise we'll interfere with the process which should technically be yielding more accurate results.

Let me know how your investigation goes.

@josa42
Copy link
Contributor Author

josa42 commented May 31, 2017

@damieng Filtering is now solved in the Language Server. Thank you for your input!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants