how to change the VS Code snippet path - visual-studio-code

javascript snippets are placed in a folder named appdata\roaming\code\user\ (on windows PC ). How do I change that folder? Would like to place visual studio code snippets in a onedrive shared folder.
thanks,

I don't think you can change the snippets folder, but you could move your folder to OneDrive and then make a symlink in its place.
move "C:\Users\<user>\appdata\roaming\code\user\" "C:\Users\<user>\OneDrive\code\"
mklink /d "C:\Users\<user>\appdata\roaming\code\user\" "C:\Users\<user>\OneDrive\code\user\"

Related

Visual Studio Code Install Multi-User Image / School Environment [duplicate]

I've put Visual Studio Code on OneDrive, for the purpose of syncing it with its settings across my devices.
However, extensions are stored in %USERPROFILE%\.vscode\extensions on Windows.
Is it possible to change this folder's location so I can put it in the main Visual Studio Code folder?
At first I thought that copying the extensions in the resources\app\extensions of Visual Studio Code folder will be a nice workaround, but that doesn't work.
I've also searched for a solution on the documentation page and in the user settings, with no results.
What I did - after installing Visual Studio Code for the first time, I checked the documentation and added at the end of 'Target' field of editor's shortcut the following (there's a space before the two dashes):
--extensions-dir="DRIVELETTER:\VSCODE\extensions"
--user-data-dir="DRIVELETTER:\VSCODE\settings"
where DRIVERLETTER and VSCODE are the corresponding drive and directory where Visual Studio Code is installed. So mine looks like this:
"D:\Microsoft VS Code\Code.exe" --extensions-dir="D:\Microsoft VS Code\extensions"
Here is for the user data directory:
"D:\Microsoft VS Code\Code.exe" --user-data-dir="D:\Microsoft VS Code\settings"
Accessing the 'Target' field is done by right-clicking the shortcut and choosing 'Properties'
Anyway, there's a simpler solution to that problem - just use the portable version of Visual Studio Code. It works under Windows, Linux, and macOS:
Enable Portable Mode
Windows and Linux
After unzipping the Visual Studio Code download, simply create a data folder within Visual Studio Code's folder:
|- VSCode-win32-x64-1.25.0-insider
| |- Code.exe (or code executable)
| |- data
| |- ...
From then on, that folder will be used to contain all Visual Studio Code data, including session state, preferences, extensions, etc.
The data folder can be moved to other Visual Studio Code installations. This is useful for updating your portable Visual Studio Code version: simply move the data folder to a newer extracted version of Visual Studio Code.
macOS
On macOS, you need to place the data folder as a sibling of the application itself. Since the folder will be alongside the application, you need to name it specifically so that Code can find it. The default folder name is code-portable-data:
|- Visual Studio Code.app
|- code-portable-data
Portable mode won't work if your application is in quarantine, which happens by default if you just downloaded Visual Studio Code. Make sure you remove the quarantine attribute, if portable mode doesn't seem to work:
xattr -dr com.apple.quarantine Visual\ Studio\ Code.app
Note: On Insiders, the folder should be named code-insiders-portable-data.
UPDATE 14.12.2021
From Visual Studio Docs
Note: Do not attempt to configure portable mode on an installation from the Windows User or System installers. Portable mode is only supported on the Windows ZIP (.zip) archive. Note as well that the Windows ZIP archive does not support auto update.
A little hack:
Create a symbolic link to the folder %USERPROFILE%\.vscode\extensions under the Visual Studio Code install path.
https://code.visualstudio.com/docs/editor/extension-gallery
code --extensions-dir 'new_directory_to_set'
Set the root path for extensions.
Follow the below steps for changing the extension path in VS.
Set "code" path in environment variable.
path = VS_CODE_INSTALL_DIRECTORY/bin;
Open VS , in VS terminal execute the below command.
code --extensions-dir "new_directory_path"
Install the required extension.
All Done.
Note:Dont forget to vote the answer
According to this page, after installing VS Code we should make a language profilers folder like this:
mkdir code_profiles
cd code_profiles
mkdir code-ruby
cd code-ruby
mkdir exts
mkdir data
For Windows, I prepared a batch file (.bat) for each language I work on, it contains this line:
Start "" "D:\programs\VSCode\code.exe" --extensions-dir D:\programs\VSCode\code_profiles\code-python\exts --user-data-dir D:\programs\VSCode\code_profiles\code-python\data .
This is for Python. If I work on PHP, I will make code-php folder, then make exts and data folders in it and prepare another batch file for PHP, just like the one I made for python.
I put this batch file on the main project folder then double click on it to run VS Code with the preferred profile.

Visual Studio Code "Renaming Folder"

regarding my post from Microsoft Forum Support I was referred to this page hoping that someone can help me.
Question: Is someone here who can explain how it's possible to rename the folder ".vscode" in ".Visual Studio Code" so that the VSCode Editor works?
For clarification: I don't mean renaming it via Windows Explorer! I mean to rename the Directory (or Folder) from .vscode To .Visual Studio Code !
Know what I mean? I think it has something to do inside the Settings of VS Code.
Thanks in advance
Mike (Germany)
You could create a symlink from ".Visual Studio Code" to .vscode. That would give you a .Visual Studio Code folder in your workspace without breaking the way VSCode works.
But you'll still have a .vscode folder as well. I don't know if that achieves what you hope to accomplish or not. If you're on Windows you could set .vscode as hidden if you like, so you won't see it (unless your system is setup to show hidden files/folders).
Can you explain what you hope to accomplish by using a different name for the .vscode folder?

VS Code File Explorer Does Not Move Up File Tree (Windows)

The file explorer in my VS Code is stuck on a repo that is three steps down the file tree from the C drive (Flatiron_Work); it will not allow me to access anything further up the tree, such as Users or username (mngav) It is installed correctly in C:\users{username}\AppData\Local\Programs\Microsoft VS Code . I have tried to open files, folders and workspaces further up the tree but nothing works. Am I going to need to remove and reinstall?

How do I change the "test git" to point another file directory?

How do i point the directory, currently at "test git" to somewhere else, using VS code?
I kinda know that its pointing to the "test git" folder in my git.
Im trying to run a py file, using relational directories, and this is messing things up.
Tried a few methods:
1) cd..
2) open the py from that directory in VS code
all do not work.
Cheers,
Look under File menu and choose Open Folder to open a different folder in VS Code. The other option is to go into your terminal, find the directory you want to open VS Code in, and run code ..

VS Code update removed extension

In the following folder I created a new language for VS Code C:\Program Files\Microsoft VS Code\resources\app\extensions\mynewlanguage
Today I updated VS Code to v1.17.2.
After VS code update, this folder doesn't exist anymore. Is it normal? Where should I have created my language? Did I lose all my work?
Thanks, David
Yes, that is normal. The C:\Program Files\Microsoft VS Code\resources\app\extensions folder is reserved for extensions that VS Code ships with by default. It appears that this folder is overwritten upon each update, which would clear out any files you put there.
The place where all extensions from the marketplace go (and where you should have put your custom extension) is in C:\Users\[USERNAME]\.vscode\extensions.
Chances are high that unless you made a backup of the extension somewhere else, your work is lost.