wallabyjs / console-ninja

Repository for Console Ninja questions and issues
https://console-ninja.com
Other
377 stars 18 forks source link

[Bug]: Install Bin To Path disabled in VS Code but still updating .bashrc #252

Closed texastoland closed 8 months ago

texastoland commented 9 months ago

What happened?

@philsherry via https://github.com/wallabyjs/console-ninja/issues/19#issuecomment-1525457473:

I’d previously noticed that the extension added this in my .bashrc file:

PATH=~/.console-ninja/.bin:$PATH

I’d taken it out, tidied it up and moved it into my .path file, which is called before .bashrc — I like to keep things tidy, and know what’s where and why.

PATH="${HOME}/.console-ninja/.bin:${PATH}"

This .path file gets included in both bash and zsh shells on my Macs. However, your addition is only appearing in .bashrc — despite my use of zsh at the time, which is my default shell.

@NikGovorov replied:

We simply check if it's in .bashrc or not.

We've implemented the setting in v0.0.115.

It isn't currently working for me.

Version

v1.0.268

Steps to reproduce (or sample repo)

  1. Disable the option
  2. Remove the line from .bashrc
  3. Reload VS Code
  4. Line re-added

Log output

N/A
NikGovorov commented 8 months ago

Thanks for reporting the issue. We've fixed the console-ninja.installBinToPath VS Code setting and documented it in 1.0.270.

Should only check on install or prompt to add (best practice) Curious decision since zsh has been default since 2019 Should check console-ninja is found in $PATH instead of the exact line

We like all your suggestions and will consider implementing them in the coming weeks:

Ref: https://github.com/microsoft/vscode/issues/178577

texastoland commented 8 months ago

You rock so much thank you! Also happy subscriber to multiple products for years now 🙌🏼

NikGovorov commented 8 months ago

Thank you for your support. We really appreciate it.

texastoland commented 8 months ago
  • add out of box support of ~/.zshrc;

This may not be where you want it? That file is only for interactive shells (user prompts). I believe you need it accessible from scripts. .zlogin and .zprofile are for login shells which aren't usually scripts either. .zshenv is available everywhere though.

The situation for Bash is more complicated. .bashrc is interactive like you'd expect but not not login (unlike most user prompts). .bash_profile is login whether it's interactive or not. By default no file is loaded for non-login scripts.

Possibly you know all that and I don't understand the intent. Hope it helps anyway!

NikGovorov commented 8 months ago

Currently console-ninja command (script) is only used in the context of Universal Node apps and is supposed to run from an interactive shell. So we are covered with ~/.zshrc and ~/.bashrc. The only issue is that the most of the advanced users which sync their dotfiles move .zshrc to $ZDOTDIR and only keep .zshenv file (symlink) in the home dir, but I guess such users if they use Universal Node apps feature would prefer to manage their PATH variable manually anyway.

texastoland commented 8 months ago

Thanks I'm a longtime Quokka user and just learning Console Ninja.

In that case it should be in .bash_profile (and .zshrc). .bash_profile is used for login shells (all Mac prompts). .bashrc is exclusively non-login interactive shells. I don't know best practice but it's common on Mac to load .bashrc from .bash_profile for that reason.

advanced users...would prefer to manage their PATH variable manually anyway.

I used to do that but it's overcomplicated. I 100% agree everyone versioning dotfiles prefers to control their $PATH anyway. It may need added to the docs (couldn't find it). Thanks again 🙏🏼