Disable (integrated) terminal sharing between VS Code windows - visual-studio-code

I've liked using VS Code's integrated terminal in my VS Code windows. I usually have several different windows open, each in a different project, and use the terminal to interact with the git repository for the project and the compiler. However, currently (I think this changed in the June 2022 update?) it seems the integrated terminal has started sharing the working dir across VS Code windows, so that if I cd to a particular project/repository in one window, the terminal tab in other windows also change directory.
Assuming this is intentional, is there a way to use the integrated terminal in a way that keeps terminals in separate windows completely independent?

Related

Visual Studio Code Terminal Exits Immediately

When I open the terminal in VS Code, the terminal opens for about half a second, crashes, and outputs this message:
The terminal process "/bin/zsh '-l, '" terminated with exit code: 1.
What could possibly be the cause of this problem. and how do I fix it? I'm using a Mac.
You would want to check your user settings first. Review terminal.integrated settings that could affect the launch.
You're using a Mac, so on macOS, go to Code > Preferences > Settings. In the settings, you may want to search for this:
Just in case you modified settings.json without knowing, you could by typing in #modified or accessing it by Filter Settings (top right) > Modified.
If you did not modified anything, then it may be due to these:
Test your shell directly. Try running your designated integrated terminal shell outside VS Code from an external terminal or command prompt. Some terminal launch failures may be due to your shell installation and are not specific to VS Code. The exit codes displayed come from the shell and you may be able to diagnose shell issues by searching on the internet for the specific shell and exit code.
Use the most recent version of VS Code. Each VS Code monthly release has many updates and fixes and may include integrated terminal improvements. You can check your VS Code version via Help > About (on macOS Code > About Visual Studio Code). To find the latest version of VS Code, go to the VS Code release notes. You may also want to check that you have installed the latest version of your shell.
Use the most recent version of your shell. If your shell is installed separate from your platform, try installing the latest available version of the shell. The same advice applies if you are on an older build of your operating system. For example, some older versions of Windows 10 did not work well with the VS Code terminal.
Enable trace logging. You can enable trace logging and capture a log when launching the terminal. Logging often reveals what is wrong as all arguments used to create the terminal process/pty are recorded. Bad shell names, arguments, or environment variables can cause the terminal to not launch. Keep this log for later if your problem isn't solved.
Exit codes and shells
Search for the specific shells or exit codes in Google (if provided), maybe it would help.
If these still did not help, you may consider searching it in Google (mainly Stackoverflow or github).
Reference link: https://code.visualstudio.com/docs/supporting/troubleshoot-terminal-launch

Using host system Git when using WSL Remote in VSCode

I am currently trying to set up a new development environment, using VSCode, WSL, and the WSL Remote Extension. The environment will also utilize Git, and will sign commits via a YubiKey.
I initially tested this out the setup on a Windows 10 machine, using wsl2-ssh-pageant, and that worked flawlessly. I could sign commits straight from my WSL environment, and everything was awesome. Then I tried implementing this on my work machine, which is running Windows 11... Nothing is awesome.
Apparently there are a whole bunch of issues getting something like this to work on Windows 11, and the author of that library has abandoned the project. I have tried finding an alternative, testing things like npiperelay, wsl-ssh-agent, and a ton of others (too many to list), but the issue always comes back to Windows 11 (and downgrading is not an option).
Therefore, I decided to try a different approach. I can sign commits from Windows 11, using the Yubikey, without issue. So I wanted to get VSCode to use my local Windows 11 Git installation, rather than the WSL one. However, even when configuring git path in the settings, to use the Windows 11 Git, it seems to be using it inside a WSL container, meaning the Yubikey is unreachable; so all signing fails.
I should probably mention that both WSL and Windows 11 has access to the folder.
My current workaround is to do my development in VSCode, and then do all Git commands in a Windows 11 Terminal, which allows me to do signing, but it skips all the VSCode GUI and fancy tools, so I would like to keep everything in a single place.
So my question is: Is there a way to develop in WSL via VSCode, using the remote extension, while making VSCode do all Git operations on the host system (completely ignoring WSL)?

VS Code: Reopen windows after restart

I usally have multiple instances of VS Code running, working on different projects simultaneously. After a system restart I always have to reopen those windows manually ([File > Open Recent] may be a quick way, but still...).
Is there a way to do this more easily, for example using some kind of window management extension?
I found on Github a issue with the same approach: https://github.com/Microsoft/vscode/issues/26773
There they talk about "window.reopenFolders": "all"

VS code - 2 split terminal in one (split)

As I'm working with Node.js and Angular, I've currently work with two terminals where I have to switch terminal by the dropdown option.
Is there a way to have two terminals (split) in the same place
like this:
Couldn't find a way.
Update - Visual studio code has this feature starting with version 1.21
Split terminals
The Integrated Terminal can now be split such that multiple are visible at once, which can enable much easier management of terminals when you need a watch and a run command for example:
Open the article to see the GIF demonstration.
Splitting can be done by clicking the split button in the panel, through the context menu or the command Ctrl+Shift + 5.
....
Before VS Code introduced the feature
Inside vs code
You can configure your console to bash or cygwin, and then install and use tmux or screen.
Initial answer before I understood the question intent was to do it inside vs code
Outside vs code
On windows
I'm using Cmder.
It allows opening multiple cmd tabs, and configure more types of command lines / tabs - such as bash, nodejs etc.
On Linux
I got to play a bit with tmux and I heard it's a good option.
Screen shot from google:
On Mac
As Brad stated - tmux works also on Macs, so have a look at the Linux section above.
VSCode has added support to split the integrated terminal in february 2018, as requested by this issue.
At the time it is not yet released, you need to install the Insiders version of VSCode.
You have to set the keybindings yourself, the default are still being discussed here.
As of June 2021, you can select the terminal then enter command: ctrl + shift + 5.

how to navigate among open VS Code open windows on Mac

I recently updated Visual Studio Code to a new version (1.7.2) on my Mac.
I am used to open different 'windows' of VS Code at the same time on different projects.
In previous versions of VS Code I could navigate the VS Code open windows via 'cmd+>' (or 'cmd+z', now I do not remember this exaclty).
Now this key combination does not work anymore and, to navigate windows, I need to open the 'Window' menu option and chose from there.
Does anybody know how to navigate among open VS Code open windows on Mac with this version of VS Code?
Thanks in advance
control+w is working for me
It is showing all active windows
cmd+< is not provided by VSCode, it's a global shortcut of OSX witch works for all applications with multiple windows. You can check if its properly set up in Preferences->Keyboard->Shortcuts
However, there is a command in VSCode to select open windows from a list. Search the command palette for Switch Window, you can bind it to a shortcut yourself, command is called workbench.action.switchWindow.