vscode-remote-release icon indicating copy to clipboard operation
vscode-remote-release copied to clipboard

Auto-install recommended extensions

Open arcanis opened this issue 3 years ago • 4 comments

I noticed my extensions defined in extensions.json were not installed when rebuilding the codespace. Instead, I have to duplicate them into devcontainer.json. It'd be nice if this list could be shared (perhaps by allowing "recommended" as a valid extension name in the devcontainer file, which would expand to all recommended extensions?).

arcanis avatar Feb 20 '22 15:02 arcanis

We are experiencing an issue where Codespaces gives the recommended pop-up for an extension that was already installed in devcontainer.json but is also listed in extensions.json- https://github.com/Azure/azure-dev/issues/951 Is the best practice to only be listing it in devcontainer.json? Or is it a bug in VS Code that it pops up the recommendeded dialog?

Screen Shot 2022-10-24 at 3 26 54 PM

pamelafox avatar Oct 24 '22 22:10 pamelafox

This would help, but https://code.visualstudio.com/docs/editor/extension-marketplace#_command-line-extension-management does not work inside an attached container:

# code --list-extensions '@recommended'
Unable to connect to VS Code server: Error in request.
Error: connect ENOENT /tmp/vscode-ipc-8742bf1b-bfdb-4227-8b77-a0852d28a62e.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'connect',
  address: '/tmp/vscode-ipc-8742bf1b-bfdb-4227-8b77-a0852d28a62e.sock'
}
# code --show-versions
Unable to connect to VS Code server: Error in request.
Error: connect ENOENT /tmp/vscode-ipc-8742bf1b-bfdb-4227-8b77-a0852d28a62e.sock
    at PipeConnectWrap.afterConnect [as oncomplete] (node:net:1157:16) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'connect',
  address: '/tmp/vscode-ipc-8742bf1b-bfdb-4227-8b77-a0852d28a62e.sock'
}

sanmai-NL avatar Nov 18 '22 16:11 sanmai-NL

Yes please. Also, after it's implemented, there needs to be some separation of recommended and required/autoinstalled extensions. E.g. let's say 80% of my recommendations should be autoinstalled, but 20% could be skipped because they're much more of a personal preference that I'd like to keep using inside dev containers.

Destroy666x avatar Oct 05 '23 16:10 Destroy666x

Proposal

.devcontainer/devcontainer.json: customizations.vscode DRY extensions properties

Context

  • .vscode/extensions.json: doesn't support a required[^3] or default[^2] property, only recommended[^1]
    • Semantically only recommendations[^1], not requirements[^3] nor default[^2] (defined by https://github.com/microsoft/vscode).
  • .devcontainer/devcontainer.json: customizations.vscode.extensions make vscode automatically install extensions in the dev container at build
    • Semantically only default[^2], not recommended[^1] nor required[^3], like any other container dev container parameters (defined by dev containers standards).

Problems

  • Cannot make vscode automatically install extensions in the dev container at dev container build from .vscode/extensions.json: recommendations[^1]
    • Against DRY principles

Solutions

  • Feature a .devcontainer/devcontainer.json: customizations.vscode.recommendedExtensions property (type: boolean, default: true (until a .vscode/extensions.json: required[^3] or default[^2] property is featured)) to make dev containers automatically install .vscode/extensions.json: recommendations[^1] at dev container build
  • Feature a .devcontainer/devcontainer.json: customizations.vscode.ignoredRecommendedExtensions property (type: list, default: []) to ignore recommended[^1] extensions individually (typically for non-default/non-required extensions).

Alternatives

  • Feature a .vscode/extensions.json: required[^3] and default[^2] property. (external proposal concerning https://github.com/microsoft/vscode)
    • Feature a .devcontainer/devcontainer.json: customizations.vscode.requiredExtensions property (type: boolean, default: true) to make dev containers automatically install .vscode/extensions.json: recommendations[^1] at dev container build
      • Feature a .devcontainer/devcontainer.json: customizations.vscode.ignoredRequiredExtensions property (type: list, default: []) to ignore required[^3] extensions individually
      • (See above) Make .devcontainer/devcontainer.json: customizations.vscode.recommendedExtensions default: false
    • Feature a .devcontainer/devcontainer.json: customizations.vscode.defaultExtensions property (type: boolean, default: true) to make dev containers automatically install .vscode/extensions.json: recommendations[^1] at dev container build
      • Feature a .devcontainer/devcontainer.json: customizations.vscode.ignoredDefaultExtensions property (type: list, default: []) to ignore default[^2] extensions individually

[^1]: Recommended as suggestion notifications [^2]: Installed at dev container build [^3]: Enforced at any time

Malix-Labs avatar Feb 13 '24 21:02 Malix-Labs