render button feeds absolute windows path to wsl terminal resulting in error (file not found)
kompre opened this issue · 6 comments
Hello,
I just learned about quarto and would like to give it a try.
I use vs-code on a windows machine, but I prefer to use wsl as my default terminal (ubuntu). Quarto is installed also in the wsl.
When I click on the render button, a new terminal is open, but the command fails because the file path is windows-like, and obviously can't be found:
quarto preview c:/Users/path-to-folder/quarto.qmd --no-browser --no-watch-inputs
ERROR: c:/Users/path-to-folder/quarto.qmd not found
I wasn't able to find an option for using relative path, that would fix this error (since that files reside in the current working directory).
The easy fix is to change the default terminal to powershell, but it is a little bit of an hassle.
I made a change to use a relative path when running under WSL (I don't have WSL but based on my research this should detect it correctly): e57bc61. This change is available now in v1.52.0 of the extension.
Note that before we launch the terminal we set the cwd to the folder containing the input file. Hopefully that path is correctly translated and applied (could run into the same issue there?).
I've updated to v1.52.0 but I still get the same error, the full path is passed.
I'm not sure how do you detect if it is a wsl session, but when I click on render
it open a new terminal session called Quarto Preview
and then issue the command with the full path. I've tried to rename that window to something else, and when I click on render
again it opens another terminal windows called Quarto Preview
. Of course if there is already an available Quarto Preview
terminal session, it uses that.
Hello !
When I updated to version v1.52.0
the preview stopping working under WSL.
Went back to v1.51.0
, I can see that indeed a absolute path was use
quarto preview /home/.../library/folder/file.qmd
With v1.52.0
, a relative path is used but it is not relative to the root of the workspace.
Indeed I open library
as the root of my folder in vscode.
quarto preview file.qmd
Since file.qmd
is not at the root of the workspace and the terminal is opened by default at the root of the workspace it is not working.
Still not really the same problem as @kompre. I open my project with the WSL
extension of vscode which open it in wsl context directly which is different of opening it on windows and open a wsl sesssion only from the terminal.
Since the context is different, I do not know if I have to open another issue ?
Okay, I've reverted that fix as it clearly breaks WSL in other scenarios (fix is available in v1.53.0)
@kompre I don't think we can resolve this right now (without digging much deeper into the relationship between VS Code Terminals and WSL). You can see that for at least one other users they are getting "unix-style" paths in WSL sessions. Further, the fact that WSL seems to ignore the working directory setting of the created terminal throws another wrench in things. For now I'd just use PowerShell for Quarto projects and hopefully we can spend more time on WSL soon.
Yeah, i was thinking of using powershell for quarto either way because I got also shenanigans trying to render to pdf with the texlive installation...
I think I just need to delve a little bit in the workspace settings of vscode so that it will use powershell as default instead of WSL.
WSL is nice to have but sometimes could be tricky