Skip to content

Completions ignores sortText #109067

@boaz-codota

Description

@boaz-codota
  • VSCode Version: master
  • OS Version: ---

Building TabNine we encountered a bug in completions, where sortText is ignored if any CompletionItem does not contain sortText attribute. This causes the IDE to totally ignore the sortText in the ordering, forcing the sort algorithm to fallback to label only.

Steps to Reproduce:

  1. Use suggestions from a source that provide sortText (such TabNine) & a source that does not provide sortText (such the built in lsp).
  2. Completions suggestions's ordering will be based on the label and not on the sortText.

I traced the bug to this line:
https://github.com/microsoft/vscode/blob/master/src/vs/editor/contrib/suggest/suggest.ts#L274
The problem is that it is checked that sortText is present on both CompletionItems, breaking the sort functionality if any single item does not implement sortText.

Does this issue occur when all extensions are disabled?: Yes

Metadata

Metadata

Assignees

Labels

*dev-questionVS Code Extension Development QuestionsuggestIntelliSense, Auto Complete

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions