Search code examples
windowsvisual-studio-codevscode-extensions

How to install extension from "vscode:extension/<extension name>"


I'm new to VS code and try to install some extensions.

In the following page, there is a button called "Install the Extension Pack for Java", and the link of "Install the Extension Pack for Java" is "vscode:extension/vscjava.vscode-java-pack":

https://code.visualstudio.com/docs/languages/java

How to install VS code extension with string "vscode:extension/vscjava.vscode-java-pack"?

I tried to copy "vscode:extension/vscjava.vscode-java-pack" and paste it into the search bar on top of the VS code window but it didn't run the install. And I also tried to paste it into the search box inside the Extension tab on left of the VS code window and it will not find out the extension.

I need to manually copy just the name "vscjava.vscode-java-pack" into the search box inside the Extension tab, and then click the "Install" from the extension web page on the right side to install this extension.

Is it a VS code command or just a simple string?


Solution

  • The string vscode:extension/vscjava.vscode-java-pack that you see in the link is not something you directly copy and paste into the VS Code search bar. It's a special link that, when clicked, will trigger the installation of the corresponding extension via special means like "Universal Links" in iOS, or this Windows Registry method, or any other method relevant to your target platform.

    What's likely happening is that VS Code registers necessary URL associations for anything that starts with "vscode:extension" and the browser sends the relevant call to VS Code when required.

    As for how to install the extension using the string vscode:extension/vscjava.vscode-java-pack, you can copy everything after the / token and search for that via the extensions browser in VS Code, so in your case it would be vscjava.vscode-java-pack.

    So it is not a VS Code command, but rather a combination of a unique identifier for the browser to recognize it as something belonging to VS Code (vscode:extension), and a simple string (vscjava.vscode-java-pack) which identifies the extension.