From 59d104a4f3a860c71bdd93f6c897a2139b0f369b Mon Sep 17 00:00:00 2001 From: Lycs-D <139197676+Lycs-D@users.noreply.github.com> Date: Sun, 17 Mar 2024 00:06:05 +0800 Subject: [PATCH] [editors/code] Add shebang syntaxe (#34) --- editors/code/syntaxes/tests/comment.v | 5 +++++ editors/code/syntaxes/v.tmLanguage.json | 12 ++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 editors/code/syntaxes/tests/comment.v diff --git a/editors/code/syntaxes/tests/comment.v b/editors/code/syntaxes/tests/comment.v new file mode 100644 index 00000000..abc3caf9 --- /dev/null +++ b/editors/code/syntaxes/tests/comment.v @@ -0,0 +1,5 @@ +// SYNTAX TEST "source.v" "comment" + #!/usr/bin/env -S v +// ^^ punctuation.definition.comment.shebang.v +// ^^^^^^^^^^^^^^^^^ meta.shebang.v +// ^^^^^^^^^^^^^^^^^^^ comment.line.number-sign.v diff --git a/editors/code/syntaxes/v.tmLanguage.json b/editors/code/syntaxes/v.tmLanguage.json index 16f8e9cb..cbd0b6ef 100644 --- a/editors/code/syntaxes/v.tmLanguage.json +++ b/editors/code/syntaxes/v.tmLanguage.json @@ -322,6 +322,18 @@ } }, "end": "$" + }, + { + "name": "comment.line.number-sign.v", + "match": "(?:^|\\s*)(?:((#!).*))", + "captures": { + "1": { + "name": "meta.shebang.v" + }, + "2": { + "name": "punctuation.definition.comment.shebang.v" + } + } } ] },