benvp / vscode-hex-pm-intellisense

Adds IntelliSense for hex.pm dependencies in your Elixir project Mixfile.
MIT License
19 stars 4 forks source link

Fix descending semver sort for hexpm packages #5

Closed xmbhasin closed 6 years ago

xmbhasin commented 6 years ago

Fixes benlime/vscode-hex-pm-intellisense#4

I reviewed the vscode API and it seems it is not possible to disable sorting of completion items on vscode's end. I had to comply then with basic Javascript lexicographic sorting to make vscode respect the semver sorting performed by the extension.

benvp commented 6 years ago

Where did you find the stuff which documents the sortText expextednby vscode? I remember searching a lot for proper documentation on that field.

xmbhasin commented 6 years ago

The CompletionItem API was all I referenced: https://code.visualstudio.com/docs/extensionAPI/vscode-api#CompletionItem

sortText must be a String and vscode falls back to label if it is falsy so I realized that sorting on the extension end was not being respected. I figured vscode must be sorting lexicographically, otherwise it would have to make assumptions about your extension.