Skip to content

Commit

Permalink
Mark syntax highlighter helper as static helper
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamparter committed Jan 19, 2025
1 parent 45c38ea commit 58ec8ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/Riverside.JsonBinder.Console/Helpers/SyntaxHighlighter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace Riverside.JsonBinder.Console.Helpers;

public class SyntaxHighlighter
public static class SyntaxHighlighter
{
private static readonly Dictionary<SerializableLanguage, List<SyntaxRule>> SyntaxRulesByLanguage = new()
{
Expand Down Expand Up @@ -217,9 +217,7 @@ public class SyntaxHighlighter
}
};



public void DisplayCodeWithColors(string code, SerializableLanguage language)
public static void DisplayCodeWithColors(string code, SerializableLanguage language)
{
if (!SyntaxRulesByLanguage.ContainsKey(language))
{
Expand Down Expand Up @@ -293,15 +291,3 @@ public void DisplayCodeWithColors(string code, SerializableLanguage language)
System.Console.WriteLine();
}
}

public class SyntaxRule
{
public string Pattern { get; }
public ConsoleColor Color { get; }

public SyntaxRule(string pattern, ConsoleColor color)
{
Pattern = pattern;
Color = color;
}
}
13 changes: 13 additions & 0 deletions src/Riverside.JsonBinder.Console/SyntaxRule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Riverside.JsonBinder.Console;

public class SyntaxRule(string pattern, ConsoleColor color)
{
public string Pattern { get; } = pattern;
public ConsoleColor Color { get; } = color;
}

0 comments on commit 58ec8ba

Please sign in to comment.