Add more C# language features and syntax sugar to highlightning
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Đọc issue 5838 được liên kết của github/linguist và so sánh các tính năng C# được liệt kê với hành vi hiện tại của grammar. Sử dụng các ví dụ được cung cấp, bao gồm extension-method resolving, làm các trường hợp chấp nhận; hoàn thành nghĩa là cú pháp được yêu cầu được tô sáng chính xác.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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?
}
}
}
- Ngôn ngữ chính
- TypeScript
- Star
- 78
- Fork
- 43
- Merge trung bình
- 34 phút
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của dotnet/csharp-tmLanguage
-
C# syntax highlighting broken with collection expressions and string interpolation in method callsĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
dotnet/csharp-tmLanguage#332 · 7 bình luận · 1 reaction ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
dotnet/csharp-tmLanguage#336 · 3 bình luận ·
-
[Textmate] `scoped ref` modifierĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
dotnet/csharp-tmLanguage#306 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
dotnet/csharp-tmLanguage#304 ·
-
[Textmate] Lambda with attributeĐang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
dotnet/csharp-tmLanguage#303 ·
Tất cả issue của dotnet/csharp-tmLanguage
Issue tương tự
-
Resources: New palettes of MacaoĐang mởresources
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
railmapgen/rmg-palette#2445 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
danielmiessler/LifeOS#2242 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
good first issue hacktoberfest help wanted translation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
callstackincubator/appduct#129 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100