Skip to content

Commit

Permalink
Always use TS's sort text in TS 4.9+
Browse files Browse the repository at this point in the history
Fixes #174628
  • Loading branch information
mjbvz committed Mar 7, 2023
1 parent 126ded7 commit 7140a53
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,19 +63,21 @@ class MyCompletionItem extends vscode.CompletionItem {
) {
super(tsEntry.name, MyCompletionItem.convertKind(tsEntry.kind));

if (tsEntry.source && tsEntry.hasAction) {
if (tsEntry.source && tsEntry.hasAction && client.apiVersion.lt(API.v490)) {
// De-prioritze auto-imports
// https://github.com/microsoft/vscode/issues/40311
this.sortText = '\uffff' + tsEntry.sortText;
} else {
this.sortText = tsEntry.sortText;
}

if (tsEntry.source && tsEntry.hasAction) {
// Render "fancy" when source is a workspace path
const qualifierCandidate = vscode.workspace.asRelativePath(tsEntry.source);
if (qualifierCandidate !== tsEntry.source) {
this.label = { label: tsEntry.name, description: qualifierCandidate };
}

} else {
this.sortText = tsEntry.sortText;
}

const { sourceDisplay, isSnippet } = tsEntry;
Expand Down

0 comments on commit 7140a53

Please sign in to comment.