vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js

Home Page:https://marketplace.visualstudio.com/items?itemName=Vue.volar

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error: VirtualCode id must be lowercase: scriptSetupFormat

davidmatter opened this issue · comments

Vue - Official extension or vue-tsc version

2.0.22

VSCode version

Vue version

3.4.30

TypeScript version

5.5.2

System Info

System:
    OS: macOS 14.5
    CPU: (8) arm64 Apple M1 Pro
    Memory: 57.80 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.3.0 - ~/Code/data-visualization/packages/rds/node_modules/.bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 10.8.1 - ~/.nvm/versions/node/v22.3.0/bin/npm
    pnpm: 9.4.0 - ~/.nvm/versions/node/v22.3.0/bin/pnpm
    bun: 1.1.15 - /opt/homebrew/bin/bun
  Browsers:
    Chrome: 126.0.6478.63
    Safari: 17.5

Steps to reproduce

  1. pnpm create vite@latest -> Vue project with TS
  2. pnpm update
  3. vue-tsc --declaration --emitDeclarationOnly -p tsconfig.app.json

Throws:
Error: VirtualCode id must be lowercase: scriptSetupFormat

same error.
image

Same error as @chaozwn also on neovim, mac M2 (and I believe my Ubuntu (noble) machine suffered the same error). vue-language-server version 2.0.22.

I have tried different node LTS versions as well as the latest with no success. Tried creating a new Vue project with npm create vue@latest with the hope that my project with the issue, but same error on a fresh project (default options, 'no' to everything).

Edit:
Just tried rolling back incrementally from 2.0.22, and found that 2.0.19 is working for me, but I experience the same error from 2.0.20 onward. The error that @chaozwn experienced is also accompanied by a typescript server error that is first thrown to screen as I configure the tsserver LS in neovim to use the @vue/typescript-plugin.

tsserver: 1: TypeScript Server Error (5.5.2)
Cannot read properties of undefined (reading 'getSourceFile')
TypeError: Cannot read properties of undefined (reading 'getSourceFile')
at /Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:149234:82
at mapDefined (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:2699:22)
at getDocumentHighlights (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:149234:33)
at /Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib/node/decorateLanguageService.js:299:13
2
at process (/Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib/node/decorateLanguageService.
js:757:28)
at linkedCodeFeatureWorker (/Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib/node/decorate
LanguageService.js:749:13)
at languageService.getDocumentHighlights (/Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib
/node/decorateLanguageService.js:299:28)
at IpcIOSession.getDocumentHighlights (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:190174:61)
at documentHighlights (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:189140:43)
at /Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191397:69
at IpcIOSession.executeWithRequestId (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191389:14)
at IpcIOSession.executeCommand (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191397:29)
at IpcIOSession.onMessage (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191439:51)
at process. (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/tsserver.js:523:14)
at process.emit (node:events:515:28)
at emit (node:internal/child_process:951:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

+1

@lancewilhelm you're right. The issue is in a dependency that will be installed above 2.0.19. You might want to try using version 2.0.19 along typescript@^5.4.0

commented

Same error as @lancewilhelm also on neovim, arch linux.

I got the error when I update vue-language-server from 2.0.21 to 2.0.22 with mason.

tsserver: 1: TypeScript Server Error (5.5.2)
Cannot read properties of undefined (reading 'getSourceFile')
TypeError: Cannot read properties of undefined (reading 'getSourceFile')
at /Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:149234:82
at mapDefined (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:2699:22)
at getDocumentHighlights (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:149234:33)
at /Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib/node/decorateLanguageService.js:299:13
2
at process (/Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib/node/decorateLanguageService.
js:757:28)
at linkedCodeFeatureWorker (/Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib/node/decorate
LanguageService.js:749:13)
at languageService.getDocumentHighlights (/Users/lancewilhelm/.local/share/nvim/mason/packages/vue-language-server/node_modules/@vue/language-server/node_modules/@volar/typescript/lib
/node/decorateLanguageService.js:299:28)
at IpcIOSession.getDocumentHighlights (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:190174:61)
at documentHighlights (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:189140:43)
at /Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191397:69
at IpcIOSession.executeWithRequestId (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191389:14)
at IpcIOSession.executeCommand (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191397:29)
at IpcIOSession.onMessage (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/typescript.js:191439:51)
at process. (/Users/lancewilhelm/Projects/qua/node_modules/typescript/lib/tsserver.js:523:14)
at process.emit (node:events:515:28)
at emit (node:internal/child_process:951:14)
at process.processTicksAndRejections (node:internal/process/task_queues:83:21)

Edit: Not needed anymore, just update your dependencies.

Workaround: Add the following to your package.json if you're using pnpm

"pnpm": {
  "overrides": {
    "@volar/typescript": "2.3.1",
    "@volar/language-core": "2.3.1"
  }
}

For NPM, Yarn etc. you'll find other solutions.

Thanks for the report! This should fixed in @volar/* v2.3.3.

Workaround: Add the following to your package.json if you're using pnpm

"pnpm": {
  "overrides": {
    "@volar/typescript": "2.3.1",
    "@volar/language-core": "2.3.1"
  }
}

For NPM, Yarn etc. you'll find other solutions.

And then run pnpm i

@yenche123 this is not needed anymore. Just update your dependencies :)

Edit: Not needed anymore, just update your dependencies.

Workaround: Add the following to your package.json if you're using pnpm

"pnpm": {
  "overrides": {
    "@volar/typescript": "2.3.1",
    "@volar/language-core": "2.3.1"
  }
}

For NPM, Yarn etc. you'll find other solutions.

what should be added if using npm?

Edit: Not needed anymore, just update your dependencies.
Workaround: Add the following to your package.json if you're using pnpm

"pnpm": {
  "overrides": {
    "@volar/typescript": "2.3.1",
    "@volar/language-core": "2.3.1"
  }
}

For NPM, Yarn etc. you'll find other solutions.

what should be added if using npm?

 "overrides": {
    "@volar/typescript": "2.3.1",
    "@volar/language-core": "2.3.1"
  }

then run npm install