-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
Fixing slow paste with spinner #61032
base: main
Are you sure you want to change the base?
Conversation
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.
Do JavaScript requires and export { foo } from "./bar"
need to be considered?
@@ -25,6 +32,12 @@ export function preparePasteEdits( | |||
ancestorNode => rangeContainsRange(ancestorNode, range), | |||
); | |||
if (!enclosingNode) return; | |||
if ( |
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.
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.
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.
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.
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.
Can you add tests to show that it works?
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 enablepasteEdits
to fix import specifiers and will also take care of this delay.