Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix JSDoc @import crashes in getCompletionEntryDetails#62028

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Copilot wants to merge2 commits intomain
base:main
Choose a base branch
Loading
fromcopilot/fix-62027

Conversation

Copilot
Copy link
Contributor

@CopilotCopilotAI commentedJul 9, 2025
edited
Loading

The completion system was crashing when trying to get completion entry details for JSDoc@import statements. Consider:

/**@import * as t from './types.ts' */import{preventDefault}from"./other-file.js";p// <-- requesting completions here would crash

The error was:

Debug Failure. Invalid cast. The supplied value [object Object] did not pass the test 'isTypeKeywordToken'.

Root Cause:
The completion system tries to promote type-only imports to regular imports when they are used in value contexts. For JSDoc@import statements, this promotion logic incorrectly assumed the import had atype keyword that could be found and removed, but JSDoc imports don't have this structure - they are inherently type-only.

Solution:
Added a check inpromoteImportClause function to skip type keyword deletion for JSDoc imports:

functionpromoteImportClause(importClause:ImportClause){// JSDoc imports are inherently type-only and don't have a removable 'type' keywordif(!isJSDocImportTag(importClause.parent)){changes.delete(sourceFile,getTypeKeywordOfTypeOnlyImport(importClause,sourceFile));}// ... rest of function}

This allows JSDoc imports to be safely handled during the completion promotion process without attempting to remove a non-existenttype keyword.

Fixes#62027.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn moreCopilot coding agent tips in the docs.

@typescript-bottypescript-bot added the For Milestone BugPRs that fix a bug with a specific milestone labelJul 9, 2025
Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
@CopilotCopilotAI changed the title[WIP] JSDoc@import causesgetCompletionEntryDetails to crashFix JSDoc @import crashes in getCompletionEntryDetailsJul 9, 2025
@CopilotCopilotAI requested a review fromRyanCavanaughJuly 9, 2025 16:28
Copilot finished work on behalf ofRyanCavanaughJuly 9, 2025 16:28
Copy link

@louwerslouwers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Needs a regression test?

@louwers
Copy link

Seems to work.

@louwers
Copy link

@RyanCavanaugh Could you nudge Copilot to add a unit test?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@louwerslouwerslouwers left review comments

@RyanCavanaughRyanCavanaughAwaiting requested review from RyanCavanaugh

At least 1 approving review is required to merge this pull request.

Labels
For Milestone BugPRs that fix a bug with a specific milestone
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

JSDoc@import causesgetCompletionEntryDetails to crash
4 participants
@Copilot@louwers@RyanCavanaugh@typescript-bot

[8]ページ先頭

©2009-2025 Movatter.jp