-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Shell type is detected incorrectly after VSCode update #16175
Comments
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. |
When you @Sunillad08 say "we can manually run .bat" are you suggesting that I do this? |
Not really , you can run that if you want to work with cmd only . I was just addressing that I got same issue. |
|
Can confirm that this is also the case when using Git Bash as "terminal.integrated.defaultProfile.windows": "Git Bash",
"terminal.integrated.profiles.windows": {
"Git Bash": {
"source": "Git Bash",
"icon": "terminal-bash"
}
},
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe", Which results in the correct activation command: $ source c:/Users/MDRyzenPC/Python/numfoil/.venv/Scripts/activate
(.venv) Wheras with the $ & c:/Users/MDRyzenPC/Python/numfoil/.venv/Scripts/Activate.ps1
bash: syntax error near unexpected token `&' Therefore, it seems like |
I disable it by setting vscode "python.terminal.activateEnvironment": false,
"terminal.integrated.defaultProfile.windows": "Git Bash",
"terminal.integrated.profiles.windows": {
"Git Bash": {
"source": "Git Bash"
}
},
function pyenv() {
python -m venv venv
pyac
python -m pip install -U pip setuptools
}
function pyac() {
[ -f "venv/Scripts/activate" ] && source venv/Scripts/activate
}
function pyde() {
deactivate
}
function pylock() {
pip freeze >requirements.txt
}
function pyinstall() {
pip install -r requirements.txt
}
pyac |
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 @skilkis showed and that seems to have resolved it for now so would recomend that if anyone else is have trouble |
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. |
Also having this issue since the latest update. |
Also experiencing issue starting today. Using version 1.56.1 The removal of the entry below in settings.json file will cause the "& was unexpected at this time" issue even though it is marked as deprecated (yellow underline). Adding the entry fixes this issue. "terminal.integrated.shell.windows": "C:\WINDOWS\System32\cmd.exe", |
I can reproduce this issue, thanks! There're 2 bugs:
The correct backwards compatible solution would be to read the new setting key first if it exists, and then fallback on the old setting key to support older versions of VSCode. Related: #16023 |
Please try the workaround mentioned here: #16175 (comment) |
Confirming that this workaround worked for git bash.
|
Blocked on getting upstream vscode issue fixed microsoft/vscode#121760 |
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. |
I have followed up in the original issue. microsoft/vscode#121760 (comment) |
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. |
@karrtikr I'm able to select different default profiles and have the correct behavior with the insiders build. |
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). |
Error: & was unexpected at this time
Workaround: #16175 (comment)
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.
The text was updated successfully, but these errors were encountered: