question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Set extensionKind in package.json to support Remote Development

See original GitHub issue

Hi, 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:closed
  • Created 4 years ago
  • Comments:22 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
mjbvzcommented, May 7, 2019

@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

0reactions
IgnisDacommented, May 14, 2021

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):

{
// other stuff
   "remoteEnv": {
       "WAKATIME_API_KEY": "${localEnv:WAKATIME_API_KEY}"
   }
}

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Set extensionKind in package.json to support Remote ...
Hi, I'm on the VS Code team. We recently released support for Remote Development and I noticed that your may extension need a...
Read more >
Supporting Remote Development and GitHub Codespaces
Using remote.extensionKind allows you to quickly test published versions of extensions without having to modify their package.json and rebuild them.
Read more >
Peacock for Visual Studio Code
Peacock integrates with the Remote Development features of VS Code. ... Remote Development by adding "extensionKind": "ui" in the extension's package.json .
Read more >
NPM scripts not shown in Explorer sidebar. How to shwo them ...
The NPM SCRIPTS menu still appears when I close the package.json file. ... or may happen if you're installing/removing extensions from a remote...
Read more >
Changelog - Peacock
This is easily fixed by the user using a Peacock command to set ... As of VS Code 1.40 the extensionKind attribute in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found