Set extensionKind in package.json to support Remote Development
See original GitHub issueHi, I’m on the VS Code team. We recently released support for Remote Development and I noticed that your may extension need a small change to ensure users have a good experience when using it remote workspaces.
What is the issue?
To make remote development as transparent as possible to users, VS Code distinguishes two classes of extensions:
-
UI Extensions: These extensions make contributions to the VS Code user interface and are always run on the user’s local machine. UI Extensions cannot directly access files in the workspace, or run scripts/tools installed in that workspace or on the machine. Example UI Extensions include: themes, snippets, language grammars, and keymaps.
-
Workspace Extensions: These extensions are run on the same machine as where the workspace is located. When in a local workspace, Workspace Extensions are run on the local machine. When in a remote workspace, Workspace Extensions are run on the remote machine. Workspace Extensions can access files in the workspace to provide rich, multi-file language services, debugger support, or perform complex operations on multiple files in workspace (either themselves or by invoking scripts/tools).
You can find more details about this architecture here.
VS Code currently infers that your extension is a Workspace Extension. This means that users who have your extension installed must also install it to the remote in order to use it in remote workspaces. I believe that your extension should probably be a UI extension instead. That way your extension will always be enabled for users who install it, even if they open a remote workspace.
How do I fix this?
To tell VS Code that your extension is a UI extension, just add "extensionKind": "ui"
to your extension’s package.json.
UI Extensions always run on the user’s local machine, even when they open a remote workspace.
I’ll submit a PR that does this. Please let me know if you have any questions or concerns about the issue. We’ve also put together a guide to help you test your extension in remote workspaces
PS: As a temporary workaround for a few popular extensions, we’ve automatically added your extension to an internal whitelist so that is always treated as a UI extension
Issue Analytics
- State:
- Created 4 years ago
- Comments:22 (13 by maintainers)
Top GitHub Comments
@alanhamlett It depends on which files you are accessing and how you are doing this. If you are reading files from the workspace (and not using the vscode apis to do this) then you must be a workspace extension
I’ll remove your extension from the whitelist so its entirely up to you to decide where it should be run
What is the current status of this issue? I have wakatime added to “always installed extensions” in my VSCode settings. Every time I rebuild the container (which is a lot), I have to re-enter the API key.
One possible solution as (partly) suggested in #130, would be allow Wakatime to read the API key as an environment variable and somehow pass the wakatime API key to the container. For example (in
.devcontainer/devcontainer.json
):Then wakatime can first check if
WAKATIME_API_KEY
environment variable exists and try to authenticate with it. If it does, then all’s well and it can continue to initializing, otherwise it will prompt the user for the API key as per normal. Here is where I found the${localEnv:WAKATIME_API_KEY}
syntax.This has the additional benefit of not causing any problems for those people who do not use wakatime. For them the
WAKATIME_API_KEY
environment variable will simply not exist on the host machine. So this file can checked into version control without any potential of breaking other’s build environments.I think we should keep it up to the users to ensure that the
WAKATIME_API_KEY
environment variable exists on the host systems for this to work correctly.@alanhamlett What do you think about this? I can try making a PR for this too.