Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript within Vue files is unavailable at startup #5190

Closed
ludwig801 opened this issue Feb 17, 2025 · 0 comments
Closed

Typescript within Vue files is unavailable at startup #5190

ludwig801 opened this issue Feb 17, 2025 · 0 comments
Labels
duplicate This issue or pull request already exists

Comments

@ludwig801
Copy link

Vue - Official extension or vue-tsc version

2.2.2

VSCode version

1.97.2

Vue version

3.5.13

TypeScript version

5.7.3

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700H
    Memory: 20.74 GB / 31.64 GB
  Binaries:
    Node: 20.18.0 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
    npm: 10.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (131.0.2903.70)
    Internet Explorer: 11.0.26100.1882

package.json dependencies

{
  "dependencies": {
    "@primevue/themes": "^4.2.5",
    "@univerjs/presets": "^0.5.3",
    "@univerjs/sheets-crosshair-highlight": "^0.5.3",
    "@vue-flow/core": "^1.41.2",
    "buffer": "^6.0.3",
    "chart.js": "^4.4.7",
    "chartjs-chart-funnel": "^4.2.2",
    "chartjs-chart-geo": "^4.3.2",
    "chartjs-plugin-datalabels": "^2.2.0",
    "css": "^3.0.0",
    "dompurify": "^3.1.7",
    "exceljs": "^4.4.0",
    "fast-xml-parser": "^4.3.6",
    "fflate": "^0.6.2",
    "floating-vue": "^5.2.2",
    "html-validate": "^9.1.3",
    "jquery": "^3.3.1",
    "lodash-es": "^4.17.21",
    "marked": "^9.1.0",
    "monaco-editor": "^0.52.0",
    "object-hash": "^3.0.0",
    "pinia": "^2.1.7",
    "primevue": "^4.2.5",
    "stacktrace-js": "^2.0.2",
    "three": "^0.172.0",
    "uuid": "^9.0.0",
    "vite-plugin-pwa": "^0.21.1",
    "vscode-css-languageservice": "^6.3.2",
    "vue": "~3.5.13",
    "vue-advanced-chat": "^2.1.0",
    "vue-chartjs": "^5.3.1",
    "vue-i18n": "^10.0.3",
    "vue-router": "^4.4.5",
    "vuedraggable": "^4.1.0",
    "yaml": "^2.6.0"
  },
  "devDependencies": {
    "@tsconfig/node20": "^20.1.4",
    "@types/apidoc": "^0.50.0",
    "@types/css": "^0.0.38",
    "@types/glob": "^7.2.0",
    "@types/jquery": "^3.5.30",
    "@types/lodash-es": "^4.17.12",
    "@types/object-hash": "^3.0.2",
    "@types/three": "^0.172.0",
    "@types/uuid": "^9.0.1",
    "@vitejs/plugin-vue": "^5.1.4",
    "@vitest/ui": "^2.1.4",
    "@vue/compiler-sfc": "^3.1.0",
    "@vue/tsconfig": "^0.6.0",
    "apidoc": "^1.2.0",
    "autoprefixer": "^10.4.20",
    "glob": "^8.0.3",
    "less": "^4.2.0",
    "postcss": "^8.4.47",
    "prettier": "^3.5.1",
    "sass": "1.77.6",
    "tailwindcss": "^3.4.14",
    "typescript": "^5.7.3",
    "vite": "^5.4.2",
    "vite-plugin-node-polyfills": "^0.22.0",
    "vite-plugin-static-copy": "^1.0.6",
    "vitest": "^2.1.4",
    "vue-component-type-helpers": "^2.1.6",
    "vue-tsc": "^2.2.0"
  },
}

Steps to reproduce

There are several interesting behaviours:

Approach 1

  1. Open VSCode in a Vue Project without any open file
  2. Let it sit for a while
  3. Open firstly a .vue file

Approach 2

  1. Open VSCode in a Vue Project with a previously open .vue file
  2. Let project initialize

Approach 3

  1. Open VSCode in a Vue Project without any open file
  2. Open a .ts file
  3. Let project initialize
  4. Open a .vue file

Approach 4

  1. Open VSCode in a Vue Project with a previously open .ts file
  2. Let project initialize
  3. Open a .vue file

What is expected?

With any approach, the .vue files are expected to have working Typescript for anything, from intellisense to refactor, hover information, references, etc.

What is actually happening?

  • Approach 1: typescript is not detected nor initialized until you open a .ts file and even from thereon it only works in .ts files. Execution Developer: Reload Window solves it, but is a band-aid solution
  • Approach 2: typescript is initialized. Everything works as expected.
  • Approach 3: typescript is initialized. Everything works as expected.
  • Approach 4: typescript is initialized. Everything works as expected.

So, as described, approach 1 is nor working, unless Developer: Reload Window command is called.
Note that this does not happen always! Sometimes, if you're fast enough between opening VSCode and opening the first vue file, it will properly initiate. But, if you take your time (let's say, let it stay there for 4-5 seconds ) before opening the first vue file, it doesn't start the TS server, showing the following information for the vue file:

Image

Link to minimal reproduction

No response

Any additional comments?

No response

@KazariEX KazariEX added duplicate This issue or pull request already exists and removed pending triage labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants