Renaming file or creating new file breaks omnisharp lookup
See original GitHub issueEnvironment data
dotnet --info
output:
.NET Command Line Tools (2.1.4)
Product Information:
Version: 2.1.4
Commit SHA-1 hash: 5e8add2190
Runtime Environment:
OS Name: Mac OS X
OS Version: 10.13
OS Platform: Darwin
RID: osx.10.12-x64
Base Path: /usr/local/share/dotnet/sdk/2.1.4/
Microsoft .NET Core Shared Framework Host
Version : 2.0.5
Build : 17373eb129b3b05aa18ece963f8795d65ef8ea54
VS Code version:
Version 1.20.1 (1.20.1)
C# Extension version:
1.14.0
Steps to reproduce
Create a file or rename a file and wait for Omnisharp to parse the file.
Expected behavior
VSCode should be able to find all existing namespace and assemblies.
Actual behavior
VSCode failed to find interfaces in the same namespace, and we can only reproduce it in current session, restarting VSCode, the issue is gone.
It seems Omnisharp somehow couldn’t recognize new file or renamed file are in the same namespace.
Screenshots
Existing file:
Create a new file with simple class name change:
Problems:
Restart or reload VSCode:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:7
- Comments:38 (4 by maintainers)
Top Results From Across the Web
PSA for those writing C# in VSCode (all 10 of us): Omnisharp ...
But I often switch to VSCode because I like the project explorer/file hierarchy better + the significantly better plain text search.
Read more >Can't get VSCode to work properly with Unity
C# Extension/omnisharp is not recognizing my files as .cs and when I installed another extension to create a cs file, it gave me...
Read more >vs code Problems with C# extension, Some projects have ...
ProjectSystem No solution files found in '/Users/zeyad/Documents/Sandbox/CSharpTut' [info]: OmniSharp.MSBuild.ProjectManager Queue project ...
Read more >Hidden features of OmniSharp and C# extension for VS Code
OmniSharp powers intellisense and language services in C# plugins and extensions for numerous ... If the file doesn't exist, just create it.
Read more >April 2022 (version 1.67) - Visual Studio Code
Markdown: Rename headers. Ever change a header in a Markdown file only to realize that you also accidentally broke all links to it?...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ve run into this problem as well with VSCode + Unity and would love a fix. I can only get it to consistently work by closing and restarting VSCode every time I create a new file.
I have the same problem and I’m wondering why Omnisharp doesn’t simply add the file to a csproj that covers any file close by, this would at least work for creating files in the same directory as existing files.
Visual Studio is able to add files to an open Unity solution just fine. What is keeping omnisharp from doing the same? Or is this something that should happen on vscode project management level?