Using WSL through CMDER in VSCODE - visual-studio-code

I have setup WSL in CMDER through settings->Startup->{WSL::bash} and also made it my default shell, so whenever I open CMDER it starts in WSL.
I integrated CMDER into VSCODE using https://github.com/cmderdev/cmder/wiki/Seamless-VS-Code-Integration and it is working. But the CMDER version opening inside VSCODE is not the default WSL shell.
How can I setup CMDER with WSL as shell, inside VSCODE?

I found the solution, I got the WSL shell with CMDER in VSCODE by adding the following in settings.
{
"terminal.integrated.shell.windows": "path\\to\\cmder\\vendor\\conemu-maximus5\\ConEmu\\wsl\\wslbridge.exe"
}
CMDER tab shows wslbridge.exe when I open WSL shell in CMDER. So I searched for wslbridge.exe inside CMDER folder and added the path in VSCODE settings and it worked.
I am not sure if this is the perfect solution or if this causes any issues in the future but it works for now.

Related

How to use the WSL and CMD terminal from VsCode terminal?

I can only use the bash, tmux, and javascript debug terminal in VsCode. I can't use the CMD and WSL terminal.
I tried to change it in the default terminal profile but there's no CMD and WSL there.
Press on Configure Terminal Settings and open setting.json file and add this line
"terminal.integrated.defaultProfile.windows": "Command Prompt",
Go to VSCode to learn more about terminal integration.

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

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!

VSCode terminal in ubuntu wsl

I've run into an issue where when I open vscode through WSL (command code.) it opens VSCode with no terminal whatsoever and there's no option to open one.
Terminal on WSL Ubuntu:
But when I run vscode from Windows I do have the option to use my Ubuntu terminal
Terminal on Windows:
Has anyone had similar issues? Did I miss a setting somewhere in VSCode?

How to integrate Cmder properly in VS Code?

I would like to integrate Cmder shell into my VS Code configuration.
I'm using VS Code 64bit on Windows, and I tried to modify my settings.json file as follows, to make Cmder work as the integrated terminal:
"terminal.integrated.shell.windows": "C:\\Program Files\\Cmder\\Cmder.exe",
I restarted my VS Code and tried to open the terminal.
At first, this error message box showed up:
Failed to copy ConEmu.xml file to backup location!
Restart Cmder as administrator.
So, I launched VS Code as administrator, which made the error message disappear; however, I noticed that VS Code opens Cmder in another separate window instead of in the terminal.
How can I run Cmder shell inside VS Code terminal?
P.S. Could this note in vs code documentation be the solution?
Tip: The integrated terminal shell is running with the permissions of VS Code. If you need to run a shell command with elevated (administrator) or different permissions, you can use platform utilities such as runas.exe within a terminal."
from: https://code.visualstudio.com/docs/editor/integrated-terminal
There is a mistake in your configuration file, the following is not valid:
"terminal.integrated.shell.windows": "C:\\Program Files\\Cmder\\Cmder.exe"
You should not be calling Cmder.exe from the VS Code, instead, you should use init.bat (from the instructions below) to integrate Cmder in VS Code.
Your issue has been already explained here over the Cmder repository.
Making Cmder work in VS Code
Make sure you're on the latest release of Cmder – download latest here
Open the settings.json configuration file, by pressing Ctrl + , (Control-Comma) to access the preferences, then click on the Edit in settings.json link
VS Code documentation explains the process in this link:
Can I use Cmder's shell with the terminal on Windows?
Yes, to use the Cmder shell in VS Code, you need to add the following settings to your settings.json file:
"terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
"terminal.integrated.shellArgs.windows": ["/K", "C:\\cmder\\vendor\\init.bat"]
BTW, You need to replace C:\\cmder with your own installation path.
Tip: replace single backslashes (\) with double backslashes (\\).
Make sure you read the notice at the official Cmder wiki:
👉 Please note the use of cmd.exe instead of cmder.exe.
Tip: refer to here on notes about handling spaces in your path.
TL;DR: It's not recommended by the Cmder team, but you may use ^ character before spaces to handle the paths.
You don't need to restart VS Code to make this work.
Hit Ctrl + ` (Control-Tilde) to open Cmder in VS Code terminal!
You may refer to my answer here for a complete explanation of how this works.
Related
There are similar issues over the VS Code repo and here on Cmder repo as well.
Cmder 1.3.12 introduced a vscode_init.cmd script which allows VS Code tasks to work correctly with Cmder.
The documentation in VS Code, referred to in the answer above, is out of date if you're using a version of Cmder greater than 1.3.11.
The Cmder GitHub repository now has extensive documentation on how to achieve integration between Cmder and VS Code. At the time of writing this message, it is more accurate than the VS Code documentation.
This worked for me on June 22nd 2021; add these lines to the settings.json file in your user settings (for me « C:\Users\ianla\AppData\Roaming\Code\User\settings.json »):
"terminal.integrated.profiles.windows": {
"cmder": {
"path": "C:\\WINDOWS\\System32\\cmd.exe",
"args": ["/K", "C:\\Users\\ianla\\cmder\\vendor\\bin\\vscode_init.cmd"]
}
},
"terminal.integrated.defaultProfile.windows": "cmder",
... of course, you'll need to change my « C:\Users\ianla\ » with your instalation "cmder" instalation path.
See here for more info
The following is that worked for me (version of Cmder greater than 1.3.11):
Paste \cmder directory into C:\tools
Paste in .vscode\settings.json :
"terminal.integrated.shell.windows": "cmd.exe",
"terminal.integrated.env.windows": {
"CMDER_ROOT": "C:\\tools\\cmder"
},
"terminal.integrated.shellArgs.windows": [
"/k",
"%CMDER_ROOT%\\vendor\\bin\\vscode_init.cmd"
],
.. and enjoy!

How to set mintty.exe as the default terminal on Windows?

I am trying to set the https://github.com/mintty/mintty terminal installed by Cygwin as the default Visual Studio Code terminal with:
"terminal.integrated.shell.windows": "D:\\Cygwin\\bin\\mintty.exe",
But it opens the Mintty.exe terminal on a new window, instead of show it as an embedded console.
Related thread I found about it:
How to change the integrated terminal in visual studio code or VSCode
How to Integrate babun shell in VS code
Is it possible to configure Babun/ZSH for the integrated terminal on Windows?
How to integrate terminal whth babun on windows?
You should use "D:\\Cygwin\\bin\\bash.exe" instead of mintty
cheers.
There are two terminal settings, you may want set them like this:
"terminal.external.windowsExec": "D:\\cygwin64\\bin\\mintty.exe",
"terminal.integrated.shell.windows": "D:\\cygwin64\\bin\\bash.exe",