-
-
Notifications
You must be signed in to change notification settings - Fork 110
refactor: compat with language tools v3.1 #754
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
Conversation
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #754 +/- ##
==========================================
- Coverage 70.53% 70.18% -0.36%
==========================================
Files 32 32
Lines 2396 2408 +12
Branches 834 845 +11
==========================================
Hits 1690 1690
- Misses 581 592 +11
- Partials 125 126 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WalkthroughThe plugin entry point signature is refactored to use destructured parameters for compilerOptions and TypeScript module access. String-based useRoute mutations are replaced with AST traversal and precise source range replacements. The augment-vls-ctx utility is updated to accept a Code array instead of a function parameter. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (2)
🧰 Additional context used🧠 Learnings (4)📓 Common learnings📚 Learning: 2025-08-16T13:01:42.709ZApplied to files:
📚 Learning: 2025-08-23T12:50:36.614ZApplied to files:
📚 Learning: 2025-08-15T16:11:02.627ZApplied to files:
🧬 Code graph analysis (1)src/volar/entries/sfc-typed-router.ts (1)
🔇 Additional comments (8)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
posva
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't push to the branch so I'm merging locally because this allows using $route without breaking all types so It's better than nothing but I don't understand why I couldn't fix it
| if (contentStr.match(RE.DOLLAR_ROUTE.VLS_CTX)) { | ||
| vlsCtxAugmentations.push(`$route: ReturnType<typeof ${typedCall}>;`) | ||
| vlsCtxAugmentations.push( | ||
| `{} as { $route: ReturnType<typeof ${typedCall}> }` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to work only if useRoute is imported (which is most of the time not the case as you only use one of them)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm confused, I tried
`{} as { $route: ReturnType<typeof import('vue-router').useRoute${useRouteNameTypeParam}> }`and it doesn't work in the plugin but it works on regular TS...
I also tried this
const RouteMap = `import('vue-router/auto-routes').RouteNamedMap`
const RouteLocationNormalizedLoaded = `import('vue-router').RouteLocationNormalizedLoaded`
vlsCtxAugmentations.push(
`{} as { $route: ${RouteLocationNormalizedLoaded}<${useRouteNameType} | ${RouteMap}[${useRouteNameType}]["childrenNames"]> }`
)It's as if something else is blocking in the way? I inspected with Volar Labs and the output is correct, just the types are not...
|
Thanks, I merged locally and opened #761 |
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.