Code Monkey home page Code Monkey logo

Comments (6)

vors avatar vors commented on August 23, 2024

Hmm, I think there could be some logic about preferring the (apparently case-sensitive) prefixes... cannot quickly find it.

from zlocation.

Snaptags avatar Snaptags commented on August 23, 2024

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.

from zlocation.

theaquamarine avatar theaquamarine commented on August 23, 2024

The issue is at

# we should prefer paths that start with the query over paths with bigger weight
# that don't.
# i.e. if we have
# /foo = 1.0
# /afoo = 2.0
# and query is "fo", we should prefer /foo
$res = $hash.GetEnumerator() | % {
New-Object -TypeName PSCustomObject -Property @{
Name=$_.Name
Value=$_.Value
Starts=[int](Start-WithPrefix -Path $_.Name -lowerPrefix $lowerPrefix)
}
} | Sort-Object -Property Starts, Value -Descending
, the results are sorted by whether or not they start with the prefix, then by their value. Changing
} | Sort-Object -Property Starts, Value -Descending
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.

from zlocation.

vors avatar vors commented on August 23, 2024

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.

from zlocation.

eamodio avatar eamodio commented on August 23, 2024

I have been seeing the same issue and its been driving me nuts 😄

from zlocation.

deviousasti avatar deviousasti commented on August 23, 2024

Any workarounds for this?

from zlocation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.