-
Notifications
You must be signed in to change notification settings - Fork 679
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 roslyn analyzers and code fixes #43
Comments
Good idea ! This type of feature will help us during the refactoring and code fixes and many other things we need to use visual studio because it is much easier. |
great idea, we demoed this in Dallas at .NET Unboxed last year and it seemed to be a big hit back then.. now that omnisharp has moved to .NET CLI we can restart the efforts in that direction! |
... if you did this, and the dotnet-cli actually stabilized, I could stop using Visual Studio 2015 Entercrap Edition with Update 1. The name itself sounds non-productive. 👍 |
+1 |
1 similar comment
+1 |
+1, currently biggest reason to stay on Visual sStudio is lack of refactoring and analyzer tools in omnisharp/vscode combo. This opens good way to community participate because creating analyzers and refactoring tools is easy and well documented feature of Roslyn. However if i try create new refactoring tool to Omnisharp core i don't where to start. Another thing is that personally i prefer refactoring tooling and analyzers via plugins. Or bundle of plugins if set of them are good and usefull. As example Resharper has currently problem that it has like ten thousand refactoring/analytics bundled to it. Its very good tool indeed but because it contains all of them as default it slows it down greatly. Another problem is that they are all available at same time and realisticly one developer usually uses more like dozen of them. |
I assume this will be revisited again once the Roslyn Project System is fully baked for .NET Core 1.1 |
To me, this issue has 3 aspects:
The first part of it was implemented recently into OmniSharp and can be used with C# for VS Code already, the latter two items are still pending. |
Is anyone working on this? |
It is on our backlog, but there isn't a large team working on this extension. If you're passionate about this feature, we would welcome your contribution. That said, it'll require public API changes in Roslyn that I have not had the time to work on yet. |
Is there possibility to prototype this feature without official public api with reflection from roslyn? I understood from dotnet/roslyn#19908 that current code fixes are surfaced same way without official api from roslyn. |
@savpek: You're definitely welcome to give it a shot over in the omnisharp-roslyn repo. |
Folks using vscode are now asking me for this. I might take a shot at it this weekend; depending on how painful it is — any tips on where to get started? I’m looking to go the reflection route pending updates to Roslyn to expose what’s needed in public api. |
I digged down in this issue littlebit this morning. First i tried to load analyzer assemblies based on two year old commit from OmniSharp/omnisharp-roslyn@6618a62, however after digging deeper down and after written own version of that implementation against current omnisharp-roslyn version i started think that those non used roslyn workspace commands After that i started digging how custom code actions are loaded currently, i found that Code actions are loaded and surfaced from Another question is that is there anywhere explained how core team develops omnisharp-roslyn in practical manner? I have to restart vscode between iterations because it locks down omnisharp dll:s and prevents building omnisharp after change. Is there some kind of shadow copy magic that can be easily used on this or how you guys archieve it? 😄 |
Am I understanding this correctly if I said this issue is what's holding back CodeAnalysis warnings from showing in vscode? I would really love to see that. Getting nice output in our console but would be extra good if it were integrated as part of the Problems panel and inline with the code as you wrote it, just like in Visual Studio 👍 |
@savpek I just mainly restart vscode or something similar. Sometimes just copy the current working version to another folder for use. It's a little clunky and could certainly be improved. |
For bigger C# projects, Visual Studio Code(with omnisharp) is not a good choice. It still misses a lot of features. My recommendation is to stick with Visual Studio IDE when you're on Windows or Mac or if you're on Linux there's Rider. I believe we will be able to replace heavyweight IDEs one day but it's not today. If you thumbed down this comment and you have something to share I'd be happy to know. This is just my opinion based on my experience. I just think it's much much faster to work with VS or Rider(at this time). I still use VS Code for other types of projects though. |
LOVE - YOUR - WORK ! |
@savpek <3 <3 <3 <3 |
Superb work. This is going to boost editor (especially VSCode) capabilities from advanced editor / light IDE A medal for ya! 👍 |
@savpek and where's the pull request? |
The link is in a comment just a little above: #43 (comment) |
@savpek How far is this from being added, sir? |
@savpek How can I test your work on my VSCode instance? I tried running the latest OmniSharp build, but that did not work for some reason... |
One way is:
You can also add new remote to omnisharp-roslyn repo that points to my fork and checkout from there. |
@savpek Thank you for doing this. I just wanted to drop a note of appreciation instead of something like "Seriously, when can we have this?" as I can see how hard you're following up in (OmniSharp/omnisharp-roslyn#1076) over the last 1 year. Hope you know that there are those of us who appreciate the work and understand that it takes time. |
Reviews pending now. I am waiting to continue with fadeout #2646 and fix all issues feature (microsoft/vscode#62110, https://github.com/dotnet/roslyn/blob/master/docs/analyzers/FixAllProvider.md) which can be made top of this 🙂 |
PR merged to omnisharp-roslyn master. You can now test this feature with "omnisharp.path": "latest" in vscode and set omnisharp.json with:
There will be shortcut in upcoming vscode-omnisharp release to enable this feature: #2836 If you want to test global analyzer/code action support with Roslynator project see OmniSharp/omnisharp-vim#451 (comment) with one trick which must be done before roslynator can be used as global extension. |
I'm attempting to test this in the latest version of the extension. Here's what I have done thus far:
Any ideas on something I may have missed for testing this? |
@ejohn20 haven't got time to test by myself but one thing comes in mind that
seems strange, can you replace it with
If analyzers are included in nuget packages at csproj they should be automatically activated in project scope. LocationPaths are for global analyzers/codefixes/refactorings like kind of vsix extensions in visual studio. However i don't see reason why package cannot be activated from nuget folder globally 🤔 there may be something strange going on. I will try check this closer this week if that doesn't do the trick. |
@savpek Thank you for the response. I tried modifying the file as suggested:
No warnings showing still. I did notice that VS Code updated as well as the OmniSharp extension appeared to update today. I'm not actually sure what version has this functionality in it?
Other interesting section of the log. Puma is located in the list. However, it also references the 2.6.1 version of CodeAnalysis. Puma is referencing CodeAnalysis 2.9. Could that be causing the problem?
Happy to provide the full trace log if that helps. |
@savpek Another interesting note. Opened VSCode this morning and it updated again. Now shows this version:
Still no warnings displaying in the code documents though. |
ejohn20 yes, the same problem, we have the custom ruleset package based on stylecop and no warnings/errors in the code. I did all the recommended actions from this thread. |
@ejohn20 moved issue to OmniSharp/omnisharp-roslyn#1472, i can repro it so just need to check with debugger whats wrong. |
@savpek Thank you for looking into this! I'll move conversations over to the new issue. |
I will close this as it was implemented in OmniSharp/omnisharp-roslyn#1076 and shipped in 1.19.0 of the VS Code extension. |
* Add basic test project * Run tests in CI * spacing * feedback
From @giggio on February 25, 2016 19:58
It would be nice to have Roslyn analyzers and code fixes working in VSCode.
Copied from original issue: microsoft/vscode#3468
The text was updated successfully, but these errors were encountered: