Context: I have a todo list file I always want to open as a pinned file in VSCode, but it's a pain having to reopen it manually for each project.
Is there any way to force VSCode to always open a particular file any time I open a new VSCode window?
Edit:
this should ideally work for all folders, as I often access remote folders over SSH that will not have workspaces created for them
Related
I want VSCode to always open the same folder when I launch it. The current behavior is to launch whatever folder VSCode thinks I last visited.
I maintain notes that are kept in folders on the same system that I run my local VSCode instance from. All of my development is on remote systems that are often not running when I launch VM. In a development session, I often have many (5-10) files open in VSCode on various source, config, and data files -- often on multiple remote systems. These remote systems are frequently not even running when I next launch VSCode.
When I launch VSCode, I want VSCode to always open (from the desktop) my local "notes" folder, where I keep my daily journal files. I want to then open folders on remote systems -- most often using the "File -> Open Recent" command.
I do not see anything in settings.json or in preferences that lets me control what folder is open on startup.
How do I configure VSCode so that it always opens the same (local) folder on startup, regardless of what files I was editing when I last closed it?
I open a file on a BeagleBone Black running debian 8.4 with VScode via SFTP with winSCP. By right clicking > edit > code.
When the file opens, VScode also opens three new files named visual, studio, and code (image attached). I did not create these files myself. Opening files from other sources does not cause this.
I have tried closing the files individually. Connecting and reconnecting. Opening and closing VScode. In every possible order and configuration. They return every time when opening another file with the same method.
This is how I have set up VScode as an editor in WinSCP.
This is extremely odd, and only trivial, yet highly annoying.
What's causing this? How do I stop it?
I have small problem with VSCode folder, that opened by default.
Problem description: I start new instance of VSCode (trough File->New Window), and then if I choose File->Open Folder it opens dialog with my Windows user folder as starting point (C:\Users\MyUser)
Question: How can I change that folder in settings (if it possible)? So by default it will show as start point for example D:\development\ ?
At the time I write this answer, this is not possible. There are two problems on Windows, and one problem on Mac and Linux:
VS Code does not provide a default path to the file dialog 1. It does remember the last folder that you opened a file in, but that path cannot be used as a default because it is overwritten constantly.
On Windows only, Electron ignores the default path when creating a file dialog if the default path is a directory 2.
An extension also cannot solve this, because extensions are not allowed to modify the File menu 3.
I think the best option at this point is to pin a folder to the Quick Access area in Windows Explorer, as suggested in a comment, or to put an actual shortcut in the user profile folder.
Workspaces and File > Open Recent may also be helpful if you often open the same folders.
Your main problem is that you are unable to open your specific folder in VScode.
To solve that you can simply open the terminal/cmd in that specific window by just typing cmd in your search bar or just by pressing shift+right-click in that folder.
Now your cmd is open and you just have to type "code ." in the cmd and press enter to open the current folder in your VSCode.
In case that code . doesn't work for you then you have to add the Vscode in the environment variables of your windows.
Visual Studio doesn't provide a specific feature to open a specific path. But there is a solution to your problem. You are saying that you want D:\develpment as a default when you open VS Code. You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.
make a shortcut on the desktop for vscode and then modify it and add the folder after the .exe command. This will default open that folder when you double click on it.
Visual Studio Code can be installed in two ways - User setup and System setup. I strongly believe you have User setup installed in your PC. Try re-installing it System-wide. That should probably fix your problem.
For more information: https://code.visualstudio.com/docs/setup/windows#_user-setup-versus-system-setup
PS: A lot more information is needed, you can share a screenshot of the window and elaborate more on it.
Using Visual Studio Code (latest version as well as prior versions), when using the command line to launch I am seeing some odd behavior. Trying to determine if I am missing something, or if this is a bug.
Here is the scenario.
Action 1: I have a workspace open with a couple of files open for editing. If I close VSCODE, and then just open it again the state is restored, I am in the workspace and the files are open for editing. Great.
Action 2: I have a workspace open with a couple of files open for editing. If I then from a command line do "vscode testfile.txt" then the new file gets opened in VSCODE and joins the other opened file. Great.
Action 3: I have a workspace open with a couple of files open for editing. I close VSCODE. I then from a command line do "vscode testfile.txt". VSCODE starts up, but only the new file gets opened in VSCODE. The workspace I had opened is not any more, and the files I had opened are no longer opened. Not so great.
I have tried adding the -r option on the command line but that didn't change anything.
This feels like a bug, but if not help me understand how I get the desired result, which is when VSCODE is not running, and I try to edit a file from the command line, I want VSCODE to restore to the state it was in when last closed, and then add that new file to the mix. Just like if it was already running.
I gave a chance to Visual Studio Code as my primary editor. I had been using Notepad++ and afterwards I have been using Sublime Text 2 and 3 for few years. I do see potential of this editor and I really like it, but there is one thing I am strongly used to.
Notepad++ and Sublime Text has this feature, I can edit file and DON'T save it anywhere. After restart Notepad/Sublime Text this file is there ready for me.
Other workflow could be open any file from my local storage, close VS Code and start it again. This file will not open!
I know about that when I open folder and restart VS Code, folder is open and files as well. But is there any way how can I manage to have opened files after restart without having opened folder?
Edit: This is now implemented:
// Controls whether unsaved files are remembered between sessions, allowing the save prompt when exiting the editor to be skipped.
"files.hotExit": "onExit"
I use the insider release, and in the current version (1.3.0), vscode doesn't keep unsaved file. I think there is a feature request for that.
Got it: https://visualstudio.uservoice.com/forums/293070-visual-studio-code/suggestions/8568343-keep-unsaved-files-after-crash
You can vote for that feature, like I did !
On the other hand, You can tell in settings if you want to re-open previously opened folders, but not files.
"window.reopenFolders": "all"