chore: housekeeping — linter & formatter setup
Add .prettierrc.json, .markdownlint.json, .yamllint.yaml, .gitattributes Run CSharpier, Prettier and markdownlint across the entire codebase. No logic changes — formatting, using order and line endings only.
This commit is contained in:
@@ -7,7 +7,9 @@ public sealed class ThemeRegistry
|
||||
public const string DefaultSlug = HellionArctic.Slug;
|
||||
|
||||
private readonly Dictionary<string, Theme> _builtIns;
|
||||
private readonly Dictionary<string, (Theme Theme, DateTime Stamp)> _customCache = new(StringComparer.OrdinalIgnoreCase);
|
||||
private readonly Dictionary<string, (Theme Theme, DateTime Stamp)> _customCache = new(
|
||||
StringComparer.OrdinalIgnoreCase
|
||||
);
|
||||
private readonly string? _customThemesDir;
|
||||
private Theme _active;
|
||||
|
||||
@@ -15,16 +17,16 @@ public sealed class ThemeRegistry
|
||||
{
|
||||
_builtIns = new Dictionary<string, Theme>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
{ HellionArctic.Slug, HellionArctic.Build() },
|
||||
{ HellionSpectrum.Slug, HellionSpectrum.Build() },
|
||||
{ Chat2Classic.Slug, Chat2Classic.Build() },
|
||||
{ EventHorizon.Slug, EventHorizon.Build() },
|
||||
{ MoonlitBloom.Slug, MoonlitBloom.Build() },
|
||||
{ NightBlue.Slug, NightBlue.Build() },
|
||||
{ IndigoViolet.Slug, IndigoViolet.Build() },
|
||||
{ ForgeMerchantman.Slug, ForgeMerchantman.Build() },
|
||||
{ MintGrove.Slug, MintGrove.Build() },
|
||||
{ SynthwaveSunset.Slug, SynthwaveSunset.Build() },
|
||||
{ HellionArctic.Slug, HellionArctic.Build() },
|
||||
{ HellionSpectrum.Slug, HellionSpectrum.Build() },
|
||||
{ Chat2Classic.Slug, Chat2Classic.Build() },
|
||||
{ EventHorizon.Slug, EventHorizon.Build() },
|
||||
{ MoonlitBloom.Slug, MoonlitBloom.Build() },
|
||||
{ NightBlue.Slug, NightBlue.Build() },
|
||||
{ IndigoViolet.Slug, IndigoViolet.Build() },
|
||||
{ ForgeMerchantman.Slug, ForgeMerchantman.Build() },
|
||||
{ MintGrove.Slug, MintGrove.Build() },
|
||||
{ SynthwaveSunset.Slug, SynthwaveSunset.Build() },
|
||||
};
|
||||
|
||||
// Centralised so the ten .Build() factories stay free of cache plumbing.
|
||||
@@ -39,10 +41,12 @@ public sealed class ThemeRegistry
|
||||
|
||||
public Theme Get(string slug)
|
||||
{
|
||||
if (_builtIns.TryGetValue(slug, out var b)) return b;
|
||||
if (_builtIns.TryGetValue(slug, out var b))
|
||||
return b;
|
||||
|
||||
var custom = LoadCustomBySlug(slug);
|
||||
if (custom != null) return custom;
|
||||
if (custom != null)
|
||||
return custom;
|
||||
|
||||
return _builtIns[DefaultSlug];
|
||||
}
|
||||
@@ -75,8 +79,10 @@ public sealed class ThemeRegistry
|
||||
// neu eingelesen.
|
||||
private Theme? LoadCustomBySlug(string slug)
|
||||
{
|
||||
if (_customThemesDir is null) return null;
|
||||
if (!Directory.Exists(_customThemesDir)) return null;
|
||||
if (_customThemesDir is null)
|
||||
return null;
|
||||
if (!Directory.Exists(_customThemesDir))
|
||||
return null;
|
||||
|
||||
foreach (var theme in RefreshCustomCache())
|
||||
if (string.Equals(theme.Slug, slug, StringComparison.OrdinalIgnoreCase))
|
||||
@@ -111,7 +117,9 @@ public sealed class ThemeRegistry
|
||||
{
|
||||
// Editor mid-save: keep the cached snapshot, leave the stamp
|
||||
// alone so the next refresh retries automatically.
|
||||
Plugin.Log.Debug($"Custom theme {Path.GetFileName(path)} is locked, keeping last known good");
|
||||
Plugin.Log.Debug(
|
||||
$"Custom theme {Path.GetFileName(path)} is locked, keeping last known good"
|
||||
);
|
||||
if (cached.Theme is not null)
|
||||
theme = cached.Theme;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user