Skip to content

Conversation

@navya9singh
Copy link
Member

This pr fixes #60485 by making preparePasteEdits return false if an import statement is selected. This is a fix for now that will stop the spinner, but I will be working on #59841 that would enable pasteEdits to fix import specifiers and will also take care of this delay.

@typescript-bot typescript-bot added Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug labels Jan 23, 2025
Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

Do JavaScript requires and export { foo } from "./bar" need to be considered?

ancestorNode => rangeContainsRange(ancestorNode, range),
);
if (!enclosingNode) return;
if (
Copy link
Member

Choose a reason for hiding this comment

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

Do all these conditions work if only a an identifier is selected? What about part of the module specifier? The test only shows the case where an entire import declaration is selected.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, if only an identifier is selected, it works too because it doesn't enter this if block, instead tries to enter the forEachChild but since it doesn't have any children it just returns and moves to the next iteration. Same for moduleSpecifier. If this is selected { foo }, then it will enter the if block.

Copy link
Member

Choose a reason for hiding this comment

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

Can you add tests to show that it works?

@DanielRosenwasser
Copy link
Member

@typescript-bot pack this

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 28, 2025

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
pack this ✅ Started ✅ Results

@typescript-bot
Copy link
Collaborator

typescript-bot commented Jan 28, 2025

Hey @DanielRosenwasser, I've packed this into an installable tgz. You can install it for testing by referencing it in your package.json like so:

{
    "devDependencies": {
        "typescript": "https://typescript.visualstudio.com/cf7ac146-d525-443c-b23c-0d58337efebc/_apis/build/builds/164655/artifacts?artifactName=tgz&fileId=D149E380E1D7F382D2D6683923F50AFB4AC58D952B8FC978D2B5EC11A225DB5902&fileName=/typescript-5.8.0-insiders.20250128.tgz"
    }
}

and then running npm install.


There is also a playground for this build and an npm module you can use via "typescript": "npm:@typescript-deploys/[email protected]".;

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

Labels

Author: Team For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

slow paste with spinner

4 participants