dotnet / dotnet/csharp-tmLanguage

Splitting method in two lines between return type and name breaks syntax highlighting #2537

オープン
#136 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
TypeScript
スター
78
フォーク
43
平均マージ
34分
マージ済み PR(30日)
1

説明

## 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

1. Open a new .cs file and write the following:

```csharp
namespace Test
{
public class TestClass {
public int
TestMethod()
{
return 2;
}

public (int a, IEnumerable 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:

![image](https://user-images.githubusercontent.com/840259/45680226-a83f0600-bb3a-11e8-8e50-f2366e80a97e.png)

## Actual behavior

![image](https://user-images.githubusercontent.com/840259/45680200-98bfbd00-bb3a-11e8-982a-31f48c4ef294.png)

Note that:
1. In TestMethod, the return type is not correctly highlighted
2. In the MethodThatReturnsTuple, the incorrect highlighting spreads into the method body

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

VS Code 1.27.1 と C# Extension 1.16.1 でスニペットを再現し、その後、リポジトリの C# 構文グラマーのエントリーポイントを特定してください。issue ではファイルもテストも指定されていません。1 行に保持した場合と同じように、戻り値の型、メソッド名、メソッド本体が、戻り値の型とメソッド名を分割した例でもハイライトされ、タプルの場合も含まれていれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
csharp, typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。