Add more C# language features and syntax sugar to highlightning
まだ誰も着手していません。
評価
調査の方向性
リンクされている github/linguist の issue 5838 を読み、一覧にある C# の機能を現在の文法の動作と比較してください。extension-method resolving を含む提供された例を受け入れ条件として使用してください。要求された構文が正しくハイライトされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
See https://github.com/github/linguist/issues/5838
Describe the enhancement
Currently not all syntax features of C# are highlighted.
My suggestion includes the following (if you would find something missing, feel free to add):
Missing features
For the sake of completeness, I have tried to explicitly assign a feature to a language version here. I could not find the associated standard/proposal for each feature but they do exist.
Standard (Draft v6)
C# language standard - ECMA-TC49-TG2
Unsafe blocks (ECMA Draftv6 22.2)
public void Method() {
unsafe {
// Unsafe operations
}
}
Pointers & pointer fixture (ECMA Draftv6 22.7)
public unsafe void Method() {
fixed(int* ptr = &refVar) {
// Some cool pointer operations
}
}
C# 9
Native Integer Primitives (CSharp 9.0 Proposal)
public void Method() {
nint myNativeInteger = -123;
nuint myNativeUnsignedInteger = 123;
}
public void Method(nint param1, nuint param2) {}
Function pointers (CSharp 9.0 Proposal)
public void Method() {
delegate* managed<int, int>;
delegate* unmanaged<int, int>;
delegate* unmanaged[Cdecl] <int, int>;
delegate* unmanaged[Stdcall, SuppressGCTransition] <int, int>;
}
Static anonymous functions (CSharp 9.0 Proposal)
public void X() {
Y(static (i) => i + 1);
Y(static i => i + 1);
}
public void Y(Func<int, int> x) {}
With expressions (CSharp 9.0 Proposal)
public record MyRecord(string Name);
public MyRecord ModifyName(MyRecord rec) {
return rec with { Name = "My new name" };
}
C# 10
Global Using Directives (CSharp 10.0 Proposal)
global using System;
global using System.Linq;
global using System.Runtime.CompilerServices;
Records (CSharp 10.0 Proposal)
public partial record struct Record {}
public partial sealed record Record {}
public record struct Record {}
public sealed record Record {}
Enhanced Pattern Matching (CSharp 9.0 Proposal + CSharp 10.0 Proposal)
void M(object o1, object o2)
{
var t = (o1, o2);
if (t is (int, string)) {}
switch (o1) {
case int: break;
case string: break;
}
}
bool IsLetter(char c) => c is (>= 'a' and <= 'z') or (>= 'A' and <= 'Z');
Null checks
public void Method(object? nullable) {
if(nullable is null) {}
if(nullable is not null) {}
}
Defaults
public void X() {
int x = default;
}
implicit new
public void Method() {
MyKnownType value = new();
}
Wrong implemented features
Extension method resolving
namespace N1
{
public static class D
{
public static void F(this int i) => Console.WriteLine($"D.F({i})");
}
}
namespace N2
{
using N1;
class Test
{
static void Main(string[] args)
{
1.F();
// ^^ Why is this red?
}
}
}
- 主要言語
- TypeScript
- スター
- 78
- フォーク
- 43
- 平均マージ
- 34分
- マージ済み PR(30日)
- 1
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
dotnet/csharp-tmLanguage のほかの issue
-
C# syntax highlighting broken with collection expressions and string interpolation in method calls オープン
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
dotnet/csharp-tmLanguage#332 · コメント 7 件 · リアクション 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
dotnet/csharp-tmLanguage#336 · コメント 3 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
dotnet/csharp-tmLanguage#306 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
dotnet/csharp-tmLanguage#304 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
dotnet/csharp-tmLanguage#303 ·
dotnet/csharp-tmLanguage の issue をすべて見る
似ている issue
-
VerificationGate: ATTRIBUTION quote guard never matches a normal quotation (\b around the quote) オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
danielmiessler/LifeOS#2234 ·
-
T: Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 1/5 1時間未満 初心者へのやさしさ 85/100
-
Mend: dependency security vulnerability untriaged
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100