Splitting method in two lines between return type and name breaks syntax highlighting #2537
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- csharp, typescript
- Domain
- tooling
Research direction
Reproduce the snippet in VS Code 1.27.1 with C# Extension 1.16.1, then locate the repository's C# syntax grammar entry point; no file or test is named in the issue. Done means the split return-type and method-name examples highlight the return type, method name, and method body as they do when kept on one line, including the tuple case.
Written by the indexing model from the issue text.
Description
Environment data
dotnet --info output:
.NET Core SDK (reflecting any global.json):
Version: 2.1.401
Commit: 91b1c13032
Runtime Environment:
OS Name: fedora
OS Version: 28
OS Platform: Linux
RID: fedora.28-x64
Base Path: /usr/share/dotnet/sdk/2.1.401/
Host (useful for support):
Version: 2.1.3
Commit: 124038c13e
.NET Core SDKs installed:
2.0.2 [/usr/share/dotnet/sdk]
2.0.3 [/usr/share/dotnet/sdk]
2.1.401 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.All 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.All]
Microsoft.AspNetCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 2.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.0.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Microsoft.NETCore.App 2.1.3 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
VS Code version: 1.27.1
C# Extension version: 1.16.1
Steps to reproduce
- Open a new .cs file and write the following:
namespace Test
{
public class TestClass {
public int
TestMethod()
{
return 2;
}
public (int a, IEnumerable<int> b)
MethodThatReturnsTuple(int x)
{
return (5, new [] { 1, 2, 3 });
}
}
}
(I know the first example is a bit academic, but I just want to show that even the simpler example fails to some extent. I also note that GitHubs syntax highlight fails the second example... But it is correct csharp syntax)
Expected behavior
Expect highlighting to work as if the methods were on the same line as the return type:

Actual behavior

Note that:
- In TestMethod, the return type is not correctly highlighted
- In the MethodThatReturnsTuple, the incorrect highlighting spreads into the method body
- Dominant language
- TypeScript
- Stars
- 78
- Forks
- 43
- Avg merge
- 34m
- Merged PRs (30d)
- 1
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dotnet/csharp-tmLanguage
-
C# syntax highlighting broken with collection expressions and string interpolation in method calls Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dotnet/csharp-tmLanguage#332 · 7 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
dotnet/csharp-tmLanguage#336 · 3 comments ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
dotnet/csharp-tmLanguage#306 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
dotnet/csharp-tmLanguage#304 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
dotnet/csharp-tmLanguage#303 ·
All issues in dotnet/csharp-tmLanguage
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Eynzof/Hermes-CN-Desktop#610 ·
-
bug clawsweeper:linked-pr-open clawsweeper:needs-live-repro clawsweeper:no-new-fix-pr impact:message-loss issue-rating: 🐚 platinum hermit P2 regression
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·