Merge pull request #208486 from cpendery/fix/suggestion-sort

fix: terminal suggestions to sort by fuzzy score
This commit is contained in:
Daniel Imms 2024-03-23 13:52:10 -07:00 committed by GitHub
commit 50b43a6811
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 2 additions and 5 deletions

View file

@ -27,7 +27,6 @@ export class SimpleCompletionItem {
// sorting, filtering
score: FuzzyScore = FuzzyScore.Default;
distance: number = 0;
idx?: number;
word?: string;

View file

@ -40,7 +40,7 @@ export class SimpleCompletionModel {
private readonly _items: SimpleCompletionItem[],
private _lineContext: LineContext,
readonly replacementIndex: number,
readonly replacementLength: number
readonly replacementLength: number,
) {
}
@ -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 = {