From 5378f8de2c8a2aa964e0bdcfbcd6c4ea8f7d6813 Mon Sep 17 00:00:00 2001 From: Ionite Date: Sat, 19 Aug 2023 04:39:10 -0400 Subject: [PATCH] Escape character syntax support --- .../Assets/ImagePrompt.tmLanguage.json | 26 ++++++++++++++++++- .../Assets/ThemeMatrixDark.json | 16 ++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json b/StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json index 087d4609..00437c4a 100644 --- a/StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json +++ b/StabilityMatrix.Avalonia/Assets/ImagePrompt.tmLanguage.json @@ -16,6 +16,27 @@ "match": "(#).*$\\n?", "name": "comment.line.number-sign.prompt" }, + "escape": { + "begin": "\\\\", + "beginCaptures": { + "0": { + "name": "constant.character.escape.prompt" + } + }, + "end": "[-+.!(){}\\[\\]<\\>]", + "endCaptures": { + "0": { + "name": "constant.character.escape.target.prompt" + } + }, + "name": "meta.structure.escape.prompt", + "patterns": [ + { + "match": "[^-+.!(){}\\[\\]<\\>]", + "name": "invalid.illegal.escape.prompt" + } + ] + }, "parenthesized": { "begin": "\\(", "beginCaptures": { @@ -121,7 +142,7 @@ "name": "meta.embedded.whitespace" }, "text": { - "match": "[^,:\\[\\]\\(\\) ]+", + "match": "[^,:\\[\\]\\(\\) \\\\]+", "name": "meta.embedded" }, "value": { @@ -129,6 +150,9 @@ { "include": "#comment" }, + { + "include": "#escape" + }, { "include": "#parenthesized" }, diff --git a/StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json b/StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json index 79fbb600..590ccbf8 100644 --- a/StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json +++ b/StabilityMatrix.Avalonia/Assets/ThemeMatrixDark.json @@ -116,6 +116,22 @@ "foreground": "#408080" } }, + { + "name": "Escape character", + "scope": "constant.character.escape", + "settings": { + "fontStyle": "", + "foreground": "#408080" + } + }, + { + "name": "Escape sequence target", + "scope": "constant.character.escape.target", + "settings": { + "fontStyle": "", + "foreground": "#C5C8C6" + } + }, { "name": "User-defined constant", "scope": "constant.character, constant.other",