Skip to content
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

Extension activates invariant of the workspace #882

Closed
ProphetLamb opened this issue Mar 1, 2022 · 3 comments
Closed

Extension activates invariant of the workspace #882

ProphetLamb opened this issue Mar 1, 2022 · 3 comments
Labels

Comments

@ProphetLamb
Copy link
Contributor

ProphetLamb commented Mar 1, 2022

Excerpt from Dependency update is workspace agnostic:

  1. Open VSCode
    1. without a workspace, or
    2. with any non C# workspace.

We expect the C# extension to do nothing.

But what actually happens is:

VSCode output window for "C#" opens.
Dependency check and subsequent installation is performed

When working with a rust or js project, this is but a mildly infuriating annoyance, on a Windows machine with dotnet installed.

Installing C# dependencies...
Platform: win32, x86_64

Finished

The real problem arises when working with a Linux system where no dotnet is installed. The C# extension attempts to start, using up an unreasonable amount of CPU time and displaying a very much annoying and inappropriate error message. That it failed to locate the dotnet sdk.

The C# extension is not required in an empty, rust, tex, js or any other non C# workspace and thus should - according to the VSCode extension guidelines not install unrelated software, or even initialize anything at all. That should be delayed until the extension is actually required.

This issue is caused by Roslynator depending on ms-dotnettools.csharp. As can be seen in the extension host log.

[...]
[2022-02-28 10:40:08.560] [exthost] [info] ExtensionService#_doActivateExtension ms-vscode.test-adapter-converter, startup: true, activationEvent: '*', root cause: hbenl.vscode-test-explorer
[2022-02-28 10:40:08.563] [exthost] [info] ExtensionService#_doActivateExtension ms-dotnettools.csharp, startup: true, activationEvent: '*', root cause: josefpihrt-vscode.roslynator 

[...]

[2022-02-28 10:40:10.917] [exthost] [info] ExtensionService#_doActivateExtension hbenl.vscode-test-explorer, startup: true, activationEvent: '*', root cause: Swellaby.vscode-rust-test-adapter
[2022-02-28 10:40:10.953] [exthost] [info] ExtensionService#_doActivateExtension josefpihrt-vscode.roslynator, startup: true, activationEvent: '*'

To fix this adopt the activation events of the C# extension.

https://github.com/OmniSharp/omnisharp-vscode/blob/65c110a03b0ca2f97a897d71996e46f30f5235bb/package.json#L544-L564

https://github.com/JosefPihrt/Roslynator/blob/942ca0797fd75b69ee520ef3f655f25a1712b36e/src/VisualStudioCode/package/package.json#L37-L39

ProphetLamb added a commit to ProphetLamb-Organistion/Roslynator that referenced this issue Mar 1, 2022
@ProphetLamb
Copy link
Contributor Author

@josefpihrt Any chance I could get this reviewed and merged?

@josefpihrt
Copy link
Collaborator

Hi,

Yes, sure. I'll take a look. Thanks.

@josefpihrt
Copy link
Collaborator

fixed with #883

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants