From b9b0ac0a89e394a26c33c1e72aa63935a6969cb5 Mon Sep 17 00:00:00 2001 From: LemmusLemmus <63229554+LemmusLemmus@users.noreply.github.com> Date: Mon, 24 Mar 2025 20:41:23 +0100 Subject: [PATCH] Support raw strings --- language-configuration.json | 9 ++++++++- syntaxes/nushell.tmLanguage.json | 14 +++++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/language-configuration.json b/language-configuration.json index f290b40..bb48f81 100644 --- a/language-configuration.json +++ b/language-configuration.json @@ -24,7 +24,14 @@ { "open": "'", "close": "'", "notIn": ["string", "comment"] }, { "open": "\"", "close": "\"", "notIn": ["string"] }, { "open": "`", "close": "`", "notIn": ["string", "comment"] }, - { "open": "/**", "close": " */", "notIn": ["string"] } + { "open": "/**", "close": " */", "notIn": ["string"] }, + { "open": "r#'", "close": "'#", "notIn": ["string"] }, + { "open": "r##'", "close": "'##", "notIn": ["string"] }, + { "open": "r###'", "close": "'###", "notIn": ["string"] }, + { "open": "r####'", "close": "'####", "notIn": ["string"] }, + { "open": "r#####'", "close": "'#####", "notIn": ["string"] }, + { "open": "r######'", "close": "'######", "notIn": ["string"] } + // and so on... ], // symbols that can be used to surround a selection "surroundingPairs": [ diff --git a/syntaxes/nushell.tmLanguage.json b/syntaxes/nushell.tmLanguage.json index a568329..3d119cc 100644 --- a/syntaxes/nushell.tmLanguage.json +++ b/syntaxes/nushell.tmLanguage.json @@ -20,7 +20,8 @@ { "include": "#string-double-quote" }, { "include": "#string-interpolated-double" }, { "include": "#string-interpolated-single" }, - { "include": "#string-bare" } + { "include": "#string-bare" }, + { "include": "#string-raw" } ] }, "string-escape": { @@ -31,6 +32,17 @@ "match": "[^$\\[{(\"',|#\\s|][^\\[\\]{}()\"'\\s#,|]*", "name": "string.bare.nushell" }, + "string-raw": { + "begin": "(?<=r)(#+)'", + "beginCaptures": { + "0": { "name": "punctuation.definition.string.begin.nushell" } + }, + "end": "'\\1", + "endCaptures": { + "0": { "name": "punctuation.definition.string.end.nushell" } + }, + "name": "string.raw.nushell" + }, "string-single-quote": { "begin": "'", "beginCaptures": {