dotnet / dotnet/vscode-csharp

Self closing blazor tag causes colorization loss

Open
#5,042 1 comment 1 reaction 0 assignees View on GitHub
OmniSharp Razor Triaged
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
18h 40m
Merged PRs (30d)
31

Description

## Issue Description ##
When you have a self-closing blazor tag within an if expression the code block loses most of the colorization
## Steps to Reproduce ##
1. Create a `.razor` file
2. Have some HTML like
```html



@if (true) {

}
```
3. Add some code to the @code razor block
4. 🐛 There is little to no coloring in the code block

If you switch to an empty closing tag i.e. `` you get colorization back.

## Expected Behavior ##
Colorization is the same if empty tag or self closing tag
## Actual Behavior ##
Self closing tag messes up file colorization
## Logs ##

### OmniSharp log ###

[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/RazorDeclaration/Pages/redacted.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/App.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Pages/redacted.cshtml.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Pages/_Host.cshtml.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Pages/redacted.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Pages/_Layout.cshtml.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file:REDACTED/obj/Debug/net6.0/Razor/Shared/redacted.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Shared/redacted.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Shared/redacted.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/Shared/SurveyPrompt.razor.g.cs added to workspace
[info]: OmniSharp.OmniSharpWorkspace
Miscellaneous file: REDACTED/obj/Debug/net6.0/Razor/_Imports.razor.g.cs added to workspace

### C# log ###

Installing C# dependencies...
Platform: darwin, x86_64

Finished

## Environment information ##

**VSCode version**: 1.65.0-insider
**C# Extension**: 1.24.0

Mono Information
OmniSharp using built-in mono
Dotnet Information
.NET SDK (reflecting any global.json):
Version: 6.0.100
Commit: 9e8b04bbff

Runtime Environment:
OS Name: Mac OS X
OS Version: 12.1
OS Platform: Darwin
RID: osx-x64
Base Path: /usr/local/share/dotnet/sdk/6.0.100/

Host (useful for support):
Version: 6.0.0
Commit: 4822e3c3aa

.NET SDKs installed:
6.0.100 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET runtimes or SDKs:
https://aka.ms/dotnet-download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|redacted|redacted|redacted|

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.