Skip to content

Vue with typescript tooling takes a long time to initialize when used in combination with copilot (volar recursively searches the vscode installation directory instead of the project directory) #5598

@stweedie

Description

@stweedie

Vue - Official extension or vue-tsc version

3.0.5

VSCode version

1.103.0

Vue version

3.5.18

TypeScript version

6.0.0

System Info

package.json dependencies

{
"dependencies": {
    "vue": "^3.5.18"
  },
  "devDependencies": {
    "@vitejs/plugin-vue": "^6.0.1",
    "@vue/tsconfig": "^0.7.0",
    "typescript": "~5.8.3",
    "vite": "^7.1.0",
    "vue-tsc": "^3.0.5"
  }
}

Steps to reproduce

  1. Clone sample repo: https://github.com/stweedie/slow-copilot
  2. install deps and open in vscode
  3. initially, opening a .vue / .ts file will look in the proper places (I put a log statement in a local copy of typescript):
Image 4. With copilot in agent / edit mode, ask it to generate a new .ts file or .vue component 5. From this point, opening any .ts / .vue file will have the logic search the install directory for vscode (note that this searches windows directories, which is insanely slow from wsl2): Image

What is expected?

copilot doesn't mess with the context of typescript

What is actually happening?

somehow, copilot (or volar, or typescript) are messing with the context. I've traced the originating code down to this code block (though this is not the culprit itself):

https://github.com/vuejs/language-tools/blob/817d328d04472804efa83e51be024c7965eeb0f4/packages/typescript-plugin/index.ts#L59C4-L66C5

I am not sure what the root cause or trigger is, but normally the "getCurrentDirectory()" call on the languageServiceHost will return a path that is related to the project. After the corruption, getCurrentDirectory() returns the absolute URL of the vscode installation itself, which causes volar (via typescript's compiler API) to read that directory

Link to minimal reproduction

https://github.com/stweedie/slow-copilot

Any additional comments?

I have created an issue on the vscode tracker, but I figured you guys would have a better idea of how the "getVueCompilerOptions" is invoked.

Also, I would like to try to continue tracing this myself, but the best I could do was manually modifying the minified "typescript-plugin.js" file that is in the dist directory of the volar vscode plugin. Is there documentation and configuration available such that I can build the volar project and then have vscode reference that, rather than the published dist folder that comes from installing the extension?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions