I've got a toy (fictional) programming language I'm playing around with called Nyx. I want to create a basic TextMate grammar for it so that I have basic syntax highlighting in VS Code.
The behaviour I want around comments is that there's only one way to start a comment; by using the '' char sequence. The key is that the comment also includes any subsequent lines that are indented more than the '' that started the comment. Here's an example:
This is not a comment
'' This IS a comment
So is this
And this also
This is NOT a comment
some.code(that.isNot(aComment)) '' This IS a comment
And this second line is too!
back.toCode<Again>()
How can I create such a TextMate rule for Vs Code? In my repository section I have made a start (based on a few bits I've seen online of other people's grammars) with:
"comments": {
"patterns": [
{
"name": "comment.line.double-apos.nyx",
"begin": "(^[ \\t]+)?(?='')",
"beginCaptures": {
"1": { "name": "punctuation.whitespace.comment.leading.nyx" }
},
"end": "(?!\\G)"
}
]
}
but I'm unsure how to continue; I don't know of another language with comments that work this way so I don't have anything I can copy from.