From 8150743e3b7f175ef047bccd0a70596b4aad1ccb Mon Sep 17 00:00:00 2001 From: iisaev Date: Mon, 26 Oct 2026 20:22:58 +0300 Subject: [PATCH] Reuse shared scenario syntax highlighting --- src/Views/StudioSyntax.cs | 25 +++---------------------- 1 file changed, 3 insertions(+), 22 deletions(-) diff --git a/src/Views/StudioSyntax.cs b/src/Views/StudioSyntax.cs index 9408b40..d2f0d2c 100644 --- a/src/Views/StudioSyntax.cs +++ b/src/Views/StudioSyntax.cs @@ -2,6 +2,7 @@ namespace Cthangover.Mods.ScenarioStudio { using System.Text; using Cthangover.Core.UI.Theming; + using Cthangover.Mods.Interface.Theming; using Cthangover.Mods.Dialog.Scenarios; using Godot; @@ -15,29 +16,9 @@ namespace Cthangover.Mods.ScenarioStudio /// public static class StudioSyntax { - /// - /// Highlighter for the inline text editor with the same palette: every - /// registered command word (plus select/option) gold, quoted - /// text ink, comments faint, :labels teal. - /// + /// Uses the same scenario syntax as the full editor and embedded command fields. public static CodeHighlighter CreateHighlighter() - { - var highlighter = new CodeHighlighter - { - NumberColor = UiTokens.Body, - SymbolColor = UiTokens.Muted, - FunctionColor = UiTokens.Body, - MemberVariableColor = UiTokens.Body, - }; - foreach (var command in ScenarioCommandStrategyFactory.GetAllCommandNames()) - highlighter.AddKeywordColor(command, UiTokens.AccentBright); - highlighter.AddKeywordColor("select", UiTokens.AccentBright); - highlighter.AddKeywordColor("option", UiTokens.AccentBright); - highlighter.AddColorRegion("\"", "\"", UiTokens.Ink); - highlighter.AddColorRegion("#", "", UiTokens.Faint, true); - highlighter.AddColorRegion(":", " ", UiTokens.TypeTarget, true); - return highlighter; - } + => SourceSyntax.CreateScenarioHighlighter(ScenarioCommandStrategyFactory.GetAllCommandNames()); public static string ToBbCode(string line) {