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.
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?
}
}
}
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)
Pointers & pointer fixture (ECMA Draftv6 22.7)
C# 9
Native Integer Primitives (CSharp 9.0 Proposal)
Function pointers (CSharp 9.0 Proposal)
Static anonymous functions (CSharp 9.0 Proposal)
With expressions (CSharp 9.0 Proposal)
C# 10
Global Using Directives (CSharp 10.0 Proposal)
Records (CSharp 10.0 Proposal)
Enhanced Pattern Matching (CSharp 9.0 Proposal + CSharp 10.0 Proposal)
Null checks
Defaults
implicit new
Wrong implemented features
Extension method resolving