vscode-hex-pm-intellisense icon indicating copy to clipboard operation
vscode-hex-pm-intellisense copied to clipboard

in some cases the version sorting is not working properly

Open dvic opened this issue 2 years ago • 5 comments
trafficstars

Currently, the sorting is done textually it seems:

image

We can improve this by parsing the version according to https://hexdocs.pm/elixir/1.14/Version.html and sort on the individual integers.

dvic avatar Feb 08 '23 11:02 dvic

Can you point me to the package you are trying to complete here? I'm a bit surprise because this should handle the sorting:

https://github.com/benvp/vscode-hex-pm-intellisense/blob/master/src/provide.ts#L93

benvp avatar Feb 08 '23 11:02 benvp

Oh, that's weird, it was ex_check

dvic avatar Feb 08 '23 11:02 dvic

It looks like the only way for this to fail is if the semver package has a bug? But that seems highly unlikely 😅 semver.compare("0.9.0", "0.15.0") should give -1

dvic avatar Feb 08 '23 11:02 dvic

Are you using the latest version of the extension? Tried it with that library and I get the following result

CleanShot 2023-02-08 at 12 20 59@2x

Any other steps to reproduce it?

benvp avatar Feb 08 '23 11:02 benvp

Yes, I just installed the extension. But I think I found the way to reproduce it:

when you autocomplete inside an empty string, like in your screenshot, it sorts properly, but when you autocomplete inside "~> 0.15.0" it does not sort it properly, when I add a space after "~> 0.15.0" and then autocomplete, it sorts it correctly again.

dvic avatar Feb 08 '23 12:02 dvic