Skip to content

Commit

Permalink
fix: use original file path casing for shim files
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonlyu123 committed Nov 18, 2024
1 parent a3a6393 commit dc75171
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/language-server/src/plugins/typescript/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ async function createLanguageService(
: undefined;

const changedFilesForExportCache = new Set<string>();
const svelteTsxFiles = getSvelteShimFiles();
const svelteTsxFilesToOriginalCasing = getSvelteShimFiles();

let languageServiceReducedMode = false;
let projectVersion = 0;
Expand Down Expand Up @@ -700,7 +700,7 @@ async function createLanguageService(
...clientFiles.filter(
(file) => !canonicalProjectFileNames.has(getCanonicalFileName(file))
),
...svelteTsxFiles
...svelteTsxFilesToOriginalCasing.values()
])
);
}
Expand Down Expand Up @@ -1220,14 +1220,17 @@ async function createLanguageService(
svelteTsPath,
docContext.isSvelteCheck ? undefined : tsconfigPath || workspacePath
);
const result = new FileSet(tsSystem.useCaseSensitiveFileNames);
const pathToOriginalCasing = new Map<string, string>();
for (const file of svelteTsxFiles) {
const normalizedPath = normalizePath(file);
pathToOriginalCasing.set(getCanonicalFileName(normalizedPath), normalizedPath);
}

svelteTsxFiles.forEach((f) => result.add(normalizePath(f)));
return result;
return pathToOriginalCasing;
}

function isShimFiles(filePath: string) {
return svelteTsxFiles.has(normalizePath(filePath));
return svelteTsxFilesToOriginalCasing.has(getCanonicalFileName(normalizePath(filePath)));
}
}

Expand Down

0 comments on commit dc75171

Please sign in to comment.