Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect syntax highlighting for constructor calls #4543

Closed
LarsBehl opened this issue May 8, 2021 · 2 comments
Closed

Incorrect syntax highlighting for constructor calls #4543

LarsBehl opened this issue May 8, 2021 · 2 comments

Comments

@LarsBehl
Copy link

LarsBehl commented May 8, 2021

Issue Description

When calling a constructor to initialize a property using a non primitive type, the keyword new is not picked up and the constructor call is highlighted like a method call.

I already tried enabling csharp.semanticHighlighting.enabled and editor.semanticHighlighting.enabled which results in correct syntax highlighting for the constructor call but faulty highlighting for e.g. using directives.
semanticEnabled

Steps to Reproduce

  1. Create new console app (dotnet new console)
  2. Add non static method to Program
  3. Add struct or object type property to Program
  4. Initialize the property in the non static method

Expected Behavior

Syntax highlighting on the constructor call is the same as when calling the constructor for a local variable

Actual Behavior

syntaxHighlighting
Call to the constructor is highlighted like a method call

Logs

OmniSharp log

Post the output from Output-->Starting OmniSharp server at 8.5.2021, 20:45:40 Target: c:\Users\larsb\source\spielwiese\omnisharpHighlight

OmniSharp server started.
Path: c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8\OmniSharp.exe
PID: 13568

Starting OmniSharp on Windows 6.2.9200.0 (x64)
info: OmniSharp.Services.DotNetCliService
DotNetPath set to dotnet
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Located 1 MSBuild instance(s)
1: StandAlone 16.9.0 - "c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8.msbuild\Current\Bin"
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
MSBUILD_EXE_PATH environment variable set to 'c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8.msbuild\Current\Bin\MSBuild.exe'
info: OmniSharp.MSBuild.Discovery.MSBuildLocator
Registered MSBuild instance: StandAlone 16.9.0 - "c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8.msbuild\Current\Bin"
CscToolExe = csc.exe
CscToolPath = c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8.msbuild\Current\Bin\Roslyn
MSBuildExtensionsPath = c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8.msbuild
MSBuildToolsPath = c:\Users\larsb.vscode\extensions\ms-dotnettools.csharp-1.23.11.omnisharp\1.37.8.msbuild\Current\Bin
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.CSharpFormattingWorkspaceOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.Completion.CompletionOptionsProvider, Order: 0
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.RenameWorkspaceOptionsProvider, Order: 100
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.ImplementTypeWorkspaceOptionsProvider, Order: 110
info: OmniSharp.WorkspaceInitializer
Invoking Workspace Options Provider: OmniSharp.Roslyn.CSharp.Services.BlockStructureWorkspaceOptionsProvider, Order: 140
info: OmniSharp.Cake.CakeProjectSystem
Detecting Cake files in 'c:\Users\larsb\source\spielwiese\omnisharpHighlight'.
info: OmniSharp.Cake.CakeProjectSystem
Could not find any Cake files
info: OmniSharp.MSBuild.ProjectSystem
No solution files found in 'c:\Users\larsb\source\spielwiese\omnisharpHighlight'
info: OmniSharp.MSBuild.ProjectManager
Queue project update for 'c:\Users\larsb\source\spielwiese\omnisharpHighlight\omnisharpHighlight.csproj'
info: OmniSharp.Script.ScriptProjectSystem
Detecting CSX files in 'c:\Users\larsb\source\spielwiese\omnisharpHighlight'.
info: OmniSharp.Script.ScriptProjectSystem
Could not find any CSX files
info: OmniSharp.WorkspaceInitializer
Configuration finished.
info: OmniSharp.Stdio.Host
Omnisharp server running using Stdio at location 'c:\Users\larsb\source\spielwiese\omnisharpHighlight' on host 13500.
info: OmniSharp.MSBuild.ProjectManager
Loading project: c:\Users\larsb\source\spielwiese\omnisharpHighlight\omnisharpHighlight.csproj
info: OmniSharp.MSBuild.ProjectManager
Successfully loaded project file 'c:\Users\larsb\source\spielwiese\omnisharpHighlight\omnisharpHighlight.csproj'.
info: OmniSharp.MSBuild.ProjectManager
Adding project 'c:\Users\larsb\source\spielwiese\omnisharpHighlight\omnisharpHighlight.csproj'
info: OmniSharp.MSBuild.ProjectManager
Update project: omnisharpHighlight
Received response for /v2/getcodeactions but could not find request.

C# log

None

Environment information

VSCode version: 1.56.0
C# Extension: 1.23.11

Dotnet Information .NET SDK (gem�� "global.json"): Version: 5.0.100 Commit: 5044b93829

Laufzeitumgebung:
OS Name: Windows
OS Version: 10.0.19042
OS Platform: Windows
RID: win10-x64
Base Path: C:\Program Files\dotnet\sdk\5.0.100\

Host (useful for support):
Version: 5.0.0
Commit: cf258a14b7

.NET SDKs installed:
5.0.100 [C:\Program Files\dotnet\sdk]

.NET runtimes installed:
Microsoft.AspNetCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
Microsoft.NETCore.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
Microsoft.WindowsDesktop.App 5.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]

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

Visual Studio Code Extensions
Extension Author Version
cpptools ms-vscode 1.3.1
csharp ms-dotnettools 1.23.11
remote-wsl ms-vscode-remote 0.56.1
todo-tree Gruntfuggly 0.0.213
vscode-counter uctakeoff 2.2.2
@JoeRobich
Copy link
Member

@LarsBehl Thanks for reporting this issue. This is an issue with the C# textmate grammar. The repo is at https://github.com/dotnet/csharp-tmLanguage

@LarsBehl
Copy link
Author

Thanks, taking a look at it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants