I have a dotnet core console app I generated from the cli via
dotnet new console -n EODG.VsCodeTester.Cli
Using the C# Extensions extension, I right click on the project folder in VSCode, and click "New C# Class".
The class/file opens just fine, but Omnisharp doesn't appear to recognize the file/class. From Program.cs
, the class doesn't show up in the code completion, and the codelens in the new class doesn't show up.
The following is outputted from the OmniSharp log...
[info]: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionService
Could not find document for file c:\Users\elrod\src\test\src\EODG.VsCodeTester.Cli\Cat.cs
Now, if I restart OmniSharp, it recognizes the new file just fine... but it's kind of a pain to restart omnisharp everytime I make a new class/interface or rename them. I've never seen this before, and I've been doing dotnet core development in vscode since v1.
I tried googling OmniSharp "Could not find document for file"
... and it said No results found for OmniSharp "Could not find document for file".
... so, that's nice.
I will be more than happy to provide any other details I can.
Thanks, y'all!
If IntelliSense is not working as it should on your Windows 11/10 PC, you can try restarting VS Code and this should solve the issue. Restarting the program can be really effective and time saving in some cases. If the issue persists, you can try restarting your computer altogether.
OmniSharp is a set of tooling, editor integrations and libraries that together create an ecosystem that allows you to have a great programming experience no matter what your editor and operating system of choice may be.
What worked for me on my mac, was that in settings, search for omnisharp, then look for the option that says Omnisharp: Use Global Mono and set it to always.
It looks like OmniSharp version 1.23.5 might be busted... I reverted to version 1.23.3, and things work as expected now. Possibly related to this issue on their git repo.
UPDATE: updating to v1.23.6 resolves this issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With