Difference between the appDataPath and extensions location in VS Code - visual-studio-code

Why do the VS Code extensions live at a different location than any other user preferences/settings?
According to the getAppDataPath logic in VS Code, the user-defined settings, such as the settings.json, keybindings.json, etc. go under:
/Users/You/Library/Application Support/Code/ (on macOS),
C:\\Users\\You\\AppData\\Roaming\\Code\\ (on Windows), and
/Users/You/.config/ (on Linux)
But the extensions are under ~/.vscode/extensions on all supported platforms.
Does anyone know why don't they put the extensions under ${getAppDataPath}/extensions?
Thank you!

The answer to my question was posted here.
because the paths that you get from getAppDataPath are not for storing extensions, they are for configuration files
at least on Linux they use $XDG_CONFIG_HOME, which is intended for configuration files and not a bunch of extensions

Related

VSCode language extension not recognized

I have created a new extension (tmlanguage) for VSCode using the Yeoman generator.
The extension where copied to users//.vscode/extensions.
This extenxion is working fine on two of my computers and one collegua's machine.
The extension is implemented, and i can see it in the extensions browser in VSCode.
When I added this for two other colleguas, the same way I did for the 3 first computers, it doesn't work. VSCode acts as if there is noe extensions to read, or does not read them at all. As if it does not check the extension folder.
I have tried to disable all extension, then enable them again, but still the same.
In the Extension browser there is no mentioning of the new extension.
Have tried restarting VSCode.
One of the machines is Win 11, but the other is Win 10. The machines that work are all Win 10, not that I think this has something to do with it.
All running latest version of VSCode.
Is there a way to force VSCode to recognize the extensions?
Have anybody experienced similar things?
Thanks to Lex Li for pointing me in the correct direction. I thought I had followed the correct way to do this, to just copy the extension to the .vscode\extensions folder, as specified in several tutorials.
But using the vsce to generate a .vsix file did work.

Can you have isolated VS Code environments so each project has its own extensions?

I work on multiple projects in VS code. Over time and across projects I have accumulated so many extensions so that starting up is slower and some extensions cause things to break so I have to reinstall VS code to open up a project.
Is there a way, similar to python venv, where you have have multiple instances of vs code each with its own set of extensions?
Yes - you can disable/enable extensions per workspace! Not quite the same as install/uninstall but should solve your problem of extensions running on startup
You go to extensions menu, click the gear icon on some installed extension and you can Disable (Workspace). You can do the same in reverse for enabling per workspace - docs here.

share settings between linux and windows

I have a question: I would like to share settings between two Visual Studio Code installations, one on Windows and another one on Linux.
Simply activating, the syncing of the settings is a bad idea since they contain platform-dependent paths, e.g., the location of the ssh config file. I did it and ended up with a broken VSC installation on linux: it could not find anything because the settings contained windows paths.
I ended disabling most of the syncings, up to the point where the syncing is useless.
Is there any way, a plugin, to easily share settings between installation on different OS platforms?

All users extensions on visual studio code

I manage PCs used by a lot of people who all need the same basic extensions.
Is it possible to install extensions for all users.
If so how can I do it?
thank's.
If you want to force-install extension in VSCode, you can use VSCode command line interface to do that.
Do note however, that this extensions will sync with user profile, if it is connected to Microsoft/GitHub.
You also have the option of suggesting the extensions to users who open your repository.

Multiple configurations for VSCode

At the moment I'm working on a few projects at the same time using VSCode, one in react, another in angular and some good old javascript.
The problem is that I have a few extensions installed that conflict, for example, some code snippets that are the same for React and Angular.
Is it possible to have 3 visual studio code installed on a Mac with different extensions installed?
There are two options for such setup:
Portable installation - unzip VSCode in a folder and create a subfolder there called data. This will trigger the portable mode and all settings will be stored in that data folder. The downside is that you'll have to manually update every portable folder whenever new version comes out. More info here.
Custom config paths - create a shortcut for your VSCode installation, and add those parameters:
--user-data-dir <some-path> --extensions-dir <some-path>
You can put them wherever and have as much shortcuts as you want, they even run in parallel. Best part is once you update the installation, all the configs are upgraded too. More info here.
Both modes are incompatible, so you have to choose one.