Skip to content

Commit

Permalink
Merge pull request #208486 from cpendery/fix/suggestion-sort
Browse files Browse the repository at this point in the history
fix: terminal suggestions to sort by fuzzy score
  • Loading branch information
Tyriar authored Mar 23, 2024
2 parents 711ca55 + 9203d2d commit 50b43a6
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ export class SimpleCompletionItem {

// sorting, filtering
score: FuzzyScore = FuzzyScore.Default;
distance: number = 0;
idx?: number;
word?: string;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class SimpleCompletionModel {
private readonly _items: SimpleCompletionItem[],
private _lineContext: LineContext,
readonly replacementIndex: number,
readonly replacementLength: number
readonly replacementLength: number,
) {
}

Expand Down Expand Up @@ -174,15 +174,13 @@ export class SimpleCompletionModel {
}

item.idx = i;
// TODO: Word distance
item.distance = 1;//this._wordDistance.distance(item.position, item.completion);
target.push(item);

// update stats
labelLengths.push(item.completion.label.length);
}

this._filteredItems = target; // target.sort(this._snippetCompareFn);
this._filteredItems = target.sort((a, b) => b.score[0] - a.score[0]);
this._refilterKind = Refilter.Nothing;

this._stats = {
Expand Down

0 comments on commit 50b43a6

Please sign in to comment.