Skip to content

Commit

Permalink
Fix typo, use more specific type
Browse files Browse the repository at this point in the history
  • Loading branch information
Tyriar committed Feb 1, 2025
1 parent 863147b commit 1fec88a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ export class SimpleCompletionItem {
*/
readonly labelLowNormalizedPath: string;

readonly unscorePenalty: number = 0;
/**
* A penalty that applies to files or folders starting with the underscore character.
*/
readonly underscorePenalty: 0 | 1 = 0;

/**
* The file extension part from {@link labelLow}.
Expand Down Expand Up @@ -112,7 +115,7 @@ export class SimpleCompletionItem {
if (completion.isDirectory) {
this.labelLowNormalizedPath = this.labelLowNormalizedPath.replace(/\/$/, '');
}
this.unscorePenalty = basename(this.labelLowNormalizedPath).startsWith('_') ? 1 : 0;
this.underscorePenalty = basename(this.labelLowNormalizedPath).startsWith('_') ? 1 : 0;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -215,9 +215,9 @@ export class SimpleCompletionModel {
}
}

// Sort by unscore penalty (eg. `__init__/` should be penalized)
if (a.unscorePenalty !== b.unscorePenalty) {
return a.unscorePenalty - b.unscorePenalty;
// Sort by underscore penalty (eg. `__init__/` should be penalized)
if (a.underscorePenalty !== b.underscorePenalty) {
return a.underscorePenalty - b.underscorePenalty;
}

// Sort by folder depth (eg. `vscode/` should come before `vscode-.../`)
Expand Down

0 comments on commit 1fec88a

Please sign in to comment.