Skip to content

LS crash when switching to script lang "ts" from "js" in "typeScriptPluginOnly" hybrid mode #5126

Open
@Tenrys

Description

Vue - Official extension or vue-tsc version

2.2.0

VSCode version

1.96.3

Vue version

3.5.13

TypeScript version

5.7.2

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i9-13900H
    Memory: 7.79 GB / 31.68 GB
  Binaries:
    Node: 22.12.0 - ~\AppData\Local\fnm_multishells\32084_1736850645373\node.EXE
    Yarn: 1.22.22 - ~\AppData\Local\fnm_multishells\32084_1736850645373\yarn.CMD
    npm: 10.9.0 - ~\AppData\Local\fnm_multishells\32084_1736850645373\npm.CMD
    pnpm: 9.15.0 - ~\AppData\Local\fnm_multishells\32084_1736850645373\pnpm.CMD
    bun: 1.1.42 - F:\Projects\nuxt-dashboard\node_modules\.bin\bun.EXE
  Browsers:
    Edge: Chromium (131.0.2903.99)
    Internet Explorer: 11.0.26100.1882

package.json dependencies

"dependencies": {
	"@aws-sdk/client-s3": "^3.723.0",
	"@etalab/decoupage-administratif": "^4.0.0",
	"@formkit/auto-animate": "^0.8.2",
	"@fortawesome/fontawesome-pro": "^6.7.2",
	"@getbrevo/brevo": "^2.2.0",
	"@googlemaps/google-maps-services-js": "^3.4.0",
	"@homki-immobilier/apis": "0.0.2",
	"@homki-immobilier/prisma-client": "^0.1.8",
	"@quasar/extras": "^1.16.15",
	"@vueuse/components": "^12.3.0",
	"@vueuse/integrations": "^12.4.0",
	"@vueuse/nuxt": "^12.3.0",
	"@vueuse/router": "^12.3.0",
	"animejs": "^3.2.2",
	"content-disposition": "^0.5.4",
	"dayjs": "^1.11.13",
	"dompurify": "^3.2.3",
	"escape-string-regexp": "^5.0.0",
	"file-saver": "^2.0.5",
	"fuse.js": "^7.0.0",
	"jszip": "^3.10.1",
	"libphonenumber-js": "^1.11.17",
	"lodash-es": "^4.17.21",
	"mime-types": "^2.1.35",
	"nuxt": "^3.15.1",
	"nuxt-time": "^1.0.2",
	"quasar": "^2.17.6",
	"string-ts": "^2.2.0",
	"uuid": "^11.0.3",
	"valibot": "0.42.1",
	"vue": "^3.5.13",
	"vue-component-type-helpers": "^2.2.0",
	"vue-currency-input": "^3.1.0",
	"vue-google-maps-community-fork": "^0.3.1",
	"vue-router": "^4.4.5",
	"vue3-carousel": "^0.12.0",
	"vuedraggable": "^2.24.3"
},
"devDependencies": {
	"@clickbar/dot-diver": "^1.0.7",
	"@eslint/eslintrc": "^3.1.0",
	"@eslint/js": "^9.14.0",
	"@homki-immobilier/utils": "0.0.2",
	"@nuxt/devtools": "^1.6.0",
	"@nuxt/eslint": "^0.7.1",
	"@nuxt/test-utils": "^3.15.1",
	"@nuxtjs/device": "^3.2.4",
	"@pinia-plugin-persistedstate/nuxt": "^1.2.1",
	"@types/animejs": "^3.1.12",
	"@types/bun": "^1.1.15",
	"@types/dompurify": "^3.0.5",
	"@types/eslint__js": "^8.42.3",
	"@types/lodash-es": "^4.17.12",
	"@types/uuid": "^10.0.0",
	"@typescript-eslint/eslint-plugin": "^8.19.1",
	"@typescript-eslint/parser": "^8.19.1",
	"@vue/test-utils": "^2.4.6",
	"bun": "^1.1.42",
	"eslint": "^9.17.0",
	"eslint-plugin-import-x": "^4.6.1",
	"eslint-plugin-no-relative-import-paths": "^1.6.1",
	"eslint-plugin-prettier": "^5.2.1",
	"eslint-plugin-unused-imports": "^4.1.4",
	"eslint-plugin-vue": "^9.30.0",
	"happy-dom": "^16.5.2",
	"nitropack": "^2.10.4",
	"nuxt-quasar-ui": "^2.1.9",
	"prettier": "^3.3.3",
	"prisma-nitro-patcher": "^0.0.11",
	"rollup-plugin-typescript2": "^0.36.0",
	"sass-embedded": "^1.83.1",
	"ts-node": "^10.9.2",
	"ts-patch": "^3.3.0",
	"ts-toolbelt": "^9.6.0",
	"ts-xor": "^1.3.0",
	"type-fest": "^4.31.0",
	"typedots": "^0.0.4",
	"typesafe-utils": "^1.16.2",
	"typescript": "5.7.2",
	"vite-plugin-eslint2": "^5.0.2",
	"vite-tsconfig-paths": "^5.1.4",
	"vitest": "^2.1.4"
},

