DEV Community

El Bruno for Microsoft Azure

Posted on • Originally published at elbruno.com on

@code โ€“ Profiles in Visual Studio Code, work with only the extensions you need! ๐Ÿ˜€

Hi !

Profiles in Visual Studio Code are a way to create different environments for different projects or purposes. They allow us to switch between different sets of extensions, settings, and keyboard shortcuts without affecting our default VS Code configuration.

I found it super useful mostly when I think about the extensions that I have. In example: if Iโ€™m doing plain rust coding, I donโ€™t need all my Azure and IoT extensions loaded in VSCode. I just need the rust ones.

Here is how I create a new profile with my necessary extensions. In the Manage option (bottom left), select [Profiles // Create Profile]

In the Manage option (bottom left), select [Profiles // Create Profile]

Create an empty profile.

Create an empty profile.

Iโ€™ll name my new profile โ€œBlog Demoโ€.

I'll name my new profile

I have no extensions installed in this profile. Iโ€™ll install CoPilot and Rust Analyzer.

I have no extensions installed in this profile. I'll install CoPilot and Rust Analyzer.

And thatโ€™s it ! my new profile, will only have these 3 extensions and my VS Code experience will be much lighter ๐Ÿ˜€

Happy coding!

Greetings

El Bruno

More posts in my blog ElBruno.com.


Top comments (3)

Collapse
 
kkm000 profile image
Cy "kkm" K'Nelson

Hi El Bruno, I'm manly suffering from shortcut conflicts in extensions, and certainly welcome this new feature! Like, I open a Jupyter notebook, hit Shift+Enter to run a code cell and... it inserts an empty line below the current one, because the "Visual Studio Keybindings" extension decided so. I have been using Visual Studio since before it was Visual Studio (neรฉ Visual C++ back in the 1990), but never known about this shortcut... The fewer extensions, the better!

The downside is that setting sync nightmare between computers increases in direct proportion to the number of profiles in use. :)

Do you happen to know whether user settings of the main, Default profile are propagated to other profiles? The moment I create a new profile, the entire, formerly the only User settings file settings.json is copied from <Root>/User/settings.json to <Root>/User/profiles/<profile>/settings.json (<Root> is platform-dependent, and <profile> is a cryptic name, like, in my case, -2b9e98ae, used instead of the profile's real name to make sure that I become even more confused than I already am :-) ). If, for example, I delete a setting from the <profile>/settings.json, then which one will be used: the setting from my main User/settings.json, or the default, as if this setting were not set at all? The JSON settings editor dimmed some settings with a tooltip saying that this setting can be changed only in the Default profile, so the answer may even possibly depend on a particular setting.

I also don't understand yet how this new feature interacts with the remotes, both SSH and the newly added Tunnel, and almost all my work with VSCode is remote, on cloud VMs. Do profiles propagate to remotes, too? It didn't look to me that they do. Fortunately, extensions conflicts on remotes are not as common as in the front end. Indeed, more posts on this feature would be helpful! (hint, hint!)

The Profiles feature is entirely undocumented, despite there being quite a buzz about it. Microsoft so weirdly decided not to even mention it in the documentation, as if it weren't officially there yet, but the news widely reported that it had been released, according to the very same Microsoft, with VSCode 1.75. Strange things are going on, indeed...

Collapse
 
asifm profile image
A M

The Profiles feature is now documented here.

I agree that it's not implemented thoughtfully enough. What makes it unusable for me is that it doesn't inherit (as far as I can tell) but rather duplicates. The issue here suggests they're thinking about it.

I haven't looked into profiles in remote setups but here's a (now closed) issue discussing it.

Collapse
 
kkm000 profile image
Cy "kkm" K'Nelson

Thanks for the update, looks like they've expanded the documentation with the FAQ section and more details on how profiles work.

I would not call profiles unusable, but I'm also miss inheritance a lot. I am maintaining my main profile sorted alphabetically and by groupโ€”I don't change it too often, and mostly edit it in JSONC. This allows using any diff&merge tool to transfer changes, but that's very inconvenient, no doubt about that. VSCode is not my main IDE (VS is), but I'm using it even for xplat C++ development (VS remote dev concept is very different: the files are local, and sent to the remote as needed; also, the support for CMake was fairly basic and the SSH client library for remoting very outdated; I'm not sure I'll prefer VSCode to VS for my next xplat C++ project).

Here's what I mean by keeping the settings.json hand-formatted: sort keys alphabetically, insert a // when the headword changes. Works for one set of settings, but if I had 5 profiles, not sure I would keep them as neat as I maintain one :(

  //
  // ***REMOTE. ####Possibly handled by CPP tooling already, is clang-tidy needed?
  "clang-tidy.blacklist": [],
  "clang-tidy.buildPath": "${command:cmake.getBuildDirectory}",
  //
  "clipboard-manager.checkInterval": 1000,
  "clipboard-manager.maxClips": 20,
  "clipboard-manager.onlyWindowFocused": false,
  "clipboard-manager.snippet.enabled": false,
  //
  // ***REMOTE.
  "cmake.ctest.parallelJobs": 9,
  "cmake.configureOnOpen": true,
  "cmake.debugConfig": {
    "miDebuggerPath": "gdb",
    "MIMode": "gdb"
  },
  "cmake.generator": "Ninja",
  "cmake.installPrefix": "${workspaceFolder}/Install",
  "cmake.loggingLevel": "info",
  "cmake.statusbar.advanced": {
    "kit": {
      "visibility": "default"
    },
  },
  //
  "diffEditor.ignoreTrimWhitespace": false,
  //
  "debug.console.fontSize": 12,
  //
Enter fullscreen mode Exit fullscreen mode

and so on. Such a formatting can be easily automated, indeed, I just don't change settings too often to