-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
API: CompletionItem: add filterText
field
#6510
Comments
To give some more context from the LSP spec:
|
I think there is a misunderstanding here. What your shreenshot indicates is missing support for the CompletionItemLabelDetails from the LSP specs, in particular /**
* An optional string which is rendered less prominently directly after
* {@link CompletionItem.label label}, without any spacing. Should be
* used for function signatures or type annotations.
*/
detail?: string; SublimeLSP currently uses heuristics to decide whether it can append The re-sorting of the filtered items is a different issue. I would expect As far as I understand, the
Maybe this is not the best example because the other item Anyways, since Sublime doesn't have the ability to distinguish between what should be displayed ( The heuristics are probably not perfect and there is more context to read about in e.g. sublimelsp/LSP#2189 ... but it is complicated and even not all language servers can comply how to use the various fields in a consistent way. But I think even having direct support for a |
You are the one misunderstanding the issue here, don't try to minimize the issue
That's the whole point, to dissociate what's being displayed from what's being used to decide what to filter Because ST doesn't have a way to render extra detail next to the label, SublimeLSP is merging both, here, this is a HACK, we are feeding undesired data to the CompletionItem, only to be able to display the extra information from the outside world, and as a result filtering looks bad
The heuristics is not the problem here, it is good, we just feed him undesired data labelDetails can contain all kind of data, including non-code, so a filterText is needed, or a new field to display extra info next to the label, or perhaps both |
I'm not minimizing the issue and I'm not the one who is misunderstanding it. You're using a language server which uses
But what is
This was done primarily because of a request from you: sublimelsp/LSP#1924 Regarding sorting you could try to remove the lines at https://github.com/sublimelsp/LSP/blob/d71e11a9d428462a5994508f7891914c3fa74258/plugin/completion.py#L248-L249 and test whether it works better then. I don't know the purpose why this is used and I think I've never touched those lines. |
To be fair Both proposals would be a possible solution, more or less. I like the details approach to display function signatures only for selected completion items as it significantly reduces noise. I wonder how it would cooperate with I also see possible benefits of a filterText, though I wonder if it on the other hand might cause some confusion if items stay in the list which absolutely do not share any character visually with typed content. |
Exposing an API to LSP-* packages to specify what should be displayed in the details section or annotation section could also address the reported issue. Related sublimelsp/LSP#2467 |
The point however is whole I've also been hit by ST absolutely refusing to select items I want for no obvious reason. |
I didn't request anything, i reported an issue saying that it doesn't support LSP's latest spec But glad to see that since 2021, ST has done nothing to improve the situation
Removing that puts But considering nothing was done since 2021, i'd suggest them to do the minimum, the filter text, so we'll get an improvement sooner rather than later, or am i asking too much already? Anyways, i get annoyed with tech, when it's not the language, it's the tools, something wrong with me perhaps |
Problem description
Right now, to support LSP's label detail, SublimeLSP puts the detail inside the trigger, wich means SublimeText will use garbage data during filtering
This is not good
You can see, the perfect match is always at the bottom, because other fields contains useless data
Same server using vscode:
Preferred solution
completion = sublime.CompletionItem( trigger, annotation, sublime.COMPLETION_FORMAT_COMMAND, kind, details=" | ".join(details), + filterText= filter, )
Alternatives
I can't think of any
Additional Information
No response
The text was updated successfully, but these errors were encountered: