Reuse shared scenario syntax highlighting
This commit is contained in:
1 parent
7b699a642b
commit
8150743e3b
1 file changed
+3
-22
@@ -2,6 +2,7 @@ namespace Cthangover.Mods.ScenarioStudio
|
|||||||
{
|
{
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Cthangover.Core.UI.Theming;
|
using Cthangover.Core.UI.Theming;
|
||||||
|
using Cthangover.Mods.Interface.Theming;
|
||||||
using Cthangover.Mods.Dialog.Scenarios;
|
using Cthangover.Mods.Dialog.Scenarios;
|
||||||
using Godot;
|
using Godot;
|
||||||
|
|
||||||
@@ -15,29 +16,9 @@ namespace Cthangover.Mods.ScenarioStudio
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static class StudioSyntax
|
public static class StudioSyntax
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>Uses the same scenario syntax as the full editor and embedded command fields.</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>
|
|
||||||
public static CodeHighlighter CreateHighlighter()
|
public static CodeHighlighter CreateHighlighter()
|
||||||
{
|
=> SourceSyntax.CreateScenarioHighlighter(ScenarioCommandStrategyFactory.GetAllCommandNames());
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static string ToBbCode(string line)
|
public static string ToBbCode(string line)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user