Syntax highlighting breaks when opening bracket of a method is placed in a new line

Open
#63 5 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
csharp
Domain
tooling

Research direction

Start by reproducing the reported highlighting failure with the C# sample, comparing it with the version where the opening parenthesis stays on the declaration line. Then inspect the syntax grammar's handling of method and constructor declarations across that newline; done means the remaining parameters, method body, and following interface are highlighted correctly.

Written by the indexing model from the issue text.

Description

Bug

From @zeroskyx on May 17, 2017 18:46

The following code placed in a class breaks syntax highlighting:

public void Routine
(
  IInterface Interface0,
  IInterface Interface1,
  IInterface Interface2
)
{
  string One = "";
  string Two = "";
  string Three = "";
}

interface IInterface
{
}

Beginning with the second instance of IInterface and after the method body, everything is white -- in more complex projects, somewhere it works again later in the file.
Screenshot:
capture

Removing the newline after public void Routine does not cause the issue:
capture1

I am aware that this appears to be a "strange" coding style; it makes reading constructors with loads of dependency injections much cleaner though (issue happens with both methods and constructors).

Copied from original issue: OmniSharp/omnisharp-vscode#1489

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from dotnet/csharp-tmLanguage

All issues in dotnet/csharp-tmLanguage

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.