Giter Site home page Giter Site logo

Comments (12)

jorgebucaran avatar jorgebucaran commented on June 18, 2024 2

Fixed. Thanks, everyone! 🙌

from nvm.fish.

jorgebucaran avatar jorgebucaran commented on June 18, 2024 1

We could just revert the scope of nvm_data as per @debashisbiswas' suggestion.

See the commit above to see why we changed the scope to universal. Thank you, @rhenning! 😁

from nvm.fish.

lorthirk avatar lorthirk commented on June 18, 2024 1

👋🏼 just stumbled across this while syncing config with chezmoi across a couple of machines

The world is such a small place... I am in the very same situation! I've been watching this issue for a long time, and I am also available for anything!

from nvm.fish.

jorgebucaran avatar jorgebucaran commented on June 18, 2024

Or perhaps just change the variable scope to global? 🤓

from nvm.fish.

thernstig avatar thernstig commented on June 18, 2024

If that works ok, sure :)

from nvm.fish.

debashisbiswas avatar debashisbiswas commented on June 18, 2024

Following the above recommendation, I changed nvm_data from universal to global, moving it out of fish_variables and into conf.d/nvm.fish (not config.fish, which happens after the default version is loaded), which worked for my use case.

Is this something you'd be interested in this project doing? If so, I wouldn't mind making the PR.

from nvm.fish.

jorgebucaran avatar jorgebucaran commented on June 18, 2024

nvm_data is universal because 2f2af43. If we can find a way to change it back to global without creating new issues, that'd be great.

from nvm.fish.

rhenning avatar rhenning commented on June 18, 2024

👋🏼 just stumbled across this while syncing config with chezmoi across a couple of machines, which inadvertently picked up the statically-rendered interpolation of nvm_data in fish_variables. i began to work around it with a template but then started to wonder how it got set... glad to see others are thinking about it too.

glad to help PR, test, buy coffee, etc. 😆

p.s. many thanks for your contributions to the community, @jorgebucaran. awesome work!

from nvm.fish.

debashisbiswas avatar debashisbiswas commented on June 18, 2024

nvm_data is universal because 2f2af43. If we can find a way to change it back to global without creating new issues, that'd be great.

I read through the issues that this commit was meant to fix. To provide context for this discussion: the reason it was made universal is to avoid requiring the user to restart their terminal after installing, and to avoid issues in which their config was set up to use nvm before nvm.fish was run.

from nvm.fish.

lorthirk avatar lorthirk commented on June 18, 2024

I would love to think of a way to fix this, but I'm afraid that the context @debashisbiswas provided is not enough for me to fully understand ths issue 😕 any other hint would be greatly appreciated

from nvm.fish.

debashisbiswas avatar debashisbiswas commented on June 18, 2024

@lorthirk It's been a few months, so I've forgotten the specifics, but I can try to give you a bit more context. Looking at 2f2af43 and the related issues, there seem to be a few reasons why the variable was made universal. The issues in question are #130, #139, and #140.

Universal variables are applied immediately, and available to all sessions. On the other hand, global variables are per-session, and must be set before they are used within the session. Previously, the global variables were set in conf.d/nvm.fish, which runs when the session starts. Right after a fresh install, this file hasn't been run yet, so trying to use nvm immediately after installing resulted in errors. This means that users needed to start a new session after install. This caused some confusion for users, so universal variables were used instead. I believe this is what happened in #130 and #140. It should be possible to achieve the same behavior with global variables if they're managed correctly.

Also, config files in fish are loaded on startup in a specific order. If the user's config is set up to use nvm before conf.d/nvm.fish is run (for example, by using nvm install in conf.d/aaa.fish, which would run before), there will be issues with variables being uninitialized, which results in the same error as the previous paragraph. This is what happened in #139, and universal variables solve this as well. I am not sure that there's a way around this with global variables, but this case may not be necessary for this plugin to handle, as this is more specifically related to how a user's fish config is set up.

from nvm.fish.

lorthirk avatar lorthirk commented on June 18, 2024

Thanks @debashisbiswas. Now that you explained it in such an easy to understand way, I'm not so sure any fix we could come up with would be better than "hackish". I have a naive question: would be that bad to add a warning message when installing nvm.fish that warns about such issues? Honestly, restarting a session is not that bad once you know you have to do, and in general I wouldn't let this drive the architecture of an application. As per the other issue, as you said, this really sounds like something a user should be warned of and arrange his/her custom configuration accordingly.

What do you guys think?

from nvm.fish.

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.