-
Notifications
You must be signed in to change notification settings - Fork 32.6k
Extension Optional Dependency #6384
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
At some place the language id, it's human readable name as well as the file suffices need to be defined. Without it, you would not be able to get an editor in C# mode and the user would not be able to see your snippets. At some point we discussed here if we should keep the language definition with VS code. @egamma didn't like that idea, but I think it has some merits. Our installer doesn't yet install extension dependencies. I think that's a reasonable request, please file a request. |
I'm in the same position as @TobiahZ, I would love to mark a dependency as optional or at least have means to handle the error printed in the console (IMHO it should be a warning anyway!)
In the case of C#, which has an official extension handled by Microsoft, I would agree with the above (even when there might be third-party alternatives.) In my case the language is Haskell, which currently has three packages that add syntax highlighting. I want to leave the choice to the user, each has their own preference. |
IMO what we need here is more like optional dependency activation events, activate some features only when a specific extension is installed and activated. In the example described above, marking @sandy081 may I have your comments on this? We run into this issue where GH PR has a soft dependency on other extensions microsoft/vscode-pull-request-github#1050 but right now there is no sound solution. |
@rebornix Let's sync in our next 1:1 on the exact problem you're running into. |
We have exactly the same request. Considering the following scenario: The extension A has several features which some of the features depends on extension B. As an extension author, I can do:
|
@jdneo The |
Thank you @alexdima. In that model, it's A's responsibility to determine whether to register some commands. It would be great if A could be notified that B is activated. Considering this: We have an extension One problem we are facing is that, if the user is in a non-Java project and triggers the command To make this command get executed as soon as it gets triggered, and not start the Java language server unnecessarily, we need to remove the hard dependency here. let the extension only register the |
There's a similar need from the Python folks, but their scenario sounds more like a plugin system than optional dependencies (it's the reverse of the original issue). In their case, the Python extension provides general Python functionality (e.g. REPL and run file in terminal) while various Python language servers can be used. The ask is to allow for a default language server to be installed along with the Python extension but, because it's an optional/plugin to the Python extension, it can be uninstalled and replaced by a different language server extension. This is similar in functionality to an extension pack dependency, but that's not the right solution given the UX in VS Code and the categorization in the Marketplace. |
Extensions that have functionality and Extensions that have no functionality and only Scenarios: When the extension is side loaded, |
I need something similar mentioned in the comments but not in the original issue... I need either extension A or B installed. Both satisfy. Here's what I'm doing for that: export async function activate(context: vscode.ExtensionContext) {
const powershellExtension = vscode.extensions.getExtension("ms-vscode.PowerShell-Preview") || vscode.extensions.getExtension("ms-vscode.PowerShell");
if(!powershellExtension) {
await vscode.window.showErrorMessage('Please install either the PowerShell or PowerShell Preview extension and then reload the window to use the Pester Test Explorer.');
const activatedEvent = vscode.extensions.onDidChange(() => {
if (vscode.extensions.getExtension('ms-vscode.PowerShell') || vscode.extensions.getExtension('ms-vscode.PowerShell-Preview')) {
activate(context);
activatedEvent.dispose();
}
});
return;
}
if (!powershellExtension.isActive) {
await powershellExtension.activate();
}
// ...
} Though there is currently an issue about |
@fiveisprime Created a separate issue to track python extension use case - #118442 |
It seems the built-in extension |
I'd prefer the user be prompted to install or is recommended the extensions (like workspace extension recommendations) rather than it being auto-installed and optionally uninstalled afterward. EDIT: redhat provides a Node package to similar effect |
I'd prefer the user was prompted or recommended the extension rather than it being auto-installed and optionally uninstalled. See microsoft/vscode#6384 (comment) Perhaps this should instead be done via a dedicated extension pack instead of...this way.
I'd prefer the user was prompted or recommended the extension rather than it being auto-installed and optionally uninstalled. See microsoft/vscode#6384 (comment) Perhaps this should instead be done via a dedicated extension pack instead of...this way.
I'd prefer the user was prompted or recommended the extension rather than it being auto-installed and optionally uninstalled. See microsoft/vscode#6384 (comment) Perhaps this should instead be done via a dedicated extension pack instead of...this way.
I'd prefer the user was prompted or recommended the extension rather than it being auto-installed and optionally uninstalled. See microsoft/vscode#6384 (comment) Perhaps this should instead be done via a dedicated extension pack instead of...this way.
I'd prefer the user was prompted or recommended the extension rather than it being auto-installed and optionally uninstalled. See microsoft/vscode#6384 (comment) Perhaps this should instead be done via a dedicated extension pack instead of...this way.
I'd prefer the user was prompted or recommended the extension rather than it being auto-installed and optionally uninstalled. See microsoft/vscode#6384 (comment) Perhaps this should instead be done via a dedicated extension pack instead of...this way.
To recap, any type of extension may declare an optional dependency via the |
Uh oh!
There was an error while loading. Please reload this page.
I am writing an extension that includes snippets designed for developers using C, C++, and/or C#.
However, if I add a snippets for the language "csharp" and the C# extension/support is not installed (which by default, it is not), the extension makes an error:
This leaves me with two options, as I understand it:
Ideally, I'd love to have a feature for optional dependency. If "csharp" is installed, use these snippets.
I don't like the idea of having to force people to install C# if they aren't planning on using it, just because I'd like to include optional C# snippets.
(Related follow up question: If I did include csharp as a dependency, would it automatically install csharp or does it give the user an error and/or prompt first?)
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: