Enhance isJS check in getNewImportFixes function#62840
Enhance isJS check in getNewImportFixes function#62840johnsoncodehk wants to merge 2 commits intomicrosoft:mainfrom
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.
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 <175728472+Copilot@users.noreply.github.com>
|
Pay as u use |
|
With 6.0 out as the final release vehicle for this codebase, we're closing all PRs that don't fit the merge criteria for post-6.0 patches. If you think this was a mistake and this PR fits the post-6.0 patch criteria, please post to the 6.0 iteration issue with details (specifically, which PR and which patch criteria it satisfies). Next steps for PRs:
|
Fixes vuejs/language-tools#4582
In
getNewImportFixes, prioritize checking scriptKind over file extension forisJs. This ensures consistentJsdocTypeImportbehavior for file types added via LS plugins.