diff --git a/packages/language-server/src/plugins/typescript/service.ts b/packages/language-server/src/plugins/typescript/service.ts index 47321a531..4002f5c75 100644 --- a/packages/language-server/src/plugins/typescript/service.ts +++ b/packages/language-server/src/plugins/typescript/service.ts @@ -377,7 +377,7 @@ async function createLanguageService( : undefined; const changedFilesForExportCache = new Set(); - const svelteTsxFiles = getSvelteShimFiles(); + const svelteTsxFilesToOriginalCasing = getSvelteShimFiles(); let languageServiceReducedMode = false; let projectVersion = 0; @@ -700,7 +700,10 @@ async function createLanguageService( ...clientFiles.filter( (file) => !canonicalProjectFileNames.has(getCanonicalFileName(file)) ), - ...svelteTsxFiles + // Use original casing here, too: people could have their VS Code extensions in a case insensitive + // folder but their project in a case sensitive one; and if we copy the shims into the case sensitive + // part it would break when canonicalizing it. + ...svelteTsxFilesToOriginalCasing.values() ]) ); } @@ -1220,14 +1223,17 @@ async function createLanguageService( svelteTsPath, docContext.isSvelteCheck ? undefined : tsconfigPath || workspacePath ); - const result = new FileSet(tsSystem.useCaseSensitiveFileNames); + const pathToOriginalCasing = new Map(); + 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))); } }