If I am editing a file in VS Code, then alt-tab (or click) another program to view something else, then go back to VS Code, the focus has shifted over to the side panel, which prevents me from immediately typing in the editing panel. I find it really annoying to have to change the focus back to the editing panel every time (by either clicking or using keyboard shortcuts). Is there a way to have VS Code keep the focus where it is until I change it, even if VS Code is in the background for a bit?
This does not happen when my workspace is a local folder, but it does happen when my workspace is a remote folder connected via SSH (using the "Remote - SSH" extension).
Related
I am using VSCode on my Mac (Latest version) and when I hit the "Red X" on the top left of VSCode it closes my entire workspace and open editors. I want it to just close the window out of my view but keep everything open when I re-open the app (it is still running as it still has the white dot below).. I am getting the welcome page everytime I just "close window" and re-open.
Now if I were to two click and hit Quit, then yes, I'd expect my workspace and editors to all close and get the startup menu on re-opening.
I have tried searching in the settings and cannot find anything.
GUI Red X - VSCODE
Example. When playing music on iTunes and press the "RedX" on the GUI music keeps playing and everything opens as it was when it was closed. Thatis what I am trying to acheive on VSCode. Keep my "sandbox" and open files as is when pressing it..
To VS Code, I'm pretty sure that red x button and quit are the same thing (although it may be possible for it to treat them differently). Ie. I'm not aware of a way that you can get different behaviour for the red x button and the application quit action.
As for choosing whether the previous workspace should be reopened automatically, you can use the window.restoreWindows setting.
Controls how windows are being reopened after starting for the first time. This setting has no effect when the application is already running.
The values to choose from and their descriptions at the time of this writing are:
value
description
"all"(default value)
Reopen all windows unless a folder, workspace or file is opened (e.g. from the command line).
"folders"
Reopen all windows that had folders or workspaces opened unless a folder, workspace or file is opened (e.g. from the command line).
"none"
Never reopen a window. Unless a folder or workspace is opened (e.g. from the command line), an empty window will appear.
"one"
Reopen the last active window unless a folder, workspace or file is opened (e.g. from the command line).
"preserve"
Always reopen all windows. If a folder or workspace is opened (e.g. from the command line) it opens as a new window unless it was opened before. If files are opened they will open in one of the restored windows.
If you want open editors to be remembered and the previous workspace to be reopened automatically when you reopen VS Code,
You may also want to set something for the workbench.startupEditor setting, such as:
"workbench.startupEditor": "welcomePage", // or "none" or "newUntitledFile"
Also, loosely related is the "workbench.editor.restoreViewState setting, but the default value is true, so you only need to touch it if you don't want view state info like scroll position to be resotred on reopening closed editors.
Earlier The Panel of vscode used to close when I killed the terminal. But after I reset my pc and reinstall vscode, this is not happening. I after killing all the terminals I have to click on the "Close Panel" Button to close it.
How can I close the panel automatically on killing the last terminal?
Thanks for help in advance.
So the lower panel (or right/left panel if you moved it) should always automatically close if the terminal-view has had all of its terminals closed.
Now, with the above said, their is one exception, which is a common exception: When you show there panel with a view — i.e. the problems view, output-logger, etc... — with the terminal-view, the behavior of the panel changes. In the context I just described, the panel will not automatically close.
To solve the issue, remove all other views that share the panel with the terminal view. Then you should find that you get the expected behavior.
FYI, this has worked this way for a long time, and a while back (2+ years ago) there was a somewhat supported feature request to make the closing behavior of the panel more configurable — e.g. like adding settings that close the panel when the terminal-view has no terminals open, even if it is in a shared panel — however, I checked all settings & release notes and GitHub before answering this, and it appears that the panel & terminal view, in the context of this question, still behave the way that they always have since the first newer release of the non-beta VS Code.
Is there the option to "execute snippets" right away in vscode, meaning without having to press tab? This is really the only thing holding me back from vscode because in vim I can simply configure it, so e.g. if I have a snippet which gets triggered if I type test it automatically replaces test by the snippet content without having to press any extra key like tab. Is this possible in vscode?
Sometimes when closing vscode, or a tab therein, I get a dialogue asking "Do you want to save the changes you made to filename?" However, the unsaved edits are actually from a previous session that was closed without such a query, probably when turning off the computer, so I can't remember if it was meaningful edits, or maybe just an accidental key-press, like a shortcut gone wrong; and doing undo to revisit the last edits doesn't work either.
My question: How can I see the diff between the saved version of a file, and the version in the editor window? I think it would be nicest just to have a "show diff" option in the dialogue, but for now I'm also happy with a command line diff command.
I'm using ubuntu 20.04.
I'm using VSCode version 1.52.1 on MacOS and I had a similar problem that may not be the same problem, but I'm guessing it will work for you as well.
When you're in the Explorer view, in the upper left part of Explorer you have your "Open Editors." If that shows a dot to the left indicating that the buffer has changes in it, you can right click the file name and select "Compare with Saved." This will open another buffer to the side that will show you any unsaved changes.
To get rid of that window (it took me a bit to figure this out I'm sorry to say!), you can click the 'X' to the left of the extra buffer in "Open Editors."
Hope this works for you!
A few bright notes for the keyboard players out there:
The command you are asking about has a default shortcut. Unless you've applied a keyboard map extension, the Ctrl+Kd arpeggio opens the very same diff view between the active and saved versions of the current file. The default shortcut to close an editor tab (be it the diff or a file or anything at all) is Ctrl+W.
The command, like any command in VSCode, is also accessible via the Ctrl+Shift+P command dropdown (on Linux, F1 opens it too). Start typing e.g. compa sav (it saves your keyboard wear and tear to shorten words to a prefix which is unambiguous enough), and the list will shrink dynamically to just a few commands. Yours is File: Compare Active File with Saved. When it's close to the top enough, navigate the list of commands with the down arrow and execute it with Enter. As a bonus, you may click on the little gear to the right of the command currently highlighted in the list and redefine its shortcut, if you use it very often and prefer a chord shortcut to the default arpeggio one. Sorry, there does not seem to be a shortcut in lieu of the gear click. If there is, please let me know!
But if you really, really want to right-click on the filename in the Open Editors view of the Explorer sidebar, you can open that view directly with, you guessed it, a shortcut: Ctrl+Ke. And if you change your mind on a dime right at this moment, or realize that you in fact never had a mouse to do the right-click in the first place, use Shift+F10 to drop down the "right-click menu", properly called the context menu, which you navigate with arrows and execute with Enter (that's kinda a common theme, as you probably noticed). This works mostly anywhere the right-click does.
While in the Open Editors view, to switch to an editor file tab, move the selection to the desired file. Press Space to bring the file into view but stay in the Open Editors view, or Enter to bring the file into view and shift the keyboard focus to it. Pressing Ctrl+Shift+E brings focus back to the editor from any view in the Explorer sidebar. The same shortcut moves focus to the Explorer sidebar from the editor.
Happy ♬ k'boarding ♬!
ctrl+shift+P (or command+shift+P on mac) and fuzzy search for "compare changes with saved files"
I am using matlab on linux with gnome and I have a problem with the command window. Note that this problem goes away when I switch to twm, but I don't want to do that (for obvious reasons).
When the command window loses focus and then regains focus, it freezes, i.e., it ignores anything I type. The only consistent way I've found to unfreeze it is to click somewhere within the matlab window, but outside the command window (for example, the workspace or command history windows), and then click back in the command window.
This is very annoying and it happens all the time. Any help would be appreciated!
Thanks