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

0.37.6 breaks event payload type detection (npm monorepo) #1445

Closed
mesqueeb opened this issue Jun 13, 2022 · 5 comments
Closed

0.37.6 breaks event payload type detection (npm monorepo) #1445

mesqueeb opened this issue Jun 13, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@mesqueeb
Copy link
Contributor

Some oddities

  • cannot find volar running in the output list, but it's definitely running
  • volar is not able to retrieve the type of the event payload of the vue file
  • when ⌘+Click on the Vue component, it goes to the shims file instead of to the component
  • on 0.37.3 everything works as expected

image

@johnsoncodehk
Copy link
Member

  • cannot find volar running in the output list, but it's definitely running

This is expected, because volar do not have any console.log if it's running normally.

  • volar is not able to retrieve the type of the event payload of the vue file
  • when ⌘+Click on the Vue component, it goes to the shims file instead of to the component

Could you provide minimal reproduction? (Btw I suggest you use takeover mode instead shims)

@mesqueeb
Copy link
Contributor Author

@johnsoncodehk we have takeovermode enabled. @builtin typescript is disabled:

image

working on creating a minimal reproduction now

@mesqueeb
Copy link
Contributor Author

@johnsoncodehk here's a minimal reproduction. (in takeovermode)
image

and on v0.37.3, works as expected:

image

zip without node_modules:
https://www.dropbox.com/s/qyhin4xwr2cgnok/volar-issue-0.37.6.zip?dl=0

  1. open in VSCode
  2. npm i (make sure you have npm v8+)
  3. install volar
  4. disable @builtin typescript
  5. reload VSCode
  6. open packages/app/src/App.vue see the event payload is not typed

@mesqueeb mesqueeb changed the title 0.37.6 breaks event payload type detection 0.37.6 breaks event payload type detection (npm monorepo) Jun 13, 2022
@johnsoncodehk johnsoncodehk added bug Something isn't working and removed need info labels Jun 13, 2022
@mesqueeb
Copy link
Contributor Author

@johnsoncodehk what is this dark magic fix? 😂 it's just a variable rename?

What was wrong? 🤔

@johnsoncodehk
Copy link
Member

johnsoncodehk commented Jun 13, 2022

@mesqueeb Variable rename obfuscate the fix 😅, it should be (fileName is XXX.vue.ts, fileNameTrim is XXX.vue):

						const fileExists = !!host.fileExists?.(fileNameTrim);
						if (fileExists) {
							// create virtual files
-							const scriptSnapshot = host.getScriptSnapshot(fileName);
+							const scriptSnapshot = host.getScriptSnapshot(fileNameTrim);
							if (scriptSnapshot) {
-								documentRegistry.set(fileName, createSourceFile(
-									fileName,
+								documentRegistry.set(fileNameTrim, createSourceFile(
+									fileNameTrim,
									scriptSnapshot.getText(0, scriptSnapshot.getLength()),
									compilerOptions,
									vueCompilerOptions,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants