I'm building a VSCode appliance in docker with multiple pre-installed extensions.
By default the extensions get enabled when a session is created including a settings file in $HOME/.local/share/code-server/User/state/.json.
When I disable an extension in the UI the extension gets an entry in this config file meaning that it is disabled.
Is there a way to disable an extension before a session is created?
I was looking at the $HOME/.local/share/code-server/User/settings.json file but in the documentation I can't see an attribute for that.
thanks in advance
There was an option to turn off extension for the specific project.
Unfortunately, this option is not longer available:
Feature Link(used to work): Ability to enable extensions only on specific workspaces #15611
Related
I created a vscode extension for the first time..I used LSP(language server protocol) and having both client and server bundled as one extension.
The extension has highlighting and autocomplete features for a custom file type. I packaged it using vsce I got a VSIX file. I installed the extension in my vscode using the .vsix file.
The extension works when i am working on local files.
However, i connected to a remote VM using the ms-vscode-remote.remote-ssh extension such that I can view the remote files in vscode, but here my created extension is not working. I can't even see the file type i created.
Any help is appreciated. Is there some specific setting I need to put in my package.json
For your extension to properly work remotely, either installed on host or on the remote, you have to follow a few guidelines, and yes, there are some settings that you may take care of on package.json.
The first and more complete source of information is Supporting Remote Development and GitHub Codespaces API documentation. It describes the architecture, settings, how to debug, common problems and so on. There is also the Extension Host page, where it describes the Preferred extension location topic, which tells you how to configure your extension to work on the correct location.
Based on your description (a LSP related extension) I understand your extension should be a Workspace Extension. This means that you should have this on your package.json:
"extensionKind": [
"workspace"
]
The Commons Problem section describes how you can evaluate and fix Incorrect execution location. To debug using SSH follow these instructions.
Also, remember that while working with remotes, you rely on local paths anymore. Instead you must always deal with Uri, whenever possible.
I guess after reviewing your settings, based on the docs related above, you should be able to detect what is happening on your extension and fix it. Give debug a try, it will be much easier to detect issues than installing the vsix and look for erros in Console.
Hope this helps
The situation is, I want to share my settings of vscode.dev to others. That could include
extensions installed
tabs opened (not files, but some extension related tabs such as panels or previews)
So the person who clicked on the shared link can go to vscode.dev, but with my configurations.
Try to use Settings Sync, its the easiest way: Settings Sync
You could try to create a settings.json too, and share that file with others.
I think the only solutions you have here is to use either GitHub Codespaces (Dev Containers) or store config in repository.
Basically you will not have a link for preconfigured vscode.dev. The idea is to have all required configuration in devcontainer.json file committed it to repository. So whenever the repository is opened VSCode uses the file to configure environment.
Also you can change you settings in Workspace and right click on extensions and click "add to workspace recommendations". That will create .vscode/extensions.json, .vscode/settings.json and commit .vscode folder into repository.
TLDR: commit VSCode configuration files into repository and open repository in vscode.dev
Look into Profiles, which can be enabled in your Settings (currently experimental but will be made generally available in vscode v1.75 due out very soon.
Current setting in Stable: Workbench > Experimental > Settings Profiles: Enabled
There is no setting for Profiles in the Insiders Build, it is just enabled by default. I assume when v1.75 Stable comes out that will also be the case.
See v1.75 Release Notes: Profiles:
We are happy to announce that the Profiles feature is now generally
available in VS Code. A Profile can include extensions, settings,
keyboard shortcuts, UI state, tasks, and user snippets. You can
customize VS Code for different development scenarios like data
science, documentation writing or for multiple programming languages
like Python or Java. If you have different VS Code setups based on
workflow like Work or Demo, you could also save those as different
profiles. You can open multiple workspaces (folders) with different
profiles applied simultaneously.
{image omitted]
You can also export and import profiles to share them with your
colleagues, friends or students to help them get started with VS Code.
The following video demonstrates how to export a profile using a
GitHub gist in order to share it with someone. Users that receive the
profile link can preview the shared profile in VS Code for the Web and
import it to their local VS Code instance.
There is a nice mp4 demonstration in the link, but it appears SO would take that format.
You can export a Profile to a Github Gist so that it can be imported by someone else or to a local file you can share (or yourself to a new maching, etc.) - my demo shows all the settings, UI State and extensions it can include.
More info on Profiles at v1.69 Release Notes: Settings Profiles
My settings.json on Linux machine contains setting lines for cortex-debug extension:
"cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi/bin/",
"cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V754b/JLinkGDBServerCLExe",
The same file on Windows machine should refer to a different file name JLinkGDBServerCL.exe (yes, I understand such dumb naming is guilty of Segger, but...)
When settings sync turned on, I continuously get the wrong config on one (Windows or Linux) machine.
Is it possible to set a platform-specific section in settings.json to define a different key for an extension?
One way is to use VSCode's features to define machine specific settings or prevent certain settings from being synced,
https://code.visualstudio.com/docs/editor/settings-sync#_configuring-synced-data
Ok, found another solution for my problem.
At first, install platform-settings from marketplace:
https://marketplace.visualstudio.com/items?itemName=runarsf.platform-settings
Next, move required settings to a new place:
"platformSettings.platforms": {
"win32": {
"cortex-debug.armToolchainPath": "C:/Program Files (x86)/GNUARM/bin/",
"cortex-debug.JLinkGDBServerPath": "JLinkGDBServerCL.Exe",
},
"linux": {
"cortex-debug.armToolchainPath": "/opt/gcc-arm-none-eabi/bin/",
"cortex-debug.JLinkGDBServerPath": "/opt/SEGGER/JLink_V754b/JLinkGDBServerCLExe"
}
}
But variant with sync prevention looks pretty good.
For my project, I have customized my launch.json file.
How can I save my own customized launch configuration as a template? Just like C++ (GDB/LLDB) template
So that I can re-use it easily every time I open a new folder(project).
I don't want to add it under global launch configuration. Adding it there would start showing up my launch configurations even for other kind of projects where this launch configuration is inappropriate.
I wanted to have the same behavior that is achieved for C++ (GDB/LLDB) template. How is that achieved?
Edit - I have raised an enhancement request VSCode GitHub-
https://github.com/microsoft/vscode/issues/109234
They are part of the debugger configuration in the language extension.
Way too much trouble to create an extension for this.
Just create a snippet for a .json file and use it while editing the .vscode/launch.json
I have the Home Assistant extension installed in VSCode but also want to use the ESPHome extension, both of these are for YAML files.
I need a way of telling VSCode which extension to use.
I wonder if it is possible to configure VSCode to use a specific extension in a specified folder tree or else to put something in the YAML file itself so the extension can recognise that it should be effective for that YAML file.
If I understand your question correct, you want to select installed extensions for in your case; YAML files.
VSCode :
Home Assistant extension
ESPHome extension
Via 'exentension' > 'dis/enabled [workspace]', you can arrange it.
Workspace recommended extensions#
A good set of extensions can make working with a particular workspace or programming language more productive and you'd often like to share this list with your team or colleagues. You can create a recommended list of extensions for a workspace with the Extensions: Configure Recommended Extensions (Workspace) command.
Extra information SEE https://github.com/Microsoft/vscode/issues/19792
This option was moved into Command pallette (F1)