Open zhaocai opened 5 years ago
Hmm, I think there could be some logic about preferring the (apparently case-sensitive) prefixes... cannot quickly find it.
I have similar cases and my guess is that matches at the beginning of the folder name are being preferred, regardless of the entry's weight: 107 C:\Users\Zhao\Documents\WindowsPowerShell\Modules\oh-my-posh 65 C:\Users\Zhao\Documents\WindowsPowerShell\Modules\posh-git
That is of course a valid metric, BUT weight should overrule the "beginning of name" rule.
The issue is at https://github.com/vors/ZLocation/blob/29cb9e6cf90a331c2f823e94772e1a027d464425/ZLocation/ZLocation.Search.psm1#L18-L30, the results are sorted by whether or not they start with the prefix, then by their value. Changing https://github.com/vors/ZLocation/blob/29cb9e6cf90a331c2f823e94772e1a027d464425/ZLocation/ZLocation.Search.psm1#L30 to Sort-Object -Property Value, Starts -Descending
should resolve this, as results will then be sorted by value first, only using the prefix if two have the same value.
Oh yeah, I remember now. #26 where it started. I don't know what's really the right answer here - should the tool try to be smarter or should it try to be dumber but more predictable.
I have been seeing the same issue and its been driving me nuts 😄
Any workarounds for this?
:bug: Somehow, the second weighted path is picked.
👍 However, sometimes the first weighted path is chosen as expected.
💡 Any idea?