direnv / direnv-vscode

unclutter your .profile
https://marketplace.visualstudio.com/items?itemName=mkhl.direnv
BSD Zero Clause License
157 stars 11 forks source link

direnv.path.executable only works with full path #754

Open dougg0k opened 4 months ago

dougg0k commented 4 months ago

Hi,

I was trying out the extension, but it seems that it is only able to recognize direnv through the full path.

/home/user/.../direnv

I tried with bash env var $HOME/user/... and it didnt work

I tried with nushell env var $env.HOME/... and it didnt work

and tried with tilde ~/.../direnv and it didnt work.

That does not make the path very flexible in the config, is there a way to make it work with variables or tilde?

Oh, and straight call to direnv does not work.

mkhl commented 4 months ago

Sadly vscode doesn't support that, see microsoft/vscode#2809

Oh, and straight call to direnv does not work.

Weird, that should work, that's even the default value. Can you explain this one in a bit more detail?

dougg0k commented 4 months ago

Sadly vscode doesn't support that, see microsoft/vscode#2809

Oh, and straight call to direnv does not work.

Weird, that should work, that's even the default value. Can you explain this one in a bit more detail?

Not much to explain, it says it didnt found the executable, through the popup on the right bottom in vscode. Only time it doesnt, is with the full path.

mkhl commented 4 months ago

Sadly vscode doesn't support that, see microsoft/vscode#2809

Oh, and straight call to direnv does not work.

Weird, that should work, that's even the default value. Can you explain this one in a bit more detail?

Not much to explain, it says it didnt found the executable, through the popup on the right bottom in vscode. Only time it doesnt, is with the full path.

Does the same error occur when you reset the setting to the default value? Does direnv live in your PATH?

dougg0k commented 4 months ago

Could be because I am using nushell as default shell, there it is set. It is also the default shell in vscode, but might not matter if internals are tied to bash.

dougg0k commented 4 months ago

Yeah, confirmed, it's because PATH was not in .bashrc. It's basically forcing you to setup on bash.

mkhl commented 4 months ago

Yeah, confirmed, it's because PATH was not in .bashrc. It's basically forcing you to setup on bash.

FWIW that's done by your windowing system (or whatever context you start vscode in), vscode doesn't (and cannot) care about your shell.

dougg0k commented 4 months ago

Hm, most context are by going through to the folder and typing code .

Not sure where else the default could be changed, I already had changed in chsh and x-terminal-emulator setting.

They dont seem to matter.

AllanLeanderRostockHansen commented 1 month ago

I get the same error using the absolute path to direnv, I copy-pasted the output of which direnv into the settings (/opt/homebrew/bin/direnv). Any suggestion on how to fix this?

Setting it to just direnv (the default value) also raises the error.

dougg0k commented 1 month ago

Solution is what they recommend at direnv, you have to set the eval in the .bashrc or whatever other shell you use, I know that with nushell it does not work.

https://direnv.net/docs/hook.html