Skip to content

MyComponent autocomplete incorrectly adds type import; import type MyComponentVue #5874

@mickderks

Description

@mickderks

Vue - Official extension or vue-tsc version

Vue (Official) v3.1.8

VSCode version

1.107.0

Vue version

3.5.25

TypeScript version

5.9.3

System Info

System:
  OS: Windows 11 10.0.26200
  CPU: (16) x64 AMD Ryzen 7 5800X3D 8-Core Processor
  Memory: 3.72 GB / 31.92 GB
Binaries:
  Node: 25.2.1 - C:\Program Files\nodejs\node.EXE
  Yarn: 1.22.19 - C:\Users\Username\AppData\Roaming\npm\yarn.CMD
  npm: 11.6.2 - C:\Program Files\nodejs\npm.CMD
  pnpm: 10.25.0 - C:\Users\Username\AppData\Local\pnpm\pnpm.CMD
Browsers:
  Chrome: 143.0.7499.42
  Edge: Chromium (142.0.3595.94)
  Firefox: 146.0 - C:\Program Files\Mozilla Firefox\firefox.exe
  Internet Explorer: 11.0.26100.7309

package.json dependencies

{
  "name": "projectname",
  "version": "0.0.0",
  "private": true,
  "type": "module",
  "engines": {
    "node": "^20.19.0 || >=22.12.0"
  },
  "scripts": {
    "dev": "vite",
    "build": "run-p type-check \"build-only {@}\" --",
    "preview": "vite preview",
    "test:unit": "vitest",
    "test:e2e": "nightwatch tests/e2e/*",
    "build-only": "vite build",
    "type-check": "vue-tsc --build",
    "lint": "eslint . --fix --cache",
    "format": "prettier --write --experimental-cli src/"
  },
  "dependencies": {
    "pinia": "^3.0.4",
    "vue": "^3.5.25",
    "vue-router": "^4.6.3"
  },
  "devDependencies": {
    "@nightwatch/vue": "^3.1.2",
    "@tsconfig/node24": "^24.0.3",
    "@types/jsdom": "^27.0.0",
    "@types/node": "^24.10.1",
    "@vitejs/plugin-vue": "^6.0.2",
    "@vitest/eslint-plugin": "^1.5.0",
    "@vue/eslint-config-prettier": "^10.2.0",
    "@vue/eslint-config-typescript": "^14.6.0",
    "@vue/test-utils": "^2.4.6",
    "@vue/tsconfig": "^0.8.1",
    "chromedriver": "^142.0.3",
    "eslint": "^9.39.1",
    "eslint-plugin-vue": "~10.5.1",
    "geckodriver": "^6.1.0",
    "jiti": "^2.6.1",
    "jsdom": "^27.2.0",
    "nightwatch": "^3.12.3",
    "npm-run-all2": "^8.0.4",
    "prettier": "3.6.2",
    "ts-node": "^10.9.2",
    "typescript": "~5.9.0",
    "vite": "^7.2.4",
    "vite-plugin-nightwatch": "^0.4.6",
    "vite-plugin-vue-devtools": "^8.0.5",
    "vitest": "^4.0.14",
    "vue-tsc": "^3.1.5"
  }
}

Steps to reproduce

  • Have only the Vue (Official) extension enabled in a default installation of VSCode. (Okay you probably won't, but that's all it needed).
  • In the example repo (which is just a pnpm create vue@latest project), open for example src/views/HomeView.vue
  • In <template>, new line under <TheWelcome />
  • Start <HelloW and pick the (only) autocomplete suggestion for @/components/HelloWorld.vue

What is expected?

The template you are typing gets autocompleted to <HelloWorld , and at the top of the file inside <script setup lang="ts"> you will get import HelloWorld from '@/components/HelloWorld.vue';

What is actually happening?

The template you are typing gets autocompleted to <HelloWorld , and at the top of the file inside <script setup lang="ts"> you will incorrectly get import type HelloWorldVue from '@/components/HelloWorld.vue'; Observe the import type instead of import, as well as the Vue suffix added to make HelloWorldVue.

When undoing using ctrl+Z (or I guess cmd+Z?) immediately, typing another letter of the component name, and accepting the same suggestion again you will get the correct import HelloWorld from '@/components/HelloWorld.vue'; at the top of the file.

Link to minimal reproduction

https://github.com/mickderks/vue-latest-for-volar-repro

Any additional comments?

I set up a Hyper-V vm using the most recent version of the Win11 dev image as of time of writing. In there I installed the newest VSCode, the newest pnpm (through their powershell install command), and node 24.12.0. Then I used pnpm create vue@latest (picking all but jsx, then picking nightwatch and no experimental features. Keeping the example code).

After this I did the usual repro steps and still had the problem appear.

If there are any other steps I can try, please let me know.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood reproduction ✨This issue provides a good reproduction, we will be able to investigate it first

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions