Closed davidmedinasigasi closed 4 years ago
A completion item provider is invoked, returns completions but they don't show up! 😕 What's the issue? Filtering! Filtering compares completions with a prefix and hides those that don't match.
say.he|
(|
is the cursor)abc
, help
, hood
he
-prefix and scores it against abc
, help
, and hood
. abc
- no match, don't showhelp
- good match, showhood
- no match, only h
occurs, don't showhelp
suggestion, does not show abc
and hood
suggestionThe above sample was using "defaults" to determine the prefix and the filter criteria.
prefix:
each completion can define its very own prefix via vscode.CompletionItem#range
. Taking the example above, valid prefixes can be say.he
or .he
or
(the empty string). Any range is valid as long as it includes the cursor position and is single line only.
filter:
each completion can define what string to use when filtering. The default is the label but via vscode.CompletionItem#filterText
any string can be definedWhen to use what? It depends on the language, its word definition, and if you control/understand the word definition or not. The defaults usually work well enough but some languages might use a non-intuitive word definition, or completions span multiple words, or completions include non-word character etc. In all those cases the range
-property should be used.
I am currently developing a vscode extension that connects to language server using the LSP protocol. I have encountered an issue while developing support for completion: Whenever I trigger a completion on, for example,
`include
the server sends a list of competion items that look like this:However, vscode doesn't show any suggestions. I know the message structure is correct because other completions work