Open VS Code with a blank text file open - visual-studio-code

I'm trying to set up VS Code such that when the program is just opened (not via the context menu for a file or clicking on a file) a new blank text file is open and ready to start typing in - similar to when Notepad++ is opened - or most other text editors, for that matter.
Searching for "VS Code open with new file" and many variants only brings me to articles/posts about opening a new file in a new tab or window. That's not what I'm trying to do.

File > Preferences > Settings
Search for startupEditor
Change
"workbench.startupEditor": "welcomePage"
to
"workbench.startupEditor": "newUntitledFile"
or select newUntitledFile from dropdown

In File > Preferences > Settings there is the following option listed under the Window section:
// Controls how windows are being reopened after a restart. Select 'none' to always start with an empty workspace, 'one' to reopen the last window you worked on, 'folders' to reopen all windows that had folders opened or 'all' to reopen all windows of your last session.
"window.restoreWindows": "none",
Using the editor in the right pane you can add:
"window.restoreWindows": "none"
Which will open an empty workspace with a link that says "new file". It's not exactly the solution you're looking for but it's the closest one I'm aware of.

This also stopped working for me. But I created a shortcut on my Taskbar like the following, and it does what I was looking for:
"C:\Users\myname\AppData\Local\Programs\Microsoft VS Code\Code.exe" C:\Users\myname\Downloads\Untitled

Related

Visual studio code - how to open multiple windows from context option

There are some guides in stackoverflow for opening multiple windows in Visual Studio. But it is inside the Visual Studio they are talking about.
Here is what I want. There is one txt file called A.txt in my desktop, I right click it and the context option shows Open With Code, and I open it. There is another txt file called B.txt in my desktop. While I right clit it and open it with visual studio code, both the two files are in the same window.
Is there any setting that the two files can be opened in two windows?
Not sure why you want that but actually there is a setting which behaves like you want when turned to "On":
Window: Open Files In New Window Controls whether files should open in
a new window when using a command line or file dialog. Note that there
can still be cases where this setting is ignored (e.g. when using the
--new-window or --reuse-window command line option).
You can find it via: User -> Window -> New Window
You can quickly open the settings dialog by pressing CTRL + ,

Visual Studio Code no longer jumps to errors in terminal with control click

Previously I've been able to jump to the error after running a program by control clicking on the error in the terminal window, but seemingly on restart this feature has gone away. Is this a setting I've messed with somewhere by accident or a key bind?
Update 1:
When control + hovering it gives the 'search project for' option
that just searches the code for the individual word as a string. I checked my settings using the preferences -> modified preferences and reset them with no change.
Add the following lines in settings.json file
"window.restoreWindows": "none"

Opening file/folder using Windows file dialog in VsCode

When I try to open file or folder in VsCode, Windows file dialog doesn't open. Instead, a box appears in the top-middle of VsCode to open file/folder.
How can I use Windows file dialog again?
Windows file dialog is default to open file/folder. But somehow I changed it to simple one. If you want to use "Simple Dialog" you should add the following lines to settings.json:
"files.simpleDialog.enable": true
To get back Windows file dialog, remove that line or change true to false.

Reopen last closed tabs

I'm new to Visual Studio Code. I've been tinkering with the settings for a while now and haven't yet found a way to make VSCode automatically reopen last closed tab(s). Say, I opened file 1, closed VSCode, went to open file 2 (in a separate folder), just to end up with only one tab opened despite what I have in my settings.json file:
"files.hotExit": "onExit",
"window.reopenFolders": "all",
"window.restoreWindows": "all"
I don't mind accumulated tabs every time I open VSCode, (Ctrl+w exists for a reason); if Notepad++ and Sublime Text can do it, then why not VSCode? Or am I missing something?
VS Code can currently only open one workspace in one window. Unless you have manually specified a multi-root workspace, VS Code will always open new files and folders as separate workspaces.

Visual Studio Code edit file

When I try to edit a file in visual studio code, I type the command 'code filename.ps1' and the code used to automatically open as a second tab in the editor.
Now, when I do the same thing, it opens in a new window. I have not changed anything in my settings and I can't find an associated Preference that controls this.
Anyone know exactly the default setting that I need to look at?
According to CLI Options this should work:
code -r filename.ps1
>
-r or --reuse-window
Forces opening a file or folder in the last active window.