-
Notifications
You must be signed in to change notification settings - Fork 168
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 Refactorings #451
Comments
As far as I can see, this will be fully implemented in OmniSharp-roslyn, just providing more and smarter code actions, is that right? Will anything more actually be required in this repo? |
I haven't tested with omnisharp-vim, but it should not require any additional changes from this plugin once available. |
i looked stuff up here
I don't know if we are already doing this… |
The LSP spec? I don't think that's related to this is it? |
isn't Omnisharp-roslyn implementing that? or am i way off here? |
OmniSharp-roslyn does have an LSP implementation, but it's not complete yet. However OmniSharp-vim and OmniSharp-roslyn predate LSP and still communicate using their older protocols. For now I suggest we close this issue and wait for the OmniSharp-roslyn PR. Hopefully OmniSharp-vim will be able to use it without any further additions, and if work is needed we can create issues around that at the time. |
Can someone test omnisharp-vim with omnisharp-roslyn from https://ci.appveyor.com/project/david-driscoll/omnisharp-roslyn/builds/22739985/artifacts it could be really helpfull 🙂 |
@sevpak I can tomorrow. Any OS? Anything in particular you want tested? |
I think any os will do. I am interested about basics like is it working as expected, and if not I can try to fix it since this feature should not make any API changes to omnisharp-roslyn. |
I will look into this as well on Win10x64 with gvim 8.1 |
mh. just replaced my Installation of omnisharp-roslyn with the new http-build linked above. C:\USERS\B\.OMNISHARP Thats my omnisharp.json |
You need to add following flag to omnisharp json:
Its mentioned in thread but there's lots of message after that one 🙂 |
thanks for pointing that out. i did sort of remember that, but was unable to find it :-) my omnisharp.json now Looks like:
But it Fails when trying to load Roslynator.
|
mh. that now disappeared for what over reason… but i do still not see the additional stuff from roslynator |
@savpek It works very well for me out of the box, with some additional code actions and diagnostics available. I tried Roslynator as @Confuset did, and had the same error (well, the english version :D ) . I suspect it's a roslynator error rather than omnisharp but I don't know. In my case I built roslynator myself because the download button in the VS marketplace appears to be broken. |
@nickspoons did that error message eventually disappear? |
just had an idea. roslynator can also be installed into the Project/solution using nuget. i will tried that this evening |
I use roslynator daily basis but i use it via nuget in csproj. Haven't tested global analyzers with roslynator in a while. Very first version of analysis service only supported global analysers and i think i used it with roslynator at some point. But i will test it during this weekend. That error looks like theres assembly missing or cannot be loaded from roslynator dll:s. Even though my deutsch is bit rusty 😄 |
a second issue i discovered is that some refactorings are listed twice. once in english and the second one in german… |
@Confuset, you should be able to resolve the issue of Vim not switching buffers with |
@Confuset it seems you must remove .visualstudio. files from roslynator package before it can be used as global extension. Something there tries to visual studio specific stuff that omnisharp doesn't have loaded. After i removed them omnisharp-roslyn starts as expected and roslynator (RCSxxxx) analysis is enabled. Tested on vscode though but i don't think theres difference between vim and vscode in this matter since everything releated is done at omnisharp-roslyn side. |
@savpek yes that appears to be correct. I now have just these in my roslynator directory and it works:
|
@savpek i followed the instructions given by https://github.com/JosefPihrt/Roslynator/blob/master/docs/RoslynatorForVisualStudioCode.md so i think something else was wrong, but maybe i confuset something ;-) |
@axvr yes. thats helps. but now i have the issue that i have to switch buffers to that extracted file. then i have to first |
@Confuset I just tried again with roslynator. The Download is working again from the VisualStudio marketplace so I followed the instructions you linked exactly and it works for me. One thing to note is that one of the dll names is wrong - the instructions say |
@Confuset the problems regarding new buffers and invalid cursor position are not related to this issue. The existing OmniSharp-roslyn code actions already had functionality for refactoring code out to a new file, and everything you've described (having to switch to the new file (you can do it with It would be good to get these smoothed out though, I've created a separate issue: #452 |
Having said that ... I would have expected the new file to be recognised by OmniSharp-roslyn immediately. @savpek do you know how the internals work when a code action generates code for a new file? Does OmniSharp-roslyn automatically reference the new code? In the vim client we write the generated code to the new file buffer but don't automatically save it. But we currently have to do that manually to trigger a |
who should actually add that new file to the |
@Confuset do you mean the .csproj file? I believe that that is a different issue. AFAIK OmniSharp-roslyn never adds files to .csproj files. The old OmniSharp-server (which OmniSharp-roslyn replaced) used to do it which was cool. In more recent .csproj structures the individual .cs files don't need to be listed and I suspect OmniSharp-roslyn will never implement adding files to .csproj for this reason. Or did I misunderstand you? |
@nickspoons That was exactly what i was asking about. so this is separate issue and unrelated to omnisharp-roslyn. i will think about it and Maybe create an issue for that, because only .net core Project files do not Need to include the files in its .csprof files. |
@Confuset the new csproj style is not just for .NET Core - it can also be used for .NET Framework projects - see the OmniSharp-roslyn projects. There is also an existing issue to add this functionality, OmniSharp/omnisharp-roslyn#645, but it doesn't seem to have had much attention. You could bump it and see if the current devs have any more information? |
mh. but since omnisharp-vim is the one who is actually creating that file, as far as i understand, how would the interaction between vim and roslyn Workout? So would for example omnisharp-roslyn have a function for adding files and omnisharp-vim call that? Otherwise roslyn would Need to know that there is a new file that it has to pick it up… |
Actually OmniSharp-roslyn creates the new file, then OmniSharp-vim (or vscode or whichever editor you use) populates it with the code action response. OmniSharp-vim can't update the .csproj - OmniSharp-vim doesn't even know where the .csproj is located, and certainly doesn't know how to format it. |
@Confuset have a look at the new Wiki article: Working with older .csproj Projects I don't think this should be part of OmniSharp-vim but perhaps including a guide for how to do it yourself is good enough? |
@Confuset I'm going to close this issue as it doesn't contain anything to be done or tracked in this repo. The new analyzer code has been merged into OmniSharp-roslyn too. Get the latest pre-release version with: :OmniSharpInstall 'v1.32.13' |
I totally agree. |
Roslyn can be Extended to support custom Code analyzers, Code fixes and refactorings like https://github.com/JosefPihrt/Roslynator
(Installation instructions https://github.com/JosefPihrt/Roslynator/blob/master/docs/RoslynatorForVisualStudioCode.md)
But in order for this to work we would need this PR OmniSharp/omnisharp-roslyn#1076 merged in omnisharp-roslyn i guess.
The text was updated successfully, but these errors were encountered: