vuejs/language-tools

Request textDocument/documentSymbol failed.

Closed this issue · 16 comments

Vue - Official extension or vue-tsc version

2.1.8

VSCode version

1.94.2

Vue version

3.5.12

TypeScript version

5.6.3

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 13th Gen Intel(R) Core(TM) i5-13500
    Memory: 4.45 GB / 15.62 GB
  Binaries:
    Node: 20.17.0 - ~\AppData\Local\fnm_multishells\10596_1730186686651\node.EXE
    npm: 10.8.2 - ~\AppData\Local\fnm_multishells\10596_1730186686651\npm.CMD
    pnpm: 9.6.0 - C:\Program Files\nodejs\pnpm.CMD
  Browsers:
    Edge: Chromium (129.0.2792.79)
    Internet Explorer: 11.0.26100.1882

package.json dependencies

"dependencies": {
    "@pureadmin/descriptions": "^1.2.1",
    "@pureadmin/table": "^3.2.1",
    "@pureadmin/utils": "^2.4.8",
    "@vueuse/core": "^11.1.0",
    "@vueuse/motion": "^2.2.6",
    "animate.css": "^4.1.1",
    "axios": "^1.7.7",
    "date-fns": "^4.1.0",
    "dayjs": "^1.11.13",
    "echarts": "^5.5.1",
    "element-plus": "^2.8.6",
    "js-cookie": "^3.0.5",
    "localforage": "^1.10.0",
    "lodash-es": "^4.17.21",
    "mitt": "^3.0.1",
    "naive-ui": "^2.40.1",
    "nprogress": "^0.2.0",
    "pathe": "^1.1.2",
    "pinia": "^2.2.4",
    "pinia-plugin-persistedstate": "^4.1.2",
    "pinyin-pro": "^3.25.0",
    "qs": "^6.13.0",
    "responsive-storage": "^2.2.0",
    "sortablejs": "^1.15.3",
    "tippy.js": "^6.3.7",
    "vue": "^3.5.12",
    "vue-demi": "^0.14.10",
    "vue-draggable-plus": "^0.5.4",
    "vue-router": "^4.4.5",
    "vue-tippy": "^6.5.0",
    "xlsx": "workspace:*"
  },
  "devDependencies": {
    "@commitlint/cli": "^19.5.0",
    "@commitlint/config-conventional": "^19.5.0",
    "@commitlint/types": "^19.5.0",
    "@eslint/js": "^9.13.0",
    "@iconify-icons/ep": "^1.2.12",
    "@iconify-icons/ri": "^1.2.10",
    "@iconify/types": "^2.0.0",
    "@iconify/vue": "^4.1.2",
    "@pureadmin/theme": "^3.3.0",
    "@tsconfig/node20": "^20.1.4",
    "@types/js-cookie": "^3.0.6",
    "@types/node": "^20.17.2",
    "@types/nprogress": "^0.2.3",
    "@types/qs": "^6.9.16",
    "@types/sortablejs": "^1.15.8",
    "@vitejs/plugin-vue": "^5.1.4",
    "@vitejs/plugin-vue-jsx": "^4.0.1",
    "@vue/eslint-config-prettier": "^10.1.0",
    "@vue/eslint-config-typescript": "^14.1.3",
    "@vue/tsconfig": "^0.5.1",
    "autoprefixer": "^10.4.20",
    "boxen": "^8.0.1",
    "cssnano": "^7.0.6",
    "eslint": "^9.13.0",
    "eslint-define-config": "^2.1.0",
    "eslint-plugin-vue": "^9.30.0",
    "gradient-string": "^3.0.0",
    "husky": "^9.1.6",
    "lint-staged": "^15.2.10",
    "postcss": "^8.4.47",
    "postcss-html": "^1.7.0",
    "postcss-import": "^16.1.0",
    "postcss-load-config": "^6.0.1",
    "postcss-scss": "^4.0.9",
    "prettier": "^3.3.3",
    "rimraf": "^6.0.1",
    "rollup-plugin-visualizer": "^5.12.0",
    "sass-embedded": "^1.80.4",
    "stylelint": "^16.10.0",
    "stylelint-config-recess-order": "^5.1.1",
    "stylelint-config-recommended-vue": "^1.5.0",
    "stylelint-config-standard-scss": "^13.1.0",
    "stylelint-prettier": "^5.0.2",
    "svgo": "^3.3.2",
    "tailwindcss": "^3.4.14",
    "typescript": "^5.6.3",
    "unplugin-auto-import": "^0.18.3",
    "unplugin-vue-components": "^0.27.4",
    "vite": "^5.4.10",
    "vite-plugin-cdn-import": "^1.0.1",
    "vite-plugin-compression": "^0.5.1",
    "vite-plugin-fake-server": "^2.1.2",
    "vite-plugin-remove-console": "^2.2.0",
    "vite-plugin-router-warn": "^1.0.0",
    "vite-svg-loader": "^5.1.0",
    "vue-eslint-parser": "^9.4.3",
    "vue-tsc": "^2.1.8"
  },

Steps to reproduce

I'm not sure of the exact steps, it's pretty random, but it usually happens during code removal

What is expected?

No errors will be reported.

What is actually happening?

An error occurs that I don't know how to fixAn error occurs that I don't know how to fix

Link to minimal reproduction

No response

Any additional comments?

Here's a video that illustrates what happened

2024-10-29.152230.mp4

me too

diJ1a commented

I've been in the same situation.

Would you be willing to assist us with remote investigation? https://github.com/vuejs/language-tools/wiki/Help-Us-Investigate-Issues-Remotely

R7CKB commented

same pb, don't know what to do...

I don't even think this issue needs to be remote, as I get it when I use vscode.dev to install only vue-official @KazariEX

+1

Does entering any content in <style> solve this problem for you?

@KazariEX seems to have solved the problem, but since it's not 100% reproducible I can't tell if it's due to empty style tags or not.

Not sure if it's related, but I have the same issue and at the same time I don't get any linting for v-for:

<script lang="ts" setup>
import { ref } from 'vue';
const items = ref<{ x: number }[]>([]);
</script>

<template>
  <span v-for="item in items">
    {{ item.x }}
  </span>
</template>

<style scoped>
span {
  color: black
}
</style>

Try typing . after item in {{ item.x }}, on my end there are no suggestions, it sould suggest x. If I downgrade the extension to the previous version (2.1.6) it works as expected. I can also confirm adding content to style solves the error popup in VS Code and downgrading the extension solves that problem too (doesn't matter if the style tag is empty or not).

Does anyone have a similar issue?

@ungive For unrelated problems, please open a new issue.

Inserir algum conteúdo <style>resolve esse problema para você?

Does entering any content in <style> solve this problem for you?

This solved it here...
Thanks

+1

Properly issue with

<script></script>

And

<style></style>

npm install typescript --save-dev solved issue in my case

fp024 commented

Hello.

I had a similar problem.

I tried to use "Vue Snippets" by adding the following custom Snippet:

{
  "Vue Single File Component with Css (Custom)": {
    "prefix": "vbase-css-custom",
    "body": [
      "<template>",
      "\t<div>",
      "",
      "\t</div>",
      "</template>",
      "",
      "<script>",
      "\texport default {",
      "\t\tname:\"${TM_FILENAME_BASE}\",",
      "\t\t${0}",
      "\t}",
      "</script>",
      "",
      "<style scoped>",
      "",
      "</style>"
    ],
    "description": "Base for Vue File with CSS  (Custom)"
  }
}

When I tried to use the snippet above, I kept getting the following error:

[Error - 오전 6:17:08] Request textDocument/documentSymbol failed.
Error: selectionRange must be contained in fullRange
	at Hd.validate (file:///c:/Users/{USERNAME}/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:33675)
	at new Hd (file:///c:/Users/{USERNAME}/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:108:33883)
	at dn (c:\Users\{USERNAME}\.vscode\extensions\vue.volar-2.1.8\dist\client.js:37:46612)
	at o (c:\Users\{USERNAME}\.vscode\extensions\vue.volar-2.1.8\dist\client.js:37:21036)
	at Object.NS [as map] (c:\Users\{USERNAME}\.vscode\extensions\vue.volar-2.1.8\dist\client.js:37:21122)
	at Object.pr [as asDocumentSymbols] (c:\Users\{USERNAME}\.vscode\extensions\vue.volar-2.1.8\dist\client.js:37:46579)
	at c (c:\Users\{USERNAME}\.vscode\extensions\vue.volar-2.1.8\dist\client.js:41:56059)
	at async OC.provideDocumentSymbols (file:///c:/Users/{USERNAME}/AppData/Local/Programs/Microsoft%20VS%20Code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:137:125496)

To resolve this, I added a comment to the style tag so that it wasn't empty, and the error warning disappeared:

      "<style scoped>",
      "/** Add style next time  */",
      "</style>"

Finally, I downgraded "Vue.official" to 2.1.6, and the error no longer occurred even when the "style" tag content was empty.