Open astrowonk opened 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
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.
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:
quartoInstallation.binPath
is intended to be added to the front of PATH
via context.environmentVariableCollection.prepend
https://github.com/quarto-dev/quarto/blob/082a5b133d5802fe487ff73c6e002b56e22a0433/apps/vscode/src/main.ts#L70-L73
Later, there's clearly an expectation that $PATH
in the terminal will include this binPath
. https://github.com/quarto-dev/quarto/blob/082a5b133d5802fe487ff73c6e002b56e22a0433/apps/vscode/src/core/terminal.ts#L106
sendTerminalCommand()
includes a terminalEnv
https://github.com/quarto-dev/quarto/blob/082a5b133d5802fe487ff73c6e002b56e22a0433/apps/vscode/src/core/terminal.ts#L121-L123 that comes from previewEnv
handed to startPreview()
https://github.com/quarto-dev/quarto/blob/082a5b133d5802fe487ff73c6e002b56e22a0433/apps/vscode/src/providers/preview/preview.ts#L421-L422 which comes from PreviewEnvManager
https://github.com/quarto-dev/quarto/blob/082a5b133d5802fe487ff73c6e002b56e22a0433/apps/vscode/src/providers/preview/preview-env.ts#L39 which adds QUARTO_LOG
and QUARTO_RENDER_TOKEN
on top of the vars from terminalEnv()
which is initially an empty object to which QUARTO_R
and QUARTO_PYTHON
are added https://github.com/quarto-dev/quarto/blob/082a5b133d5802fe487ff73c6e002b56e22a0433/apps/vscode/src/core/terminal.ts#L36-L38
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.
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.)