-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Enhance isJS check in getNewImportFixes function #62840
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
base: main
Are you sure you want to change the base?
Conversation
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
|
This PR doesn't have any linked issues. Please open an issue that references this PR. From there we can discuss and prioritise. |
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.
Pull request overview
This PR enhances the isJS check in the getNewImportFixes function to better support Language Service plugins (like Vue.js language tools) that add custom file types via LS plugins. The change prioritizes checking scriptKind over file extension to determine if a file should be treated as JavaScript, ensuring consistent JsdocTypeImport behavior.
Key changes:
- Import
ScriptKindenum for script kind checking - Remove the top-level
isJsvariable that only checked file extension - Move JS determination logic into the conditional block where it's needed, checking
scriptKindfirst withhasJSFileExtensionas fallback
Co-authored-by: Copilot <[email protected]>
|
Pay as u use |
tyreektyreek7
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.
Fixes vuejs/language-tools#4582
In
getNewImportFixes, prioritize checking scriptKind over file extension forisJs. This ensures consistentJsdocTypeImportbehavior for file types added via LS plugins.