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

Open
egamma opened this Issue Feb 25, 2016 · 31 comments

Comments

Projects
None yet
@egamma
Copy link
Contributor

egamma commented Feb 25, 2016

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

@nicolastakashi

This comment has been minimized.

Copy link

nicolastakashi commented Feb 26, 2016

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.

@filipw

This comment has been minimized.

Copy link
Member

filipw commented Mar 23, 2016

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!

cc @david-driscoll

@dmccaffery

This comment has been minimized.

Copy link
Member

dmccaffery commented Mar 23, 2016

... 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. 👍

@alexsandro-xpt

This comment has been minimized.

Copy link

alexsandro-xpt commented Mar 30, 2016

+1

1 similar comment
@agoretsky

This comment has been minimized.

Copy link

agoretsky commented Jun 29, 2016

+1

@DustinCampbell DustinCampbell added this to the future milestone Jul 21, 2016

@savpek

This comment has been minimized.

Copy link

savpek commented Nov 10, 2016

+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.

@dmccaffery

This comment has been minimized.

Copy link
Member

dmccaffery commented Nov 10, 2016

I assume this will be revisited again once the Roslyn Project System is fully baked for .NET Core 1.1

@filipw

This comment has been minimized.

Copy link
Member

filipw commented Jun 2, 2017

To me, this issue has 3 aspects:

  • global refactorings - equivalent to installing Roslyn refactoring(s) VSIX into Visual Studio
  • global analyzers/code fixes - equivalent to installing Roslyn analyzer(s)/code fixe(s) VSIX into Visual Studio
  • project scoped analyzers/code fixes - equivalent to installing Roslyn analyzer(s)/code fixe(s) Nuget into a project

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.

@RikkiGibson

This comment has been minimized.

Copy link

RikkiGibson commented Aug 26, 2017

Is anyone working on this?

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

DustinCampbell commented Aug 28, 2017

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.

@savpek

This comment has been minimized.

Copy link

savpek commented Sep 13, 2017

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.

@DustinCampbell

This comment has been minimized.

Copy link
Collaborator

DustinCampbell commented Sep 13, 2017

@savpek: You're definitely welcome to give it a shot over in the omnisharp-roslyn repo.

@dmccaffery

This comment has been minimized.

Copy link
Member

dmccaffery commented Nov 17, 2017

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.

@savpek

This comment has been minimized.

Copy link

savpek commented Nov 25, 2017

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 OnAnalyzerReferenceAdded are required if analyzers are added project basis and not globally. Am i right on this? So i abandoned this way at this point.

After that i started digging how custom code actions are loaded currently, i found that ExternalFeaturesHostServicesProvider loads them and it actually loads analyzers too. However i have no idea is this assembly load enough. Does further actions required like OnAnalyzerReferenceAdded on workspace?

Code actions are loaded and surfaced from BaseCodeActionService by reflection. I currently think that if can implement same kind of implementation to CodeCheckService they should be surfaced to editors as expexted? However at this point rabbit hole begins and need to figure out what apis i need to use / manually expose from roslyn to make this work. Anyone can throw directions for this?

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? 😄

@peabnuts123

This comment has been minimized.

Copy link

peabnuts123 commented Dec 11, 2017

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 👍

@david-driscoll

This comment has been minimized.

Copy link
Member

david-driscoll commented Dec 11, 2017

@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.

@savpek

This comment has been minimized.

Copy link

savpek commented Dec 23, 2017

Happy holidays, i managed to get it working
image

However its early prototype with dirty hacks like statics on state management, i refactor it and create PR after some refactoring. Maybe even during 2017!

Its very likely that this version doesn't support yet things like loading analyzers from projects directly, currently it loads analyzers from ExternalFeaturesHostServicesProvider.

@savpek

This comment has been minimized.

Copy link

savpek commented Dec 26, 2017

@savpek savpek referenced this issue Jan 5, 2018

Open

[WIP] Roslyn analyzers and code fixes #1076

5 of 5 tasks complete
@ruant

This comment has been minimized.

Copy link

ruant commented Mar 21, 2018

Any progress on this lately?
Are we waiting on your work @savpek ? 👍

@timjroberts-inty

This comment has been minimized.

Copy link

timjroberts-inty commented Apr 25, 2018

Seriously, when can we have this?

@lust666

This comment has been minimized.

Copy link

lust666 commented Jul 14, 2018

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.

@savpek

This comment has been minimized.

Copy link

savpek commented Aug 5, 2018

Pull request is now waiting for review (finally), heres few gifs about current behavior.

Analyzers / codefixes (with roslynator project):
analyzers-codefixes

Rulesets:
rulesets

@peabnuts123

This comment has been minimized.

Copy link

peabnuts123 commented Aug 6, 2018

LOVE - YOUR - WORK !

@dmccaffery

This comment has been minimized.

Copy link
Member

dmccaffery commented Aug 8, 2018

@savpek <3 <3 <3 <3

@duki994

This comment has been minimized.

Copy link

duki994 commented Aug 10, 2018

@savpek

Superb work. This is going to boost editor (especially VSCode) capabilities from advanced editor / light IDE
closer to heavy IDE's without performance degradation.

A medal for ya! 👍

@lust666

This comment has been minimized.

Copy link

lust666 commented Sep 4, 2018

@savpek and where's the pull request?

@amis92

This comment has been minimized.

Copy link

amis92 commented Sep 4, 2018

The link is in a comment just a little above: #43 (comment)

@pgolebiowski

This comment has been minimized.

Copy link

pgolebiowski commented Sep 21, 2018

@savpek How far is this from being added, sir?

@loligans

This comment has been minimized.

Copy link

loligans commented Oct 12, 2018

@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...

@savpek

This comment has been minimized.

Copy link

savpek commented Oct 12, 2018

One way is:

  • Clone my current fork https://github.com/savpek/omnisharp-roslyn
  • Checkout branch roslyn-analyzers
  • dotnet build on branch
  • Add configuration (modify path to where fork clone was built) "omnisharp.path": "C:\\Github\\omnisharp-roslyn\\bin\\Debug\\OmniSharp.Stdio.Driver\\net461\\Omnisharp.exe", to your workspace or user configuration in vscode.
  • Reload vscode.

You can also add new remote to omnisharp-roslyn repo that points to my fork and checkout from there.

@ccjx

This comment has been minimized.

Copy link

ccjx commented Dec 10, 2018

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment