You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Completion items are not sorted when extra text typed after completion invocation #842
The LSContentAssistProcessor sorts completions based on the rank when completions are first computed. If extra chars are typed after the initial CA invocation then the list of proposals is filtered (as invalid proposals are filtered out) but never sorted again based on the document filter text. The generic editor ContentAssistant is null thus nothing is sorted after the initial invocation. The result is irrelevant completion proposals ends up at the top of the list.
It'd be great if somehow we could set the sorter on the ContentAssistant... I couldn't find a way unfortunately and ended up using reflection just to test the hypothesis.
After writing the code below in lsp4e i was able to achieve the desired effect:
One possible workaround can probably be to use isIncomplete: true int the completion results, so LSP4E would then re-invoke, and hopefully re-sort, the results.
Looks like the merged PR is only to address the support for isIncomplete: true. The issue is that we need completion proposals sorter for the isIncomplete: false as well. Seems that a platform change is required to get this fixed.
Does anyone have a pointer here where the isIncomplete case is handled or - to be more precise - where the new attempt to grab an updated list of proposals from the language server is triggered after the user typed more characters?
Activity
mickaelistria commentedon Oct 9, 2023
One possible workaround can probably be to use
isIncomplete: trueint the completion results, so LSP4E would then re-invoke, and hopefully re-sort, the results.mickaelistria commentedon Oct 9, 2023
Isn't it the root issue?
rubenporras commentedon Oct 9, 2023
While
isIncomplete: truewill probably work, we should avoid it, as it will cause additional roundtrips.Not being able to reorder is an usability problem, so it would be nice if someone would have time to fix it. Maybe it requires a platform change?
BoykoAlex commentedon Oct 9, 2023
@mickaelistria
isIncomplete: truewas the first thing I've tried but it didn't work. After some digging i think i see why it didn't work for me.isIncompleteonly checked here:but looking at the code in
CompletionProposalPopupclasses i see this:Thus it never gets to
p.isValidFor(document, offset)but instead callsp.validate(document, offset, event)I put the following code in
LSCompletionProposaland then it worked properly:sebthom commentedon Sep 6, 2024
@BoykoAlex can we close this issue?
BoykoAlex commentedon Sep 6, 2024
Hmm... I think so, but let me check this out first and get back to you
BoykoAlex commentedon Sep 7, 2024
Looks like the merged PR is only to address the support for
isIncomplete: true. The issue is that we need completion proposals sorter for theisIncomplete: falseas well. Seems that a platform change is required to get this fixed.martinlippert commentedon Sep 24, 2024
Does anyone have a pointer here where the
isIncompletecase is handled or - to be more precise - where the new attempt to grab an updated list of proposals from the language server is triggered after the user typed more characters?