-
Notifications
You must be signed in to change notification settings - Fork 671
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
Support for extensions containing Roslyn features (analyzers, refactorings) #6790
Comments
@josefpihrt we should already support the scenario where the analyzer or refactoring is shipped as nuget package that you reference on your project. This is generally the way we would recommend consuming analyzers and refactorings. For example, this is how an analyzer package should be authored - https://learn.microsoft.com/en-us/nuget/guides/analyzers-conventions We do not currently support loading analyzers manually into the server (how O# settings worked). I'll leave this issue open to track that request. |
Thanks for answer. AnalyzersI agree that analyzers should be consumed through nuget packages. RefactoringsI didn't know that refactorings could be distributed as a part of nuget packages. The documentation page you shared says nothing about refactorings. Could you please point me to docs that describe how to configure nuget so it can contain refactorings? Or is it just about including dll with refactorings? I strongly believe that whereas analyzers are "project-bound", refactorings are "IDE-bound" so it makes sense to distribute them as a part of IDE extension (unless it's some specialized set of refactorings for some specific library). Code FixesBy the way I also created a set of code fixes for compiler diagnostics (CSxxxx) and in this case it makes no sense to distribute them as a part of nuget package. Only reasonable way is to distributes them as a part of an extension. |
It was implemented as part of this PR - dotnet/roslyn#35685
Hmm, mind expanding on that? To me it seems reasonable to include them on the project. |
We have the project templates, but not sure what the question here is. Everything should just work for refactorings the same way they do for code fixes. |
We on the Roslyn team ship code fixes for CS* diagnostics via NuGet packages, and third parties do the same. I would consider it a normal practice and you install the fixes relevant to your solution into your solution using package references. |
The question is not whether it should be possible to distribute refactorings as a part of nuget. The question is whether it should be possible to distribute them as a part of IDE extension. ExampleYou have a set of general refactorings that are not specific to any particular project and you have a set of general code fixes for CS diagnostic that are not specific to any particular project. Why to publish them as nuget package? Use case 1A developer works on a PR for some open source project. This open source project do not reference refactoring/fixes nuget so these refactoring/fixes are not available and a developer cannot use them. Use case 2A developer works in a company on some project. Company makes decision (for some reason) not to reference refactoring/fixes nuget so these refactoring/fixes are not available and a developer cannot use them. In both use cases, if refactorings and/or code fixes would be available as a part of some IDE extension, a developer could use them and would be satisfied. |
@josefpihrt You could probably create an MSBuild targets file in one of the extension locations that adds a reference to the refactorings DLL to all projects that get loaded. It's not a direct solution to this issue but could be a viable workaround. |
Why to make these workarounds when it could be supported by VS Code just as it's supported by Visual Studio? What is the argument to prefer distributing common refactorings/fixes as nuget? |
It's less about whether it should/shouldn't work and more about prioritization and how long it would take to deliver the feature. I suggested a workaround for the interim period. |
@sharwell Could you please elaborate more on this idea, provide some code sample or a link to a docs page? |
unfortunately this is not possible with Unity:
|
Context
I have an extension that contains custom Roslyn analyzers, refactorings and code fixes. I use OmniSharp settings to configure it:
OmniSharp is now not used by default, so now I have to:
dotnet.server.useOmnisharp
totrue
Question
Is it possible to configure custom Roslyn analyzers and refactorings without using OmniSharp?
Versions used
VS Code:
1.85.1
C# extension:
2.14.8
C# Dev Kit:
1.2.5
The text was updated successfully, but these errors were encountered: