You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shell type is detected incorrectly after VSCode update #16175
When I run a python script, without ever changing a setting in vs code after its installation, it uses powershell as the default terminal profile and there is no issue.
But when I change the default terminal profile from powershell to command prompt
I get the "& was unexpected at this time." error
I've seen people say I should type ctrl+shift+p then type "select default terminal" to change my terminal from powershell to the command prompt, but this isn't an option in the 2021-05-06 version of Visual Studio Code
I am using a fresh Windows 10 install with nothing but miniconda and visual studio code.
Can confirm that this is also the case when using Git Bash as terminal.integrated.shell.windows works while terminal.integrated.defaultProfile.windows does not. According to Brett Cannon (@brettcannon)'s answer, Git Bash is not officially supported but I had no issues prior to the introduction of the new terminal settings with VS Code 1.56. To clarify here are my settings:
I disable it by setting "python.terminal.activateEnvironment": false,. I control the activation of the Python environment through .bashrc. I always use python -m venv venv to create a new Python environment in my project, so I add [ -f "venv/Scripts/activate" ] && source venv/Scripts/activate to .bashrc. The important thing is that it works well for me.
We're switching the default priority to always use the shell setting over the default profile if specified microsoft/vscode#123174. Unfortunately there isn't an easy/low risk fix for this other than that workaround.
Activity
Sunillad08 commentedon May 7, 2021
I tried changing default terminal to cmd but it still runs .ps1 instead of .bat file for venv . We can manually run .bat file and it will work in cmd.
mattkellymt commentedon May 7, 2021
When you Sunil Lad (@Sunillad08) say "we can manually run .bat" are you suggesting that I do this?
Sunillad08 commentedon May 7, 2021
Not really , you can run that if you want to work with cmd only . I was just addressing that I got same issue.
banggua commentedon May 7, 2021
terminal.integrated.shell.windowsworks good for me, butterminal.integrated.defaultProfile.windowsdoesn't.skilkis commentedon May 8, 2021
Can confirm that this is also the case when using Git Bash as
terminal.integrated.shell.windowsworks whileterminal.integrated.defaultProfile.windowsdoes not. According to Brett Cannon (@brettcannon)'s answer, Git Bash is not officially supported but I had no issues prior to the introduction of the new terminal settings with VS Code 1.56. To clarify here are my settings:Which results in the correct activation command:
$ source c:/Users/MDRyzenPC/Python/numfoil/.venv/Scripts/activate (.venv)Wheras with the
terminal.integrated.shell.windowssetting omitted the output is:Therefore, it seems like
vscode-pythonis not using the new settings yet!banggua commentedon May 8, 2021
I disable it by setting
"python.terminal.activateEnvironment": false,. I control the activation of the Python environment through.bashrc. I always usepython -m venv venvto create a new Python environment in my project, so I add[ -f "venv/Scripts/activate" ] && source venv/Scripts/activateto.bashrc. The important thing is that it works well for me.vscode
settings.json.bashrcasdasd-123 commentedon May 10, 2021
Also having this issue since the latest update. Worked fine before the weekend then from launch today I've been getting the issue.
I used the workaround San Kilkis (@skilkis) showed and that seems to have resolved it for now so would recomend that if anyone else is have trouble
karrtikr commentedon May 10, 2021
Thanks for the bug report! We just wanted to quickly acknowledge we received it and we will triage this as soon as we can. #16169 could be related.
7 remaining items
[-]& was unexpected at this time.[/-][+]Shell type is detected incorrectly after VSCode update[/+]karrtikr commentedon May 12, 2021
Please try the workaround mentioned here: #16175 (comment)
ChandlerTayek commentedon May 12, 2021
Confirming that this workaround worked for git bash.
Steps I took:
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"in my.../user/settings.jsonfile.Worked like a charm thank you Kartik Raj (@karrtikr) and banggua
karrtikr commentedon May 12, 2021
Blocked on getting upstream vscode issue fixed microsoft/vscode#121760
Tyriar commentedon May 12, 2021
We're switching the default priority to always use the shell setting over the default profile if specified microsoft/vscode#123174. Unfortunately there isn't an easy/low risk fix for this other than that workaround.
karrtikr commentedon May 12, 2021
I have followed up in the original issue. microsoft/vscode#121760 (comment)
Set default profile in exthost from renderer
karrtikr commentedon May 14, 2021
Hi everyone 👋 The fix seems to be now available on VSCode insiders. Please try it out and let us know how it goes.
FYI things are better but I'm still having this issue microsoft/vscode#121760 (comment), you may also see it.
ChandlerTayek commentedon May 14, 2021
Kartik Raj (@karrtikr) I'm able to select different default profiles and have the correct behavior with the insiders build.
karrtikr commentedon May 21, 2021
Should be fixed in the next stable release of VSCode. Note if you have both settings we prioritize the shell setting for now, #16175 (comment).