Add MakefileDetector for text viewer

This commit is contained in:
ema
2025-07-09 03:24:42 +08:00
parent d6cc984267
commit 0a79d59c79
13 changed files with 220 additions and 14 deletions

View File

@@ -42,7 +42,7 @@ public class HighlightingThemeManager
InitCustomHighlighting();
}
public static HighlightingTheme GetHighlightingByExtensionOrDetector(string extension, string text = null)
public static HighlightingTheme GetHighlightingByExtensionOrDetector(string path, string extension, string text = null)
{
if (Light is null || Dark is null) return HighlightingTheme.Default;
@@ -56,7 +56,7 @@ public class HighlightingThemeManager
{
var useFormatDetector = SettingHelper.Get("UseFormatDetector", true, "QuickLook.Plugin.TextViewer");
if (useFormatDetector && FormatDetector.Detect(text)?.Extension is string detectExtension)
if (useFormatDetector && FormatDetector.Detect(path, text)?.Extension is string detectExtension)
{
highlightingTheme = GetDefinitionByExtension(nameof(Dark), detectExtension)
?? GetDefinitionByExtension(nameof(Light), detectExtension);