microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
164.45k stars 29.35k forks source link

Terminal fails to open after setting terminal.integrated.cwd in multi-root workspace #206199

Open sfsaccone opened 8 months ago

sfsaccone commented 8 months ago

Type: Bug

Steps to reproduce:

Is there some other way to select the default folder to use for the integrated terminal in a multi-root workspace?

VS Code version: Code 1.86.2 (903b1e9d8990623e3d7da1df3d33db3e42d80eda, 2024-02-13T19:40:56.878Z) OS version: Windows_NT x64 10.0.22631 Modes: Remote OS version: Linux x64 5.15.0-88-generic

System Info |Item|Value| |---|---| |CPUs|12th Gen Intel(R) Core(TM) i9-12900KF (24 x 3187)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: enabled_on
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|undefined| |Memory (System)|63.80GB (48.57GB free)| |Process Argv|| |Screen Reader|no| |VM|0%| |Item|Value| |---|---| |Remote|SSH: ubuntu3| |OS|Linux x64 5.15.0-88-generic| |CPUs|Intel(R) Core(TM) i5-8400 CPU @ 2.80GHz (2 x 2808)| |Memory (System)|3.28GB (1.75GB free)| |VM|0%|
Extensions (75) Extension|Author (truncated)|Version ---|---|--- Bookmarks|ale|13.4.2 clipboard-manager|Edg|1.5.0 vscode-great-icons|emm|2.1.102 vscode-firefox-debug|fir|2.9.10 vscode-apache|mrm|1.2.0 jupyter-keymap|ms-|1.1.2 remote-containers|ms-|0.338.1 remote-ssh|ms-|0.108.0 remote-ssh-edit|ms-|0.86.0 remote-wsl|ms-|0.86.0 vscode-remote-extensionpack|ms-|0.25.0 remote-explorer|ms-|0.4.1 remote-server|ms-|1.5.0 php-docblocker|nei|2.7.0 back-n-forth|nic|3.1.1 material-icon-theme|PKi|4.34.0 json-script-tag|sis|0.3.2 rewrap|stk|1.16.3 errorlens|use|3.16.0 vscode-todo-highlight|way|1.0.5 JavaScriptSnippets|xab|1.8.0 material-theme|zhu|3.16.2 Bookmarks|ale|13.4.2 webbookmarks|alu|1.2.5 laravel-extra-intellisense|ami|0.6.4 laravel-blade-vscode|ami|2.0.4 markdown-emoji|bie|0.3.0 vscode-intelephense-client|bme|1.10.2 vscode-tailwindcss|bra|0.10.5 insert-unicode|bru|0.15.1 laravel-goto-view|cod|1.3.11 vscode-eslint|dba|2.4.4 xml|Dot|2.5.1 vscode-html-css|ecm|2.0.9 vscode-command-runner|edo|0.0.124 prettier-vscode|esb|10.1.0 vscode-terminals|fab|1.15.0 dotnet-test-explorer|for|0.7.8 vscode-jasmine-test-adapter|hbe|1.8.2 vscode-test-explorer|hbe|2.21.1 vscode-favorites|how|1.11.0 browsersync|jer|2.2.2 vscode-gist|ken|3.0.3 calculator|lix|0.1.1 git-graph|mhu|1.30.0 vscode-scss|mrm|0.10.0 csharp|ms-|2.18.16 vscode-dotnet-runtime|ms-|2.0.1 debugpy|ms-|2024.0.0 isort|ms-|2023.10.1 python|ms-|2024.0.1 vscode-pylance|ms-|2024.2.2 jupyter|ms-|2024.1.1 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 live-server|ms-|0.4.13 test-adapter-converter|ms-|0.1.9 sqltools|mtx|0.28.1 php-docblocker|nei|2.7.0 vscode-data-preview|Ran|2.3.0 vscode-phpunit|rec|3.2.2 vscode-sort-json|ric|1.20.0 LiveServer|rit|5.7.9 vscode-coverage-gutters|rya|2.11.1 trailing-spaces|sha|0.4.1 vscode-blade-formatter|shu|0.24.1 vscode-scss-formatter|sib|3.0.0 rewrap|stk|1.16.3 code-spell-checker|str|3.0.1 vscode-workspace-explorer|tom|1.5.0 errorlens|use|3.16.0 php-debug|xde|1.34.0 markdown-all-in-one|yzh|3.6.2
meganrogge commented 8 months ago

this is working for me. check that your path is correct.

sfsaccone commented 8 months ago

I know the path is correct because it works in a single-root workspace. That is, if I set terminals.integrated.cwd (either under User or Workspace), in a multi-root workspace the terminal fails to open with the log error above. If I leave that setting alone and remove all folders but one from the workspace, the terminal opens as expected.

Note: this is a remote workspace. I'm connecting to a Linux machine from a Windows machine.

Must I disable my extensions?

I tried disabling all extensions except Remote - SSH. The issue persisted.

meganrogge commented 8 months ago

Oh now I understand. In the case of a multi root workspace, that setting does not apply.

meganrogge commented 8 months ago

This is working. I believe the error you're seeing is because the cwd is a relative file path. You're probably using an absolute path which doesn't exist.

Image

sfsaccone commented 8 months ago

I find absolute paths work if there's only one folder in the workspace. It fails if there's more than one, as shown in the screenshots. Note the backslashes in the error message. Looks like /home/ssaccone -> \home\ssaccone.

cwd-setting

termina-integrated-cwd-error

mwaibel-go commented 4 months ago

I have a trace log. Setting

  "terminal.integrated.cwd": "/home/mwaibel/projekte/applications/partner-tools"

yields

2024-07-01 10:03:25.639 [warning] [f7caf36] The terminal process failed to launch: Starting directory (cwd) "\home\mwaibel\projekte\applications\partner-tools" does not exist. []

Notice that the forward slashes in the path got replaced with backward slashes. I believe VSCode doesn’t detect that I’m using WSL and wrongly tries to convert the path to a Windows-style path.