2

Multiple configuration profiles.

Let's suppose I work with two or more technologies. Example PHP and JS (nodejs).

It is possible to have a PHP profile where the vscode would be all set to php and another profile with the vscode all set to nodejs.

I ask this so I don't have to fill the vscode with extensions that I wouldn't be using at that moment. Use only what is relevant to the technology used at the time.

Is it possible to do that?

rioV8
  • 24,506
  • 3
  • 32
  • 49
Tiago
  • 797
  • 1
  • 10
  • 23
  • you can disable extensions on workspace level – rioV8 Oct 19 '22 at 00:50
  • @rioV8 But the intention is not to keep installing and uninstalling depending on the language being used at that moment. I would like to know if the VSCODE has it natively or if there is any plugin that manages this. – Tiago Oct 19 '22 at 00:54
  • Yes, see https://stackoverflow.com/questions/71186027/how-to-create-different-environments-to-code-in-vs-code-e-g-by-language-se/72875272#72875272 You can create a different profile for each environment. And https://stackoverflow.com/a/62287770/836330, – Mark Oct 19 '22 at 01:20
  • open a workspace, go to the extension page, select an extension and choose **Disable in Workspace**, next time you open this workspace the extension is not loaded, no need to install/uninstall – rioV8 Oct 19 '22 at 04:49
  • if you have a lot of Python and JavaScript workspaces use the profile method but find out if that is stored with the workspace – rioV8 Oct 19 '22 at 04:50

1 Answers1

0

You can install a group of technology-specific extensions in a dedicated folder and start an instance of vscode configured to use that folder.

Example (this is for Mac, I would imagine the process is similar on Windows):

I'm starting in a folder that has node and php projects as well as an empty vscode-ext where extensions will be installed:

❯ # ~/src/local/vscode-multi-project

❯ tree
.
├── node
│   └── index.js
├── php
│   └── index.php
└── vscode-ext

3 directories, 2 files

Install project-specific extensions to their respective folders (you can do it using UI too).

❯ code --extensions-dir vscode-ext/node --install-extension chris-noring.node-snippets
Installing extensions...
Installing extension 'chris-noring.node-snippets'...
(node:54394) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Electron --trace-deprecation ...` to show where the warning was created)
Extension 'chris-noring.node-snippets' v1.3.3 was successfully installed.

❯ code --extensions-dir vscode-ext/php --install-extension xdebug.php-debug
Installing extensions...
Installing extension 'xdebug.php-debug'...
(node:54476) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `Electron --trace-deprecation ...` to show where the warning was created)

❯ tree -L 3
.
├── node
│   └── index.js
├── php
│   └── index.php
└── vscode-ext
    ├── node
    │   └── chris-noring.node-snippets-1.3.3
    └── php
        └── xdebug.php-debug-1.29.0

7 directories, 2 files

Make sure extensions are installed

❯ code --extensions-dir vscode-ext/node node

enter image description here

❯ code --extensions-dir vscode-ext/php php

enter image description here

Max Ivanov
  • 5,695
  • 38
  • 52