Can't open a Cmder terminal on VSCode (only powershell) since last update - visual-studio-code

Since one of the last updates of VSCodem, I am unable to open a Cmder terminal, even with cmder specifically indicated as my terminal client.
settings.json
"terminal.external.windowsExec": "C:\\laragon\\bin\\Cmder\\Cmder.exe",
"terminal.integrated.env.windows": {"CMDER_ROOT": "C:\\laragon\\bin\\Cmder"},
"terminal.integrated.shell.windows": "C:\\WINDOWS\\system32\\cmd.exe",
"terminal.integrated.shellArgs.windows" : ["/K","C:\\laragon\\bin\\cmder\\vendor\\init.bat"],
It only opens a powershelll terminal and cmder doesn't even appear on the dropdown options list on the add terminal button.
If I manually launch the cmder in windows and them press the CTRL+Ç, it will focus on the external window and will not open a terminal inside vscode.
Anyone had this problem? I can't figure it out... microsoft again doing what it does! I don't want powershell, I want cmder...
Thank you for any help!

Related

Visual Studio Code terminal error: The filename, directory name, or volume label syntax is incorrect

I have this issue in microsoft visual studio code, whenever I open the terminal the first message I get is The filename, directory name, or volume label syntax is incorrect. The terminal works fine.. just it bugs me to see see this error message whenever I open the terminal.. how do I fix it?
I Installed Cmder as my default visual studio code terminal, maybe there is something related to this error?
thanks in advance
I am not sure how you have installed cmder as the integrated terminal in vscode but in settings.json you could try pointing the terminal.integrated.shell.windows to cmd.exe and the terminal.integrated.shellArgs.windows to what makes cmd.exe be (act like) cmder which is cmder's init.bat file. So in your vscode settings.json add or modify the below lines to point to your cmd.exe and cmder init.bat respectivley.
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": [ "/k", "C:\\cmder\\vendor\\init.bat"],
I got the same problum but it got fixed by following this steps
go to setting and search json
click on launch -(Edit in setting.json)
now replace the line "terminal.integrated.shell.windows":(path as showing) line to
"terminal.integrated.shell.windows": "C:\Windows\System32\cmd.exe",
"terminal.integrated.shellArgs.windows": [ "/k", "C:\cmder\vendor\init.bat"],
save the program. Done!

Launch Windows Terminal from VSCode?

I'm trying to launch the new Windows Terminal through VSCode like I have with other terminal emulators.
Previously I've used the following setting in the VSCode JSON file settings.json to launch Cmder through VSCode with ctrl+C
"terminal.external.windowsExec": "C:\\Program Files\\cmder\\Cmder.exe",
However, trying the same with the directory of the Windows Terminal directory has been unsuccessful.
"terminal.external.windowsExec": "C:\\Program Files\\WindowsApps\\Microsoft.WindowsTerminal_1.0.1401.0_x64__8wekyb3d8bbwe\\WindowsTerminal.exe",
I thought that the executable was wt.exe, so if I'm correct, in your settings.json, you should be using:
"terminal.external.windowsExec": "C:\\Users\\skillcap\\AppData\\Local\\Microsoft\\WindowsApps\\wt.exe",
(remember to change the user name as required).
As a side note, the executable should also have been added to your %PATH%, so you should be able to generally start it using just wt, (with an unmodified %PATHEXT% variable).

How do I get around the verified bug in Windows 1903 and launch the VSCode integrated terminal?

I just did a fresh install of Windows 10 Pro version 1903 build 18362.116 and Visual Studio Code. Now the integrated terminal only launches externally.
Pressing Ctrl + ~ results in this.
What am I missing? How do I get it to open integrated again?
EDIT
After working with VSCode team it is a verified bug. See the Github issue here. I posted the workaround as an answer here.
OK, worked through this one in VSCode repo issues.
For now, until it's fixed, turn off ConPTY integration in the User Settings.
💥💥💥
The issue now says use legacy console. To change the setting open a cmd prompt. Right click the title to bring up properties.
Then Uncheck 'Use legacy console'
To change the integrated terminal on Windows, you just need to change the terminal.integrated.shell.windows line:
Open VS User Settings (Preferences > User Settings). This will open two side-by-side documents.
Check if "terminal.integrated.shell.windows" has value "C:\\Bin\\Cmder\\Cmder.exe" setting to the User Settings document on the right.
Remove this line.
Ctrl + ~ will now open integrated terminal of VSCode.
If the above solution doesn't work then can you try below values and check if it works for you:
// Command Prompt
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\cmd.exe"
// PowerShell
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe"
// Git Bash
"terminal.integrated.shell.windows": "C:\\Program Files\\Git\\bin\\bash.exe"
// Bash on Ubuntu (on Windows)
"terminal.integrated.shell.windows": "C:\\Windows\\System32\\bash.exe"
From the Command Palette (Ctrl+Shift+P), use the View: Toggle Integrated Terminal command.
Try custom shortcut:
[
{
"key": "ctrl+`",
"command": "workbench.action.terminal.toggleTerminal"
}
]
Had this problem fixed. Found the solution from the VS Code support.
for error:
Terminal exits with code 3221225786 (or similar)#
"This can happen when you have legacy console mode enabled in conhost's properties. To change this, open cmd.exe from the start menu, right-click the title bar, go to Properties and under the Options tab, uncheck Use legacy console."
source: VS Code docs

What's the command to open a new integrated terminal from within the integrated terminal in vscode?

I'm trying to setup a chain of tasks that need a terminal for each one. To do so, I need to use a command that opens a new integrated terminal tab from a previous integrated terminal. Is there any way to do so in vs-code integrated terminal?
In mac I would use
open -a Terminal
Or something like ttab that immediately opens a tab in the current iterm terminal.
Thanks
(edited: I'm looking for a command to type in the terminal, not hotkeys)
Ctrl+Shift+` (Tilda) is the keyboard shortcut to open another terminal on Windows.
Cmd+Shift+` (Tilda) is the keyboard shortcut to open another terminal on Mac.

In Visual Studio Code, how do you inject clink into the integrated terminal?

I was using clink with ConEmu for various node related tasks on windows, but now I'm trying Visual Studio code.
How do I inject clink into Visual Studio Code's integrated terminal, so that I can get real command history persistence between sessions, incremental history search, etc.?
With ConEmu I could inject clink by dropping the clink folder into a specified pickup directory.
I've tried using the path to the included clink bat file, and the clink exe in the VS Code setting terminal.integrated.shell.windows but these spawn and then close the command shell immediately.
Thanks!
I discovered that you can pass arguments to the integrated shell in Visual Studio Code. Combined with the cmd.exe /K option which Carries out the command specified by string but remains, clink can be injected.
In VS Code, go to File > Preferences > Settings or use Ctrl , and add the settings:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "C:\\path\\to\\clink\\clink_x64.exe inject"]
This is the equivalent of opening a command prompt in Windows, and running clink_x64 inject.
It is not answer for your question, but there is another trick to see cmder and text editor in one window. You can open your text editor as another tab in cmder, which I described here:
https://medium.com/#WMorkowski/protip-integrating-cmder-with-text-editor-7f08a6e76de7
from article:
Run your cmder.
Go to ‘Settings -> Startup -> Environment’
Type: set EDITOR_PATH=C:\Program Files (x86)\Microsoft VS Code\Code.exe alias editor="%EDITOR_PATH%" $1 -new_console:s50V Where
in the first line you should type path to your text editor (I was
testing it on Visual Studio Code and Sublime, but it should work with
other editors).
Save your settings
Type ‘editor’ command in command line.
Whoa! We almost finished. But in most cases you don’t want console tab
to be attached to the top of the window. You should close console tab,
and open it again, paying attention to check “New console split to
bottom” checkbox and choose the right console type. Now when you
finally set everything up, you should go to ‘Settings -> Startup’, and
check “Auto save/restore opened tabs” checkbox to save our new
workflow. Now every time you run cmder, your tabs setup will be
restored.
Expanding on my comment:
Open settings.json with:
File > Open > %APPDATA%\Code\User\settings.json
And assuming you installed clink with the magic of chocolatey:
choco install clink-maintained
Then your clink_x64.exe lives here:
C:\Program Files (x86)\clink\clink_x64.exe
And the lines you add to settings.json look like:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\sysnative\\cmd.exe",
"terminal.integrated.shellArgs.windows": [
"/K",
"C:\\Program Files (x86)\\clink\\clink_x64.exe",
"inject",
"--profile",
"~\\clink"
],
Note the addition of --profile ... this allows the history to be persistent between vscode sessions.