Refactor confused format detection method names
Some checks are pending
MSBuild / build (push) Waiting to run
MSBuild / publish (push) Blocked by required conditions

This commit is contained in:
ema
2025-07-09 04:27:50 +08:00
parent 345b061a8d
commit 0bb6e622f6
2 changed files with 4 additions and 4 deletions

View File

@@ -33,13 +33,13 @@ public class FormatDetector
//new DockerfileDetector(),
];
public static IConfusedFormatDetector ResolveConfusedFormat(string path, string text)
public static IFormatDetector Confuse(string path, string text)
{
if (string.IsNullOrWhiteSpace(text)) return null;
return Instance.TextDetectors
.Where(detector => detector is IConfusedFormatDetector && detector.Detect(path, text))
.FirstOrDefault() as IConfusedFormatDetector;
.FirstOrDefault();
}
public static IFormatDetector Detect(string path, string text)

View File

@@ -49,7 +49,7 @@ public class HighlightingThemeManager
var useFormatDetector = SettingHelper.Get("UseFormatDetector", true, "QuickLook.Plugin.TextViewer");
var highlightingTheme = GetDefinitionByExtension(nameof(Dark), extension);
if (useFormatDetector && FormatDetector.ResolveConfusedFormat(path, text) is IConfusedFormatDetector confusedFormatDetector)
if (useFormatDetector && FormatDetector.Confuse(path, text) is IFormatDetector confusedFormatDetector)
{
if (!string.IsNullOrEmpty(confusedFormatDetector.Extension))
{
@@ -77,7 +77,7 @@ public class HighlightingThemeManager
}
}
// Unsupported highlighting
// The unsupported highlighting will be fallback to not highlighted text
highlightingTheme ??= GetDefinitionByExtension(nameof(Dark), ".txt")
?? GetDefinitionByExtension(nameof(Light), ".txt")
?? HighlightingTheme.Default;