razor icon indicating copy to clipboard operation
razor copied to clipboard

Navigating to Component within same RCL goes to razor__bg__virtual.cs

Open garrettlondon1 opened this issue 2 years ago • 6 comments

image

Navigating to a component in my razor class library with the latest C# extension in VS code (2.4.4), navigates to a razor__bg__virtual.cs class, but when hovered over, it is successfully able to resolve the component reference and namespace

Note: Closing and reopening the component leads to the same result

Reloading window leads to same result. Note: this is a newly added component, in the same working session

garrettlondon1 avatar Oct 05 '23 05:10 garrettlondon1

Thanks for the report. This is the same underlying problem that causes https://github.com/dotnet/razor/issues/9369

davidwengier avatar Oct 05 '23 06:10 davidwengier

@garrettlondon1 just noticed the "_bg" in the filename. This implies you're using OmniSharp, or have the C# extension set to use OmniSharp at least. Is that correct? Does the problem still exist if you turn that off?

davidwengier avatar Oct 06 '23 02:10 davidwengier

Sorry, forgot to mention that.. I had tried three modes of working with the extensions setup:

  1. C# 1.26 - usable but missing important things
  2. C# latest version with Omnisharp enabled - most usable
  3. C# latest version with Omnisharp disabled - completely lose all syntax highlighting, no namespace recognition, cant jump into any references and classes arent recognized.

Also, I do not have the C# dev kit installed, I was having performance issues on my Surface 4 with memory usage. Let me try that again

garrettlondon1 avatar Oct 06 '23 03:10 garrettlondon1

Omnisharp is able to recognize services @injected into the _Imports.razor, and even with C# dev kit I get CS0246 in the code behind file for unrecognized component references, as well as the component tag in the .razor page is unrecognized. Reloading the window, as well as reopening VS code doesn't help

garrettlondon1 avatar Oct 06 '23 03:10 garrettlondon1

image image

Firm is a class, Modal is a component reference, and syntax highlighting is lost with Omnisharp disabled. I even tried restarting the language server, and sorry to jump off topic, but that's why I can't disable Omnisharp. Shoutout dan roth for the searchbox component :)

image

Here is the same with Omnisharp enabled 5 mins later after files were indexed

garrettlondon1 avatar Oct 06 '23 03:10 garrettlondon1

That's not off topic, thats reporting bugs 😁

(though okay.. separate issues is probably ideal, but we'd rather have the information somewhere than not)

davidwengier avatar Oct 06 '23 04:10 davidwengier