quarto-dev / quarto

Quarto open-source scientific and technical publishing system
https://quarto.org
GNU Affero General Public License v3.0
315 stars 26 forks source link

VS Code extension: quarto.path does not have any impact. #352

Open astrowonk opened 8 months ago

astrowonk commented 8 months ago

I have expanded the quarto RHEL 7 tarball to my home directory, and thought I could just tell VS Code quarto extension to use it from there, rather than change my shell PATH to include this custom quarto path.

So, I have set quarto.path. But when I run say, quarto preview from the VS Code command pallet, I can see the command it sends to the terminal window and it is just:

quarto preview ...

No sign of it using the quarto.path setting I have set.

This is with VS Code Remote, so the Quarto extension is installed on the remote SSH machine (and the setting is changed in the Remote settings.)

astrowonk commented 8 months ago

Looking at the code base, it seems the intent is to add the binPath to the path but this doesn't seem to be working. When I echo $PATH in the terminal after the quarto preview command fails, there's no sign of the appended quarto binPath (which does appear to be correct, since the "Verify Quarto Installation" command works fine and shows the path I entered in quarto.path

memeplex commented 7 months ago

I've been experiencing this also. I'm evaluating using Quarto so at first I created a temp venv and set quarto.path to the quarto-cli command there. I had to restart VSCode twice IIRC in order for it to take effect. This has happened to me at least three times I think, with different venvs I created. Notice that said venvs were never set for the workspace in Code, indeed I have "quarto.usePipQuarto": false so I'm only relying on the external command set in quarto.path .

To sum up, at the beginning the behavior was quite random but at certain point the setting always end up sticking.

gadenbuie commented 4 months ago

I've also run into this and haven't been able to get quarto.path to work for the Quarto preview button.

Some notes as I tried to follow the path through the extension:

After looking through the above, clearly there is a strong expectation that context.environmentVariableCollection.prepend() is going to add the quarto.path to the front of $PATH.

Reading through VS Code issues on this lead me to https://github.com/microsoft/vscode/issues/99878 where others have pointed out issues with prepending to PATH. After poking around in my settings and the terminal, I realized that my custom quarto.path is correctly added when I use bash shells, but not zsh or fish shells.

Quarto doesn't have a "default terminal profile" option, but setting "terminal.integrated.defaultProfile.osx": "bash" results in quarto preview using the expected Quarto binary. Changing the global terminal profile isn't optimal (I'd prefer not to use bash all the time), but it's nice to have a way around this problem.