Skip to content

Commit

Permalink
Merge pull request #4401 from James-Yu/suggestion-order
Browse files Browse the repository at this point in the history
Tweak suggestion order
  • Loading branch information
James-Yu authored Sep 20, 2024
2 parents 460246f + cd76bf9 commit 2974304
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/completion/completer/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function entryEnvToCompletion(item: EnvironmentInfo, type: EnvSnippetType): CmdE
if (item.package) {
suggestion.documentation += ` From package: ${item.package}.`
}
suggestion.sortText = label.replace(/([A-Z])/g, '$10').toLowerCase()
suggestion.sortText = label.replace(/([a-z])/g, '$10').toLowerCase()

if (type === EnvSnippetType.AsName) {
return suggestion
Expand Down
6 changes: 4 additions & 2 deletions src/completion/completer/macro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -421,10 +421,12 @@ function entryCmdToCompletion(item: MacroRaw, packageName?: string, postAction?:
suggestion.documentation += ` From package: ${packageName}.`
}
suggestion.sortText = (item.name + (item.arg?.format ?? ''))
.replace(/([A-Z])/g, '$10').toLowerCase()
.replace(/([a-z])/g, '$10').toLowerCase()
.replaceAll('{', '0')
.replaceAll('[', '1')
.replaceAll('(', '2')
.replace(/^(.+?)\(/g, '$12') // Skip \(
.replaceAll('|', '3')
.replaceAll('*', '9')
if (postAction) {
suggestion.command = { title: 'Post-Action', command: postAction }
} else if (isTriggerSuggestNeeded(item.name)) {
Expand Down

1 comment on commit 2974304

@julius-thomas
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bless you 🙏

Please sign in to comment.