Reuse shared scenario syntax highlighting

This commit is contained in:
cthangover committed 2026-10-26 20:22:58 +03:00
1 parent 7b699a642b
commit 8150743e3b
1 file changed
+3 -22
+3 -22
View File
@@ -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
/// </summary>
public static class StudioSyntax
{
/// <summary>
/// Highlighter for the inline text editor with the same palette: every
/// registered command word (plus <c>select</c>/<c>option</c>) gold, quoted
/// text ink, comments faint, <c>:labels</c> teal.
/// </summary>
/// <summary>Uses the same scenario syntax as the full editor and embedded command fields.</summary>
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)
{