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

[Vue TS Plugin] Modifications to InferredProject's language service were discarded #57630

Closed
1 task done
johnsoncodehk opened this issue Mar 4, 2024 · 4 comments
Closed
1 task done
Assignees
Labels
External Relates to another program, environment, or user action which we cannot control.

Comments

@johnsoncodehk
Copy link

johnsoncodehk commented Mar 4, 2024

Acknowledgement

  • I acknowledge that issues using this template may be closed without further explanation at the maintainer's discretion.

Comment

Issue: vuejs/language-tools#3942

Vue TS Plugin modifies project language service at this line to handle virtual code mapping, which works well for ConfiguredProject. But for InferredProject, tsserver seems to always discard the existing language service when switching columns from .vue files to .ts files, and the newly created language service instance will not pass the plugin's create hook, so the plugin cannot modify it again.

However, the plugin's modifications to the language service host are retained, causing the vue file to display unmapped virtual code diagnostic messages.

Steps to reproduce

  1. Clone https://github.com/johnsoncodehk/volar-starter
    Since it is just for demonstration purposes, node_modules will not be installed.
  2. Delete the tsconfig.json file in repo
  3. Open the repo in VSCode, install https://marketplace.visualstudio.com/items?itemName=Vue.volar 2.0.4 and open src/components/HelloWorld.vue
  4. You should see TS errors reported due to missing dependencies, as shown below:
    image
  5. Close HelloWorld.vue, open src/main.ts, then re-open HelloWorld.vue
  6. Errors in the image above is now displayed in the wrong location (end of file)
    image
@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Mar 4, 2024
@sheetalkamat
Copy link
Member

I dont see any issues. I am using typescript nightly. Did i miss something.

inferredProject.mp4

@sheetalkamat sheetalkamat added Needs More Info The issue still hasn't been fully clarified and removed Needs Investigation This issue needs a team member to investigate its status. labels Mar 4, 2024
@johnsoncodehk
Copy link
Author

johnsoncodehk commented Mar 5, 2024

I found that you may also need to install https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode to reproduce the issue.

The triggering method for typescript nightly is slightly different. After reopening HelloWorld.vue, you need to execute the Restart TS Server command.

tsserver.log.zip

2024-03-05.10.50.38.mov

System info:

Version: 1.87.0
Commit: 019f4d1419fbc8219a181fab7892ebccf7ee29a2
Date: 2024-02-27T23:42:51.279Z
Electron: 27.3.2
ElectronBuildId: 26836302
Chromium: 118.0.5993.159
Node.js: 18.17.1
V8: 11.8.172.18-electron.0
OS: Darwin arm64 23.1.0

@sheetalkamat
Copy link
Member

@johnsoncodehk after investigating this it seems the issue with the plugin https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode

This is what i did to repro the issue:

  1. Open App.vue
  2. Open Main.ts
  3. And this is where things go off rail because the request goes to ts LS instead of the plugin.

After 2, when editor invokes the getErr request it fails as there is some issue with the d.ts added by that plugin but its script info is not present.
After that tsserver receives request:

    {
      "seq": 41,
      "type": "request",
      "command": "configurePlugin",
      "arguments": {
        "pluginName": "typescript-svelte-plugin",
        "configuration": {
          "enable": false
        }
      }
    }

This is where i think plugin reverts the LS to original ts LS and not just making itself pass through. That results in the vue plugin to be not in picture any more for the error requests.

@sheetalkamat sheetalkamat added External Relates to another program, environment, or user action which we cannot control. and removed Needs More Info The issue still hasn't been fully clarified labels Mar 5, 2024
@johnsoncodehk
Copy link
Author

Thank you very much for your survey! I'll forward this to Svelte language tools maintainers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
External Relates to another program, environment, or user action which we cannot control.
Projects
None yet
Development

No branches or pull requests

3 participants