-
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
Feedback wanted! stdio #468
Comments
I'm trying it out and so far so good. I do notice a lot more speed. I have noticed on a few occasions though that when I pick a code action, it seems like the omnisharp server is duplicating the files in the solution in memory or something because I get a bunch of errors about duplicate/ambiguous classes etc.. Restarting the server fixes it. Still trying to get something that is more reproducible. |
I did a quick check to see if it's a drop-in replacement. I updated to OmniSharp 1.32.19 (64-bit windows) and set |
@stevearc yes all requests responses are logged, I meant to add an option to turn that off but forgot. I also forgot the command to open the log, similar to |
@jpfeiffer16 yes I've experienced that too at times. I think it's a server bug, where server requests sent before the server is fully loaded store the buffer as unattached files. AFAIU the idea is that once the project is loaded in the server, the unattached buffer is recognised as belonging to the project and included, but that doesn't always happen, so in the server you end up with both the unattached buffer and the project file. Hence, duplicates. Currently I listen for a specific message from the server before I mark the server as "loaded". I'm thinking I need to extend this to listen for "project XYZ" loaded from the server from_all_ solution projects, which will mean a longer wait before the server accepts requests, but will avoid these errors. Perhaps if the bug is fixed in OmniSharp-roslyn at some stage we can do back to this current behaviours. Note that this bug also occurs occasionally in the HTTP version. |
Another thing that might be handy is a statusline function. I have one I use in my config, where a flag indicates the server state - I think I might move this from my config into OmniSharp-vim. |
@stevearc did you run |
@stevearc I have added a generic |
I didn't run Found my issue though, I forgot to check the path to the exe and it changed because I unzipped the new server differently. Now it works! I'd recommend printing an error message if the executable path couldn't be found. Most of the things I use regularly seem to work, but I'm not getting ALE linting. Is there another config change I need to make for that? |
Oh no you're right, it won't install the correct version inside WSL. In that situation I tend to open a Windows gvim and do the Printing some error messages is a good idea, I'll try to set up some listeners. I'm not sure why you're not getting ALE linting, that works fine for me out of the box I think. I'll try later on with a clean config. |
@stevearc do you have an up-to-date ALE? The linting depends on its relatively new |
@jpfeiffer16 I have updated the "loaded" listener now so it listens for all projects to be loaded. For me, this appears to have removed the "Duplicate definition" errors. I have made this optional, so for users who don't experience the duplication issue, or are trying different versions of OmniSharp-roslyn which might not have this problem, you can |
Found the issue. I'm using I think an easy fix for this would be to always register the |
@stevearc good idea, done. |
Everything's working for me now! I'll keep using it and see if anything else turns up. I've noticed it starts up much faster. I used to have to wait 1-2 minutes for the server to spin up, but now it's closer to 10 seconds. Awesome! Thanks for all your work on the upgrade! |
You're welcome! Yeah it's pretty speedy, I'm finding it much nicer to work with - and more reliable too, since updating the listeners for completed projects. Being able to listen for all server events as they arrive rather than polling is really nice. There are a few more improvements I can build on on top now, like listening for unrequested diagnostics, and the TextChanges mentioned (4 years ago!) in #215. Currently we don't receive changes that way from the server but that could well be the way we request them ... I'll take a look when I find some more time. |
Back again 😅 NeoVim apparently doesn't have I'm also seeing that when I |
Oh I didn't realise Yes
I prefer option 2 - what do you think? |
@stevearc I have implemented option 2. I tested it out and it works well I think - just make sure you use function! s:CBCodeFormat() abort
noautocmd write
set nomodified
endfunction
autocmd BufWriteCmd <buffer> call OmniSharp#CodeFormat(function('s:CBCodeFormat')) I also added a test for |
Works! Thanks for the fast fix! I'll keep an eye out for other issues 🙃 |
Hey there, the stdio implementation works quite well on my side too! Even on Unity side it's quite responsive :) |
Thanks @psuong, that's good to hear. It seems to be working very well, I'd like to make it the default now but I need to work out how to do it smoothly, ideally it should detect existing HTTP servers and use the correct mode for those. Perhaps echo a recommendation to switch to stdio (for vim8 and neovim which can handle it). |
@nickspoons thank you for all the hard work with this repo by keeping it up to date and being responsive to issues. I switched to stdio in WSL and GVIM and it is super fast! I had no issues following your instructions. Great work! |
Had a working version before, tried to upgrade everything and use stdio, can't get it to work anymore. Log report no error and stops after it started up, last log being: Using shortcut gs do display :OmniSharpGotoDefinition in vim, but nothing happens. Here is my environment:
|
@Incubatio do you mean you have previously had a working Http version, or a working Stdio? It looks like you have installed the Stdio with Could you try clearing the log, adding |
I'm having a very similar problem. I'm using the new Stdio server with Neovim but every OmniSharp command I results in nothing happening. Here is a pastebin with |
Yes it was previously working with the http version. I've installed it and re-installed it with different options many times, but yes the main way of doing it was via
As I have literally no log on my work machine, I'm gonna try on on a different machine where I never installed it. I will post again later today. |
Re-installed everything on another machine at home, same result. what I do: log generated via As you can see still no log about Omnisharp commands, they fail, and fail silently. It is weird because changing the loglevel doesn't log anything more.
aaaannd still doesn't log anything more. I'm gonna go through your sources, read it and try to add some logging ... |
Ok I seem to have identified the source of the problem: now i need to figure why job.loaded is always false. |
stdio:27, in ListenToServer you're expecting a communication that never happen in my environments "OmniSharp.MSBuild.ProjectManager". I'm not familiar at all with the whole omnisharp process, so I will leave it to someone else to apply a fix that could work for everyone. Note: I would suggest to rename ListenToServer to handleServerRequest. |
Oh great debugging, thanks! That's very interesting that you aren't getting any of those events. Yes adding a timeout there is a good idea, I'll do that. I'm currently trying to improve that area as I don't think it works properly as it is anyway, see OmniSharp/omnisharp-roslyn/issues/1521 |
That does seem to be the case, and yes, using your proxy does make nvim start working on Windows (it already worked for me in Windows WSL). So I think you're bang on, but I don't know really what our options are from here. The proxy is brilliant for debugging but we shouldn't need it, right? I can't find any documentation on how to send data to neovim channels differently than the way we currently are. |
Yeah. I'm kind of stuck here to. We definitely shouldn't need the proxy for
it to function as normal. My only thought was that maybe there is some nvim
channel setting that might help. But I haven't found anything like that.
…On Sun, Jun 16, 2019, 5:57 AM Nick Jensen ***@***.***> wrote:
That does seem to be the case, and yes, using your proxy does make nvim
start working on Windows (it already worked for me in Windows WSL). So I
think you're bang on, but I don't know really what our options are from
here. The proxy is brilliant for debugging but we shouldn't need it, right?
I can't find any documentation on how to send data to neovim channels
differently than the way we currently are.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#468?email_source=notifications&email_token=ACCVOZDM7XIRNFWGP74I6WTP2YTBXA5CNFSM4HOBC6Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXZLL4I#issuecomment-502445553>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACCVOZDOQIGGG7EIOPQ6DALP2YTBXANCNFSM4HOBC6ZQ>
.
|
If anyone is interested in a server status statusline flag, I've now created vim-sharpenup which currently includes the code actions available functionality from the wiki and a configurable statusline function. I haven't managed to get it to work well in airline yet but there is some lightline config suggestions in the README, as well as plain |
Looks awesome! I'll definitely be giving it a try when I get a chance. |
I don't really know if this is stdio related but I received lots of |
@Confuset I've been using |
I'm on 1.32 as well right now.
…On Sat, Jul 6, 2019, 1:42 AM Nick Jensen ***@***.***> wrote:
@Confuset <https://github.com/Confuset> I've been using 1.32.20, haven't
tried out 1.33.0 yet
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#468?email_source=notifications&email_token=ACCVOZBMQ3UKH5ERZ2G4H5DP6BEFJA5CNFSM4HOBC6Z2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZKUNQQ#issuecomment-508905154>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ACCVOZHYYWTD6KOBTEVT2SDP6BEFJANCNFSM4HOBC6ZQ>
.
|
Really appreciate all the work going into this. It's awesome being able to do my work from VIM. On initial install, i was upgrading from an older syntastic configuration and there were all sorts of major errors going on a simple switch to the stdio version. After i removed syntastic and installed ALE everything worked great though. Also on install, that line in the readme about 'installing a specific version of roslyn' tripped me up for a bit. I believe that the version number in the example is completely broken on ubuntu, and so when i copy / pasted without really reading too carefully omnisharp server was failing to start. I've been running in tmux with a couple sessions connected to the same solution. Saving changes to one file (in one vim process) doesn't cause a re-parse in the other vim processes that are open on the same solution. If i close and re-open the file it will parse again but it would be nice to have some automated orchestration for that. I also seem to be have some issues with 'missing namespace' errors. I can build / run my solution fine, but references to my nuget packages are being highlighted as 'the type or namespace does not exist' errors by vim. I'd assume someone else has nuget references working and it's probably a more localized issue but any pointers on tracking that down would be appreciated? |
Once i added the configuration for ale to ~/.vimrc the issue with nuget projects went away. This is in the readme so my own fault for not migrating properly. I guess there was a default c# linter that was having problems with the nuget stuff that needed disabled:
This is a lot easier than the experience launching omnisharp server manually when poking around. It probably is a bit slower and doesn't handle the concurrent edits across processes as nicely. Maybe I should be using vim splits instead of tmux-splits. I infrequently have seen some other weird stuff going on but i can't reliably produce any of these issues unfortunately:
The extra keybindings / lightline settings in sharpen-up are a nice touch! Setting "g:OmniSharp_highlight_types = 2" must ocur before loading omnisharp plugin , that wasn't so obvious to me from the README. Furthermore, in stdio mode, we won't actually see highlighting until omnisharp finishes loading and then hits an InsertLeave. Maybe stdio should selectively be kicking this command off once the server is fully loaded (or watching for server loaded event?)
|
Hi there @hannasm, thanks very much for the feedback.
Yes ALE has a default
I'm not totally sure what you mean here? But yes in my experience keeping a single Vim session running for a project has the best results - launching language servers is slow, but that's a one-off cost and everything is fast once the server is loaded. OmniSharp-vim will also quite happily open multiple servers if you are navigating between solutions - I used to have a tmux window per solution but these days I keep a single Vim running and I use Vim tabs for solutions/projects. This is just personal preference of course. Your idea of detecting file changes and updating OmniSharp-roslyn is interesting, but I don't really feel that it's OmniSharp-vim's place - adding file watchers on all files in the solution would be quite heavy for the client. It might make sense on the server though ... I don't know this is something that OmniSharp-roslyn may implement?
This is something I'm working on here. The idea is that requests made while the server is loading are "replayed" once the server is loaded. The problem is in detecting exactly when the server is fully loaded. Currently OmniSharp-vim reports the server as "loaded" when certain diagnostics are received, and actually calling
This may be the same OmniSharp-roslyn issue?
I haven't seen these - what OS and vim version are you using?
Yes all global settings should be set in a .vimrc and not in an ftplugin script (is that what you're referring to?). This is because your .vimrc is sourced on Vim launch, then As far as I've seen this is pretty standard plugin behaviour. Some of the plugin initialisation could be moved to the ftplugin script, but most of it needs to happen just once and the |
There definitley appears to be some correlation with the one issue and the timing of omnisharp-loading. To be honest the other issues could have as well and i just didn't connect the dots in those other cases. I'm running vim 8.0 on ubunutu 18. I mostly just have vim plugins as suggested from the README, for C# development on a special virtual machine. Here's a full list of my plugins (excluding the color scheme). I know editorconfig-vim interacts with the indentation settings to some extent or another and could have been involved too
I'm not seeing these errors frequently and everything is working great in general, those are probably edge cases whatever I would open a separate issue if i was able to identify valid repo steps or see the frequency increase.
I was actually just thinking about mentioning this in the relevant part of the README, i'm sure it's fairly common practice. I had put this setting after pathogen#inject() originally and combined with the other highlighting issue led to some confusion. |
That should be fine - I haven't used pathogen for a few years but don't you put all the pathogen stuff at the top of your .vimrc, and everything else below? That's certainly how I do it with vim-plug. |
For anyone interested: I have merged the ReplayRequestsOnLoad feature, which means that users who have highlighting and ALE enabled will see these automatically triggered once the server is loaded. Unfortunately there has not been any movement on OmniSharp/omnisharp-roslyn#1521 so I have added a 1 second delay before replaying the highlight/diagnostics requests. Hopefully when some OmniSharp-roslyn refactorings like this one come in, we'll be able to remove this and speed things up. |
So far it works great for me! I love not having to manually highlight the first file I open. Thanks! |
Here is the issue that I am having right now:
(I am navigated properly, I just get that error message every time)
Tested on Windows with:
Program.cs
Class1.cs
.vimrc
(and no other plugins) Any ideas about what could've caused that unwanted behavior? Please let me know if there are any other information that would be useful for you. EDITI forgot to add that this problem does not exist if |
Is deoplete working with stdio? I get this error:
If it's a known issue, please point me to it; I couldn't find one in the tracker. |
@reaysawa no, no specific stdio support has been added for deoplete - thanks for pointing that out. You're welcome to open an issue - and if you want to and know a bit of python, feel free to implement it! I don't use deoplete myself but if nobody else does it, I will try to find some time at some stage. |
I'm not getting any completion using the stdio version. I've tried it with deoplete and without, all I get are the normal words buffers as suggestions. |
@levihb as stated in the previous comment, there is no deoplete support (still!). To get completions without deoplete, use If you still aren't getting completions, there is something wrong with your setup - please open an issue and I'll help you get it worked out. |
Hmm I'd love to try and figure out how to write the python source for deoplete - this might not be the right thread for this - but know of resources on how to get started to writing a completion source? I can kind of get the structure from the current implementation for the http server. |
@psuong I'm really not sure how to go about it, as a non-deoplete user. The existing deoplete source may not be the best place to look - the OmniSharp-vim python implementation is very well structured and the deoplete source integrates with that perfectly, but we don't have any similar python integration with the stdio stuff. I wonder if a better place to look would be other plugins which use async job servers. Perhaps LSP clients like vim-lsc? |
Alright - thanks @nickspoons. I'll start poking around this upcoming weekend. |
@nickspoons regarding asyncomplete, I'm not always getting suggestions, e.g.:
Which will show all the GetThis methods with arguments of type argument1, but then soon as I press , it disappears and just starts to suggest basic suggestions again? Similarly with:
It will show completion up to here. But then when I do e.g.
Suddenly I lose all suggestions? Is this a problem with asyncomplete or omnisharp, and do you know how to fix it? |
@levihb can you please open a new issue, and include some screenshots or asciinema or something demonstrating exactly what you mean? |
Right, over a year later and I would really like to make stdio the default, and simplify the minimal .vimrc to get a really good OmniSharp experience. The 2 blockers for this have been:
I was pretty keen to make the switch with these in place but ... unfortunately, the latest OmniSharp-roslyn release does not work properly. There's been some kind of change in project loading system, so opening a large solution such as the OmniSharp-roslyn source will not load completely - just the first project. So I need to look into what they've done there. I don't want to switch to stdio by default, then immediately have to tell users to downgrade their server. |
Asynchronous server interactions have been added, with the server switch from the HTTP to stdio version of OmniSharp-roslyn.
In my personal usage the new version has been very good, much faster and smoother. I also hope this will remove some barriers to getting OmniSharp running initially for new users, as the OmniSharp-vim python dependency and OmniSharp-roslyn libuv dependency are both removed.
I'm opening this issue in the hope of getting some feedback from anyone trying out the new server. Bugs should be reported of course, but anyone who doesn't have any problems is most welcome to comment or give a 👍, and that way I can get a better idea of when to make stdio the default (currently the feature is opt-in only with the
g:OmniSharp_server_stdio
flag).The text was updated successfully, but these errors were encountered: