vscode: First Terminal Does Not Follow Default

Issue Type: Bug

My terminal.integrated.defaultProfile.linux setting is zsh.

However, when VSCode first starts, when it re-starts, or after opening a project, the Terminal window opens with -bin/tcsh, as shown in the attached.

Logging out of this shell and then creating a new one will correctly launch a zsh, but the first one comes up with tcsh.

This is a duplicate of #142220, which was closed because I had been associating the issue with Python and Virtualenv. However, this problem exists even when neither of those are enabled for the project.

VS Code version: Code - Insiders 1.65.0-insider (Universal) (97c1e76d668d23d568044feb31083407f4c4b1ed, 2022-02-07T08:54:27.868Z) OS version: Darwin x64 21.3.0 Restricted Mode: No Remote OS version: Linux x64 3.10.0-1062.1.2.el7.x86_64

System Info
Item Value
CPUs Intel® Core™ i7-9750H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 2, 2, 2
Memory (System) 16.00GB (0.25GB free)
Process Argv –crash-reporter-id 006e15b5-a669-4bc7-a1f6-95633fbbc2b2
Screen Reader no
VM 0%
Item Value
Remote SSH: scv-bphunter01.csg.apple.com
OS Linux x64 3.10.0-1062.1.2.el7.x86_64
CPUs Intel® Xeon® Gold 6136 CPU @ 3.00GHz (2 x 2992)
Memory (System) 7.64GB (2.07GB free)
VM 100%
Extensions (23)
Extension Author (truncated) Version
vscode-select-by-indent hab 0.3.0
vscode-peacock joh 4.0.0
remote-ssh ms- 0.70.0
sublime-keybindings ms- 4.0.10
vs-qalc nor 0.1.8
jinja-snippets nox 1.0.0
material-icon-theme PKi 4.12.1
rewrap stk 1.16.1
jinja who 0.0.8
increment-selection alb 0.2.0
clock ang 1.0.1
better-toml bun 0.3.2
systemverilog eir 0.11.3
search-editor-apply-changes jak 0.1.1
align-by-regex jan 1.0.4
git-graph mhu 1.30.0
perforce mjc 4.15.2
vscode-text-tables Rom 0.1.5
vscode-paste-and-indent Rub 0.0.8
todotasks san 0.5.0
sort-lines Tyr 1.9.1
change-case wma 1.0.0
markdown-all-in-one yzh 3.4.0

(2 theme extensions excluded)

A/B Experiments
vsliv695:30137379
vsins829:30139715
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30422396
pythontb:30258533
pythonptprofiler:30281269
vshan820:30294714
pythondataviewer:30285072
vscod805:30301674
pythonvspyt200:30323110
bridge0708:30335490
bridge0723:30353136
vsaa593:30376534
pythonvs932:30404738
wslgetstartedc:30421358
vscop453:30404998
vsclayoutctrc:30405799
pythonvsnew555:30426298
vscscmwlcmt:30428973
azactmsalcf:30432849
vscgsvidc:30433759

Screen Shot 2022-02-07 at 10 23 34

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 14
  • Comments: 15 (1 by maintainers)

Most upvoted comments

This happens to me intermittently on Windows. I believe it can only happen to the very first terminal of any given VS Code window when launching from upon a completely new/fresh launch of VS Code (if you already have a VS Code instance/window open, it will not happen).

In my case, I have Git Bash setup as the default, but the first time I launch VS Code, when this happens, it makes the terminal a PowerShell. I can hit the + sign and it will be Git Bash on any following terminal. If I hit the dropdown, it shows Git Bash is the default.

I get inconsistent behavior and it seems to happen more often when many windows are being launched, which appears to cause the total VS Code launch time to increase by quite a bit, and that may be what is driving this to happen.

  • What I mean by multiple windows, is that if you do a file/exit with multiple VS Code windows open, it will close all of them, and then if you launch VS Code after that, it will open all the prior windows at once.
  • This is where it gets inconsistent. With 1 or 2 windows, usually I get the correct default terminal in all of them. I recently had a case where with 3 windows I got PowerShell on one of them, and Git Bash on the other 2. I just tried it with 4 windows, and I got PowerShell (the wrong terminal) on all 4 windows.

It seems there is a loading-order race condition where the config setting that tells VS Code which terminal is a default may not have loaded yet at the time a window is creating the terminal, the first time VS Code launches, if there is enough stuff going on at startup from many extensions and multiple windows being opened at once. (or something like that).

Here’s the rest of the info generated by my Issue Reporter:

VS Code version: Code 1.65.2 (c722ca6c7eed3d7987c0d5c3df5c45f6b15e77d1, 2022-03-10T14:33:55.248Z) OS version: Windows_NT x64 10.0.18363 Restricted Mode: No

System Info
Item Value
CPUs Intel® Core™ i7-9850H CPU @ 2.60GHz (12 x 2592)
GPU Status 2d_canvas: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 63.71GB (15.93GB free)
Process Argv –crash-reporter-id d41ff2b5-5fa5-42ff-b242-4daf658a8575
Screen Reader no
VM 0%
Extensions (59)
Extension Author (truncated) Version
matlab-formatter Aff 2.9.1
vscode-json and 1.5.0
vscode-pytest Cam 0.1.1
path-intellisense chr 2.8.0
excel-to-markdown-table csh 1.3.0
vscode-eslint dba 2.2.2
quicktype-refresh dog 0.1.1
xml Dot 2.5.1
prettier-vscode esb 9.5.0
git-extensions-for-vs-code for 1.1.3
matlab Gim 2.3.1
gitkraken-authentication git 1.0.3
gitlab-workflow Git 3.42.0
vscode-test-explorer hbe 2.21.1
vscode-test-explorer-liveshare hbe 1.0.5
reg ion 1.0.3
vscode-edit-csv jan 0.6.8
vsc-python-indent Kev 1.15.0
vscode-python-test-adapter lit 0.7.0
regedit m41 1.0.3
bash-ide-vscode mad 1.12.1
rainbow-csv mec 2.2.0
git-graph mhu 1.30.0
vscode-docker ms- 1.21.0
python ms- 2022.4.0
vscode-pylance ms- 2022.3.4
jupyter ms- 2022.2.1030672458
jupyter-keymap ms- 1.0.0
jupyter-renderers ms- 1.0.6
remote-containers ms- 0.231.2
remote-ssh ms- 0.76.1
remote-ssh-edit ms- 0.78.0
remote-wsl ms- 0.64.2
vscode-remote-extensionpack ms- 0.21.0
cpptools ms- 1.9.7
test-adapter-converter ms- 0.1.5
vsliveshare ms- 1.0.5449
vsliveshare-audio ms- 0.1.91
vsliveshare-pack ms- 0.4.0
nab-al-tools nab 1.20.0
autodocstring njp 0.6.1
vscode-python-typehint njq 1.4.1
indent-rainbow ode 8.2.2
plotly-dash-snippets Plo 0.0.6
java red 1.4.0
omg-idl RTI 1.0.1
vscode-coverage-gutters rya 2.9.1
python-string-syntax-highlight ste 0.1.2
even-better-toml tam 0.14.2
vscode-docker-registry-explorer Tqr 0.1.3
vscodeintellicode Vis 1.2.18
vscode-java-debug vsc 0.40.0
vscode-java-dependency vsc 0.19.0
vscode-java-pack vsc 0.22.2
vscode-java-test vsc 0.34.2
vscode-maven vsc 0.35.1
bracket-lens wra 1.5.1
JavaScriptSnippets xab 1.8.0
markdown-all-in-one yzh 3.4.0
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscorecescf:30445987
pythondataviewer:30285071
vscod805:30301674
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
pynewfile477:30463512

This happens to me intermittently on Windows. I believe it can only happen to the very first terminal of any given VS Code window when launching from upon a completely new/fresh launch of VS Code (if you already have a VS Code instance/window open, it will not happen). In my case, I have Git Bash setup as the default, but the first time I launch VS Code, when this happens, it makes the terminal a PowerShell. I can hit the + sign and it will be Git Bash on any following terminal. If I hit the dropdown, it shows Git Bash is the default. I’m seeing the same problem as @MSLeiter. I think quite a while it happened and then was fixed. But recently it has started happening every time I start VS Code. If I open a new window it seems to work correctly. Rather annoying.

I think this is no longer happening on: Version: 1.70.2 (system setup) Commit: e4503b30fc78200f846c62cf8091b76ff5547662 Date: 2022-08-16T05:35:13.448Z Electron: 18.3.5 Chromium: 100.0.4896.160 Node.js: 16.13.2 V8: 10.0.139.17-electron.0 OS: Windows_NT x64 10.0.19044

I’m having a very similar bug (though not exactly the same, it’s likely the same thing just different observed behaviour)

https://github.com/microsoft/vscode/issues/144825#issue-1165001031

This happens to me intermittently on Windows. I believe it can only happen to the very first terminal of any given VS Code window when launching from upon a completely new/fresh launch of VS Code (if you already have a VS Code instance/window open, it will not happen).

In my case, I have Git Bash setup as the default, but the first time I launch VS Code, when this happens, it makes the terminal a PowerShell. I can hit the + sign and it will be Git Bash on any following terminal. If I hit the dropdown, it shows Git Bash is the default. I’m seeing the same problem as @MSLeiter. I think quite a while it happened and then was fixed. But recently it has started happening every time I start VS Code. If I open a new window it seems to work correctly. Rather annoying.

I´ve found a temporary[^1] workaround 🎉 (don´t solves the core problem)

Instead of configuring your default shell/ terminal the recommended way by setting terminal.integrated.profiles.linux and terminal.integrated.defaultProfile.linux in your remote machines settings.json like here

{
  "terminal.integrated.profiles.linux": {
    "bash": {
      "path": "/usr/bin/bash",
      "icon": "terminal-bash",
      "args": ["-l"]
    }
  }
  "terminal.integrated.defaultProfile.linux": "bash"
}

use the deprecated way of setting the default terminal (which fixes the bug for me 🙌):

{
  "terminal.integrated.shell.linux": "/usr/bin/bash",
  "terminal.integrated.shellArgs.linux": ["-l"]
}

You can use both solutions at the same time so all your profiles are accessible when launching new terminals after VSCode is up and running. [^1]: This will not work forever as the config used is deprecated

I have removed terminal.integrated.profiles.windows from my user settings. Now when I open vscode I get my preferred terminal specified in terminal.integrated.defaultProfile.windows