dotnet / dotnet/vscode-csharp

Razor highlighting lost after a multiline member definition in @code block.

Open
#5,651 0 comments 0 reactions 0 assignees View on GitHub
OmniSharp Razor
Dominant language
TypeScript
Stars
3.1k
Forks
737
Avg merge
17h 56m
Merged PRs (30d)
21

Description

## Issue Description ##
In a razor file, in a @code block, syntax higlighting is lost after certain multiline property definitions.

## Steps to Reproduce ##
Create a razor file:
```


Hello world

@code {
[Parameter]
public string Param1 { get; set; }
[Parameter]
public string Param2 { get; set; }
[Parameter]
public string Param3 { get; set; }
[Parameter]
public string Param4 { get; set; }
}
```
Add a linebreak before "Param2".

## Expected Behavior ##
Syntax highlighting remains intact.

## Actual Behavior ##
Syntax highlighting is gone from the linebreak onward.

Before and after:
Screenshot 2023-04-11 at 11 38 06 PM
Screenshot 2023-04-11 at 11 38 18 PM

It seems like it reverts back to html syntax highlighting in this case. Notice how the following html element is correctly highlighted.
Screenshot 2023-04-11 at 11 41 23 PM

## Logs ##

### OmniSharp log ###
Post the output from Output-->OmniSharp log here

### C# log ###
Post the output from Output-->C# here

## Environment information ##

**VSCode version**: 1.76.2
**C# Extension**: 1.25.5

Mono Information
There is a problem with running OmniSharp on mono: Error: Unable to find Mono. Ensure that Mono's '/bin' folder is added to your environment's PATH variable.
Dotnet Information
.NET SDK:
Version: 7.0.101
Commit: bb24aafa11

Runtime Environment:
OS Name: Mac OS X
OS Version: 13.0
OS Platform: Darwin
RID: osx.13-arm64
Base Path: /usr/local/share/dotnet/sdk/7.0.101/

Host:
Version: 7.0.1
Architecture: arm64
Commit: 97203d38ba

.NET SDKs installed:
6.0.201 [/usr/local/share/dotnet/sdk]
6.0.402 [/usr/local/share/dotnet/sdk]
6.0.404 [/usr/local/share/dotnet/sdk]
7.0.100 [/usr/local/share/dotnet/sdk]
7.0.101 [/usr/local/share/dotnet/sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.AspNetCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 6.0.3 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.10 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 6.0.12 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.0 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 7.0.1 [/usr/local/share/dotnet/shared/Microsoft.NETCore.App]

Other architectures found:
x64 [/usr/local/share/dotnet/x64]

Environment variables:
Not set

global.json file:
Not found

Learn more:
https://aka.ms/dotnet/info

Download .NET:
https://aka.ms/dotnet/download

Visual Studio Code Extensions

|Extension|Author|Version|
|---|---|---|
|blazorwasm-companion|ms-dotnettools|1.1.4|
|csharp|ms-dotnettools|1.25.5|
|godot-tools|geequlim|1.3.1|
|intellicode-api-usage-examples|VisualStudioExptTeam|0.2.7|
|jbockle-format-files|jbockle|3.4.0|
|Kotlin|mathiasfrohlich|1.7.1|
|live-server|ms-vscode|0.4.7|
|multi-file-renamer|dandidevs|1.0.0|
|remote-containers|ms-vscode-remote|0.288.0|
|remote-wsl|ms-vscode-remote|0.76.1|
|terraform|hashicorp|2.25.4|
|vscode-docker|ms-azuretools|1.24.0|
|vscode-dotnet-runtime|ms-dotnettools|1.6.0|
|vscode-tailwindcss|bradlc|0.9.11|
|vscode-xml|redhat|0.24.0|
|vscodeintellicode|VisualStudioExptTeam|1.2.30|;

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.