dotnet / dotnet/csharp-tmLanguage

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

Ouverte
#136 2 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
TypeScript
Étoiles
78
Forks
43
Merge moyen
34 min
PR mergées (30 j)
1

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

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

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Reproduisez l’extrait dans VS Code 1.27.1 avec C# Extension 1.16.1, puis localisez le point d’entrée de la grammaire de syntaxe C# du dépôt ; aucun fichier ni test n’est nommé dans l’issue. Le travail est considéré comme terminé lorsque les exemples avec le type de retour et le nom de méthode séparés mettent en évidence le type de retour, le nom de méthode et le corps de la méthode comme lorsqu’ils sont conservés sur une seule ligne, y compris le cas du tuple.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
csharp, typescript
Domaine
tooling
Type d'issue
Bug
Difficulté
3/5
Temps estimé
1-2 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
45/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.