New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enh(csharp) add keywords record
and init
(C# 9.0)
#2660
Conversation
Please show examples of how both of these are used... sometimes it's not just as simple as adding them to the keywords list. If record is more of a "class" like in Java then it likely needs far more complex rules. |
using System;
public record MyRecord
{
public string SomeMember { get; set; }
} Not sure if it requires some complex rules or not. |
Yes, it's more like a class. See lines 148 or 159. We'd expect that
|
So we'd need a new rule for |
I'm not familiar with making custom rules. :( |
This please. Thought you should consider giving it a try, it's not hard. I'm happy to help. It'd look pretty much like (probably): {
beginKeywords: 'record', end: /[{;=]/,
illegal: /[^\s:]/,
contains: [
TITLE_MODE,
// are generics allowed?
hljs.C_LINE_COMMENT_MODE,
hljs.C_BLOCK_COMMENT_MODE
]
}, And then adding a test case to |
Either way this would need a mention in CHANGES.md. :-) |
That doesn't seem hard. It looks like generics are allowed based on what I'm getting in sharplab. @joshgoebel Thanks for helping! |
record
and init
(C# 9.0)
@Youssef1313 Thanks so much for your contribution! Wasn't so hard, was it? |
No description provided.