-
-
Notifications
You must be signed in to change notification settings - Fork 223
Description
Describe the bug
Hello,
I have an issue with a monorepo setup for typescript, I'm unsure if I've set any configs up incorrectly but I've tried several variations with no avail. This is using a PNPM workspace setup.
When I have several projects in a mono repo (using vs code multi root workspaces or a single workspace), accessing a Typescript file from one project, then a typescript file from another project causes the TS server to crash and reset.
I encounter this issue fairly frequently and often don't notice until the svelte intellisense stops working completely and i have to restart the svelte language service.
I've narrowed this down to an error I think to do with removing files from the project cache.
Info 844 [00:55:04.119] -Svelte Plugin- File is being removed. Delete from cache: c:/Users/{{OMMITEDD}}/source/repos/svelte-typescript-issue/apps/web/node_modules/@sveltejs/kit/src/runtime/components/error.svelte
Err 845 [00:55:04.126] Exception on executing command {
"seq": 3,
"type": "request",
"command": "updateOpen",
"arguments": {
"changedFiles": [],
"closedFiles": [
"c:\\Users\\{{OMMITEDD}}\\source\\repos\\svelte-typescript-issue\\apps\\web\\src\\lib\\index.ts"
],
"openFiles": [
{
"file": "c:\\Users\\{{OMMITEDD}}\\source\\repos\\svelte-typescript-issue\\apps\\portal\\src\\lib\\index.ts",
"fileContent": "// place files you want to import through the `$lib` alias in this folder.\r\n",
"projectRootPath": "c:\\Users\\{{OMMITEDD}}\\source\\repos\\svelte-typescript-issue",
"scriptKindName": "TS"
}
]
}
}:
Cannot read properties of undefined (reading 'removeResolutionsOfFile')
TypeError: Cannot read properties of undefined (reading 'removeResolutionsOfFile')
at ConfiguredProject2.removeFile (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:174295:28)
at project.removeFile (c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\module-loader.js:74:16)
at ProjectSvelteFilesManager.removeFileFromProject (c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\project-svelte-files.js:121:26)
at c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\project-svelte-files.js:127:65
at Map.forEach (<anonymous>)
at ProjectSvelteFilesManager.disposeWatchersAndFiles (c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\project-svelte-files.js:127:42)
at ProjectSvelteFilesManager.dispose (c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\project-svelte-files.js:131:14)
at c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\index.js:106:185
at ls.dispose (c:\Users\{{OMMITEDD}}\.vscode\extensions\svelte.svelte-vscode-107.10.0\node_modules\typescript-svelte-plugin\dist\src\language-service\index.js:82:9)
at ConfiguredProject2.close (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:174156:26)
at ConfiguredProject2.close (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:175693:11)
at _ProjectService.removeProject (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:176697:13)
at c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:178476:58
at Map.forEach (<anonymous>)
at _ProjectService.removeOrphanConfiguredProjects (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:178476:32)
at _ProjectService.cleanupAfterOpeningFile (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:178429:10)
at _ProjectService.applyChangesInOpenFiles (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:178604:12)
at updateOpen (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:179778:29)
at c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:182351:69
at IpcIOSession.executeWithRequestId (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:182343:14)
at IpcIOSession.executeCommand (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:182351:29)
at IpcIOSession.onMessage (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:182393:51)
at process.<anonymous> (c:\Users\{{OMMITEDD}}\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\tsserver.js:183973:14)
at process.emit (node:events:513:28)
at emit (node:internal/child_process:967:14)
at process.processTicksAndRejections (node:internal/process/task_queues:84:21)
Reproduction
https://github.com/datstarkey/svelte-typescript-issue
reproduction repo with instructions:
Run
pnpm i
With no files open and Typescript logging enabled open
packages/ui/src/lib/index.ts
then open
apps/web/src/lib/index.ts
Note the errors in the typescript output.
Note: I could only see the error in the diagnostic file from 2 crashes previous to find the exception.
Expected behaviour
The ability to run a monorepo without having to restart the Svelte Language Server whenever I open a file in a different root folder.
System Info
- OS: Windows 11 -
- IDE: VS Code
- Engine: Pnpm
Which package is the issue about?
Svelte for VS Code extension, svelte-language-server
Additional Information, eg. Screenshots
I did find this issue on the typescript repo, which says it would be caused by the svelte-typescript-plugin:
microsoft/vscode#184240
However it doesn't look like this person created an issue here.