OmniSharp / omnisharp-vim

Vim omnicompletion (intellisense) and more for C#
http://www.omnisharp.net
MIT License
1.72k stars 168 forks source link

[Bug] Poor Performance in Some Unity Projects #844

Closed cachandlerdev closed 1 year ago

cachandlerdev commented 1 year ago

Environment

Given that this process is nearly instantaneous in other editors, and works fine when I copy-pasted the code to another Unity project, I do not believe that my computer's hardware is the cause of the issue.

Visual Proof (screenshots, videos, text)

Screencast from 2023-06-26 15-14-44.webm

I stopped the recording there, but if you waited for another minute or two, you'd see the error message for the text I typed show up.

Omnisharp Log

log.txt

cachandlerdev commented 1 year ago

My apologies for disturbing the development team. After further testing and looking at the Omnisharp logs, it appears as removing the NuGet directory and the omnisharp.json file (which I had inserted a while ago while trying to get VSCode's intellisense working) may have fixed the issue. The initial Omnisharp load time is still a painful 45-50 seconds, but after it loads, everything seems to be running smoothly.

If anybody comes across this in the future and previously opened the project with VSCode after following these steps, check the Omnisharp logs to make sure that your VSCode configuration was not the cause of the issue.

nickspoons commented 1 year ago

Edit: I posted this before I saw your answer, good to see you got it sorted

So in your demo the server appears to be running for a while but just doing document-local diagnostics, the solution-wide analysis hasn't started yet (diagnostics are not smart, they don't know that some usings are unnecessary, for example). The server is loading projects. Once the projects load the server starts doing solution-wide analysis which takes quite a while because there are 65 projects.

There are no .csproj or .sln files in the repo so it's hard to know how any of this actually gets built.


The log is full of omnisharp-roslyn server warnings and errors.

The missing analyzer warning at the top of your log mentions not finding part of the path FlappyBird2D/./NuGet/microsoft.unity.analyzers.1.14.0/analyzers/dotnet/cs. You have an omnisharp.json file saying to use that analyzer, but the repo includes version 1.16 in the NuGet directory, NuGet/microsoft.unity.analyzers.1.16.1/analyzers/dotnet/cs/Microsoft.Unity.Analyzers.dll.

At the end of the log are a series of timed-out analysis queue warnings and failures. This is all server-specific and we can't do anything about it on the client side.

cachandlerdev commented 1 year ago

Yes, as I described in the comment above, I think the problem was linked to the NuGet configuration files I setup a while ago in accordance with the VSCode documentation. After removing them, the project still takes a little bit to load, but it's actually usable at this point, and the OmniSharp logs don't appear to list any big issues.

I appreciate your assistance though with the troubles I experienced so far, and hope I won't have to comment on another GitHub issue page for a while!