fix(reference): bound Dockerfile language detection

This commit is contained in:
Kaoru0822
2026-10-06 00:03:29 -07:00
parent e60aa11108
commit 53fa55937f
3 changed files with 171 additions and 4 deletions
+3 -4
View File
@@ -321,11 +321,10 @@ const isPathUnderAny = (path: string, names: ReadonlySet<string>): boolean => {
/** Detect a source language from a POSIX path. */
export const detectReferenceSourceLanguage = (path: string): string | null => {
const filename = posix.basename(path);
if (filename === "Dockerfile" || filename.startsWith("Dockerfile."))
return "Dockerfile";
if (filename.toLowerCase().startsWith("dockerfile")) return "Dockerfile";
const lower = filename.toLowerCase();
if (lower === "dockerfile" || lower.startsWith("dockerfile."))
return "Dockerfile";
if (lower.endsWith(".d.ts")) return "TypeScript";
if (lower.endsWith(".d.mts")) return "TypeScript";
if (lower.endsWith(".d.cts")) return "TypeScript";