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

Volar hybrid mode compatibility with typescript-svelte-plugin #2307

Closed
jasonlyu123 opened this issue Mar 6, 2024 · 0 comments
Closed

Volar hybrid mode compatibility with typescript-svelte-plugin #2307

jasonlyu123 opened this issue Mar 6, 2024 · 0 comments
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.

Comments

@jasonlyu123
Copy link
Member

Describe the bug

Thread for tracking Volar hybrid mode compatibility issues. Documenting some issues currently found and continuing the conversation of microsoft/TypeScript#57630.

  1. Typescript plugin is enabled in all projects without a tsconfig/jsconfig.json
  2. The plugin is enabled by default. The config request to disable it only happens when a ts/js file is opened. So the "svelte.enable-ts-plugin": false config doesn't do anything until a ts/js file is opened.
  3. Debug.assert in ts 5.5 nightly: https://github.com/microsoft/TypeScript/blob/353ccb7688351ae33ccf6e0acb913aa30621eaf4/src/server/project.ts#L1160. Doesn't seem to happen when opening a svelte project.

For 2, we might need to disable the ts plugin when the config is { global: true, ... } and enable it when the config request we sent arrives.

Probably Volar problems:

  1. Debug.assert in ts 5.3: https://github.com/microsoft/TypeScript/blob/63717cf44a64585175c76c336c8f8d87d5384d16/src/server/project.ts#L1518. This is because vue typescript plugin patched getScriptVersion to be a compound version id but TypeScript expect update should only happen through Project.updateGraph. Might need to check if this only happens if the Svelte extension is enabled.

@johnsoncodehk, Also, I can't reliably reproduce the problem reported in microsoft/TypeScript#57630. Can you provide a more detailed step?

Reproduction

microsoft/TypeScript#57630

Expected behaviour

compatible

System Info

  • OS: [e.g. Windows]
  • IDE: [e.g. VSCode, Atom]

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

@jasonlyu123 jasonlyu123 added the bug Something isn't working label Mar 6, 2024
dummdidumm pushed a commit that referenced this issue Apr 25, 2024
#2307

Improve the svelte project check for InferredProject. Start from the current directory and go down 2 levels in the directory tree to search for package.json. Then we use the directories with package.json to search for svelte modules. If your ts-plugin is no longer enabled, you can create a jsconfig.json where your package.json is. This alone should resolve most problems since the plugin won't be applied at all.

Disable the plugin in the config level until we receive the _typescript.configurePlugin request. This should decrease the chance of the project update because of the config toggle.
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

2 participants