![]() Sometimes while debugging, you want to quickly analyze the flow of data through your program. There's another scenario where this feature can save you from having to clean up tons of file tabs. While it may not seem like a big deal when you're only swapping between a couple of files, this becomes very convenient when swapping between many files at a time. Instead of opening up both files completely and then closing each tab one-by-one, all I have to do is close a single tab once. Instead of fully (double-click) opening each of them, I can quickly browse both within the same tab, and then move along to the next files if my suspicions were incorrect. ![]() Let's say I'm working on a project that is throwing a weird error at me, and I suspect it is coming from an invalid value in one of my config files (let's call them "config.json" and "config2.json"). Very often while programming you will only need to open a file for a small window of time, to "preview" it's contents. They actually call this " Preview Mode," and it works exactly as it sounds. In other words, it's a feature, not a bug. There's probably a whole team solely dedicated to optimizing the user-experience of VS Code that decided this was a good thing to keep. The team behind VS Code did not program this in by accident. Why doesn't VS Code automatically open files in a new tab? This tells me that as soon as I click on another file in the explorer panel, params.js is going to disappear and be replaced by the new file. See how "params.js" is italicized in the screenshot below? If it's an "ephemeral" tab, VS Code will show the file name in an italicized text. The way to tell is to look at whether or not the file name text on the tab is italicized or not. ![]() How do I know if my file is "sticky" or not?īy "sticky" I mean that the tab will remain open even after you switch files. See how the text goes from italicized to normal after I double-click? It's magic. This works if the tab you are working with is in "Preview Mode" (italicized) and you want it to stay open when you open another file. Double-click the tab you want to keep open This will do the exact same thing as clicking the "Keep Open" option on the context menu. If you want to do this on Mac, the command is very similar: (Command + K Enter). This should be done while you have the tab you want to close selected. Use the (Ctrl + K Enter) keyboard shortcut. Simply right-click on the Preview Mode tab on the tab at the top of your screen (while it's italicized) and click on "Keep Open" once the context menu pops up.ģ. Right click your tab and select "Keep Open" Here's my beautiful demonstration of this:Īs you can see, when I double-click "sleep.js" and then navigate to "params.js" with a single-click, "sleep.js" remains open, and the title of the tab is in normal non-italicized text. This will tell VS Code that you want the file to stay open when you switch to a new file. Instead of single clicking on your files, (like I do in the previous GIF) double-click. Double-click your files instead of single-clicking. The next is to right-click the tab and select "Keep Open." The last is to execute the "Keep Open" shortcut (Ctrl + K Enter) while the tab is open and in focus. The most immediate, simple way to keep files open in VS Code is by double-clicking files in the explorer panel. If you're looking for the quick-fix, here it is: How do I make VS Code open files in a new tab? ![]() This quick guide will show you how this behavior works, how to work around it, why it exists, and how to change the default behavior if you wish. This can get frustrating if you have no clue what's going on or you're coming from a different text editor that does not have this behavior by default. Sometimes when you click on a file in the explorer panel, you want it to open in a NEW tab, instead of replacing the file that you're currently working on. Your new workaround becomes always having to edit a file to get it to stay open - even if it doesn't need to be edited! It's time to solve this. Soon, you discover that a file will stay open once it's been edited. Every time you go to swap files, the one you were JUST working on disappears, and you have to find it again in the explorer panel. So one day while you're hacking away you realize that VS Code just doesn't want to let you keep your file tabs open. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |