-
Notifications
You must be signed in to change notification settings - Fork 125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong Node.js version displayed when using nvm.fish? #303
Comments
Oh, huh, yah that makes sense because the |
This is also relevant for phpbrew! |
I played around with editing the function _tide_item_node
# test -e package.json && _tide_print_item node $tide_node_icon' ' (node --version | string trim --chars=v)
_tide_print_item node $tide_node_icon' ' (nvm current | string trim --chars=v)
end
|
Thanks a million, Simon, it worked!
…On Sat, 28 May 2022 at 12:55, Simon Lydell ***@***.***> wrote:
I played around with editing the node item locally:
function _tide_item_node
# test -e package.json && _tide_print_item node $tide_node_icon' ' (node --version | string trim --chars=v)
_tide_print_item node $tide_node_icon' ' (nvm current | string trim --chars=v)
end
- nvm current prints the correct version, and it’s fast.
- I removed test -e package.json because I prefer to *always* show the
Node.js version.
- The above code obviously does not work for everyone :) Just sharing
—
Reply to this email directly, view it on GitHub
<#303 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ANKWY7W7WKSBJS3UTN6HUGDVMHURNANCNFSM5V7UGMEQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
I found an edge case with my solution above. If I do Not the end of the world, but a consequence of the prompt being run in a background shell I guess – since it’s a different shell it can never know for sure. |
Another edge case: Let’s say you have a Still, my solution gives the the correct result maybe 90 % of the time so it’s pretty good. |
Is there anything I could do here or over at nvm.fish to help with this? @lydell @IlanCosman 👋 |
@jorgebucaran I don't think so, unless you want to set the |
I looked around in the code to see if I could understand how this async stuff works. Is it this line? https://github.com/IlanCosman/tide/blob/v5.4.0/functions/fish_prompt.fish#L40-L41
|
Omg I can't believe I didn't think of just passing |
Alright, this should be fixed with the latest change on master. Hopefully the change doesn't cause any problems 😅 Will do a release soon. |
Great observation @lydell 💯 |
Describe the bug
The prompt seems to always print the “system” Node.js version, not the one currently enabled via nvm.fish.
Sorry if this isn’t a problem with tide! I’ve looked around in the issue trackers of both tide and nvm.fish for a long time and I’m very confused at this point! Seems to have been much back and forth and some collaboration in this area.
Steps to reproduce
nvm install 18
node -v
now says v18.1.0Screenshots
Environment
Output of
tide bug-report
:The text was updated successfully, but these errors were encountered: