From 89c001b5ccf5fe5c69d229ee4872234e84203603 Mon Sep 17 00:00:00 2001 From: "Lyu, Wei-Da" <36730922+jasonlyu123@users.noreply.github.com> Date: Tue, 10 Dec 2024 04:51:36 +0800 Subject: [PATCH] fix: don't patch solution project in ts plugin (#2617) part of #2612 --- 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');