From 171fab2bdf61808ab60048cb4bb65dc40d918d2a Mon Sep 17 00:00:00 2001 From: "Lyu, Wei Da" Date: Thu, 5 Dec 2024 09:36:02 +0800 Subject: [PATCH] fix: don't patch solution project in ts plugin --- packages/typescript-plugin/src/utils.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/packages/typescript-plugin/src/utils.ts b/packages/typescript-plugin/src/utils.ts index 1b14a6dbe..71425bc31 100644 --- a/packages/typescript-plugin/src/utils.ts +++ b/packages/typescript-plugin/src/utils.ts @@ -255,6 +255,14 @@ export function hasNodeModule(startPath: string, module: string) { } export function isSvelteProject(project: ts.server.Project) { + // internal api, the way to check requires checking the files config in tsconfig.json + // so we can't reimplement it without reading the tsconfig.json again + // The solution project is mostly just a container we don't need to patch it + // and having any files in this project cause TSServer to send config error while it originally won't + if ((project as any).isSolution?.()) { + return false; + } + const projectDirectory = getProjectDirectory(project); if (projectDirectory) { return hasNodeModule(projectDirectory, 'svelte');