Steps to reproduce

Set Volar to use the Hybrid Mode to typeScriptPluginOnly, and create a .vue file, with a script setup tag.

Add some code inside, then add the lang="ts" attribute to the script tag. Type some more code, and it shouldn't take very long for this to show up:

Image

If it doesn't happen for some reason, maybe add a template tag too with some dummy code and try it again.

What is expected?

I should be able to just change the language used in the script tag without any crashes. At the moment, I'm forced to restart the extension host every time.

What is actually happening?

Language service plugin "typescript-semantic" (0) failed to provide document feature for volar-embedded-content://script_ts/file%253A%252F%252F%252Ff%25253A%252FProjects%252Fnuxt-dashboard%252Fcomponents%252Ftunnels%252Fnew-offer%252FVisitSelectStep.vue. Error: Debug Failure. False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 1, !entry: false
    at getDocumentRegistryEntry (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142568:11)
    at acquireOrUpdateDocument (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142598:32)
    at Object.acquireDocumentWithKey (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142534:12)
    at getOrCreateSourceFileByPath (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:151547:31)
    at Object.getOrCreateSourceFile (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:151526:14)
    at c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:151447:42
    at Object.getSourceFileWithCache [as getSourceFile] (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:124871:24)
    at findSourceFileWorker (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:127322:23)
    at findSourceFile (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:127238:20)
    at processImportedModules (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:127638:11)
Language service plugin "vue-template (html)" (8) failed to provide document feature for volar-embedded-content://template/file%253A%252F%252F%252Ff%25253A%252FProjects%252Fnuxt-dashboard%252Fcomponents%252Ftunnels%252FAllotmentList.vue. TypeError: Cannot read properties of undefined (reading 'getSourceFile')
    at _p (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:12980:7014)
    at sge (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:12980:6356)
    at Object.Y4 (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:12986:1221)
    at Object.provideDocumentSemanticTokens (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:13028:3829)
    at c.map.p.start.line (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:37:63871)
    at c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:37:25832
    at WS (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:37:26041)
    at u (c:\Users\bell\.vscode\extensions\vue.volar-2.2.0\dist\server.js:37:25825)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at process.processImmediate (node:internal/timers:454:9)
c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142568
    Debug.assert(scriptKind === void 0 || !entry || entry.sourceFile.scriptKind === scriptKind, `Script kind should match provided ScriptKind:${scriptKind} and sourceFile.scriptKind: ${entry == null ? void 0 : entry.sourceFile.scriptKind}, !entry: ${!entry}`);
          ^

Error: Debug Failure. False expression: Script kind should match provided ScriptKind:3 and sourceFile.scriptKind: 1, !entry: false
    at getDocumentRegistryEntry (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142568:11)
    at acquireOrUpdateDocument (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142598:32)
    at Object.acquireDocumentWithKey (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:142534:12)
    at getOrCreateSourceFileByPath (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:151547:31)
    at Object.getOrCreateSourceFile (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:151526:14)
    at c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:151447:42
    at Object.getSourceFileWithCache [as getSourceFile] (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:124871:24)
    at findSourceFileWorker (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:127322:23)
    at findSourceFile (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:127238:20)
    at processImportedModules (c:\Users\bell\AppData\Local\Programs\Microsoft VS Code\resources\app\extensions\node_modules\typescript\lib\typescript.js:127638:11)

Node.js v20.18.1
[Error - 1:03:49 PM] Client Vue: connection to server is erroring.
Channel closed

It's happened multiple times in multiple files, so I don't think this is my fault.

Link to minimal reproduction

No response

Any additional comments?

The reason I'm currently choosing to use the typeScriptPluginOnly setting on Hybrid Mode is because I've noticed it makes my LSP experience significantly faster.

The only downside I've noticed so far is that it can't keep track of new files added to my project that way, and I have to manually import them or restart the extension host.

But if that's all I can find for now, it's miles better than the sluggish experience of full Hybrid Mode. I just can't get it to work smoothly with my project. I blame the usage of Nuxt auto-imports alongside my large auto-generated Prisma client, but I have no alternatives right now.

Metadata

Assignees

No one assigned

    Labels

    good reproduction ✨This issue provides a good reproduction, we will be able to investigate it first🔨 p3-minor-bug

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions