vuejs / language-tools

⚡ High-performance Vue language tooling based-on Volar.js
https://marketplace.visualstudio.com/items?itemName=Vue.volar
MIT License
5.87k stars 402 forks source link

Type assertions in template will break syntax highlighting #5012

Closed s3xysteak closed 2 days ago

s3xysteak commented 2 days ago

Vue - Official extension or vue-tsc version

v2.1.10

VSCode version

1.95.3

Vue version

3.5.13

TypeScript version

5.6.3

System Info

System:
    OS: Windows 10 10.0.19045
    CPU: (8) x64 Intel(R) Core(TM) i3-10100 CPU @ 3.60GHz
    Memory: 4.56 GB / 15.90 GB
  Binaries:
    Node: 22.11.0 - ~\AppData\Local\fnm_multishells\4140_1732006155826\node.EXE
    npm: 10.9.0 - ~\AppData\Local\fnm_multishells\4140_1732006155826\npm.CMD
    pnpm: 9.13.2 - ~\AppData\Local\pnpm\pnpm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.19041.4355

package.json dependencies

"dependencies": {
    "@s3xysteak/utils": "^0.9.0",
    "@vueuse/core": "^11.2.0"
  },
  "devDependencies": {
    "@antfu/eslint-config": "^3.9.2",
    "@tsconfig/node20": "^20.1.4",
    "@types/fs-extra": "^11.0.4",
    "@types/node": "^22.9.0",
    "@unocss/reset": "^0.62.4",
    "@unocss/transformer-directives": "^0.62.4",
    "@vitejs/plugin-vue": "^5.2.0",
    "@vue/test-utils": "^2.4.6",
    "@vue/tsconfig": "^0.5.1",
    "bumpp": "^9.8.1",
    "cesium": "^1.123.1",
    "consola": "^3.2.3",
    "eslint": "^9.15.0",
    "fs-extra": "^11.2.0",
    "jsdom": "^25.0.1",
    "markdown-it-mathjax3": "^4.3.2",
    "npm-run-all2": "^6.2.6",
    "pathe": "^1.1.2",
    "prettier": "^3.3.3",
    "typescript": "^5.6.3",
    "unocss": "^0.62.4",
    "unplugin-export-collector": "^0.6.0",
    "unplugin-vue-components": "^0.27.4",
    "vite": "^5.4.11",
    "vite-plugin-dts": "4.2.1",
    "vite-plugin-static-copy": "^1.0.6",
    "vitepress": "1.3.4",
    "vitest": "^2.1.5",
    "vue": "^3.5.13",
    "vue-router": "^4.4.5",
    "vue-tsc": "^2.1.10"
  },

Steps to reproduce

Use code below and you can see the wrong syntax highlight:

  <div v-for="i in list as string[]" :key="i">
    hello {{ i }}
  </div>

What is expected?

Syntax highlighting should work well.

What is actually happening?

image

Link to minimal reproduction

No response

Any additional comments?

No response

KazariEX commented 2 days ago

Duplicate of #520