From ed74a757afb0b6da10dd854df2cd5cbd5ab79662 Mon Sep 17 00:00:00 2001 From: Ary Borenszweig Date: Wed, 8 Jan 2025 10:47:53 -0300 Subject: [PATCH] feat: some syntax highlighting improvements (#93) --- syntaxes/noir.tmLanguage.json | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/syntaxes/noir.tmLanguage.json b/syntaxes/noir.tmLanguage.json index 4e9bc24..7748ada 100644 --- a/syntaxes/noir.tmLanguage.json +++ b/syntaxes/noir.tmLanguage.json @@ -99,8 +99,7 @@ }, "patterns": [ { - "match": "[a-zA-Z_(::)][a-zA-Z0-9_]*", - "name": "support.type.nr" + "include": "#code" } ] }, @@ -233,7 +232,7 @@ }, { "name": "keyword.nr", - "match": "\\b(global|comptime|quote|unsafe|unconstrained|pub|&mut|mut|self|in|as|let)\\b" + "match": "\\b(global|comptime|quote|unsafe|unconstrained|pub|crate|&mut|mut|self|in|as|let)\\b" } ] }, @@ -248,11 +247,18 @@ "match": "\\b(_*[A-Z][a-zA-Z0-9_]*|[a-zA-Z_][a-zA-Z0-9_]*::)\\b" }, { - "begin": "\\b([a-z_][a-zA-Z0-9_]*)\\s*\\(", + "begin": "\\b([a-z_][a-zA-Z0-9_]*)\\s*(::<(.*)>\\s*)?\\(", "end": "\\)", "beginCaptures": { "1": { "name": "support.function.nr" + }, + "2": { + "patterns": [ + { + "include": "#code" + } + ] } }, "patterns": [ @@ -270,15 +276,15 @@ "--struct-content": { "patterns": [ { - "begin": "[a-zA-Z_][a-zA-Z0-9_]*", - "end": "([a-zA-Z_][a-zA-Z0-9_]*)|,", - "beginCaptures": { - "0": { - "name": "support.type.property-name.nr" - } - }, - "endCaptures": { + "match": "(pub|pub\\(crate\\))?\\s*([a-zA-Z_][a-zA-Z0-9_]*)\\s*:\\s*([a-zA-Z_][a-zA-Z0-9_]*)", + "captures": { "1": { + "name": "keyword.nr" + }, + "2": { + "name": "support.type.property-name.nr" + }, + "3": { "name": "support.type.nr" } },