Skip to content
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

Limit add missing imports on paste for source range #2455

Merged
merged 1 commit into from
Feb 13, 2023

Conversation

CsCherrYY
Copy link
Contributor

@CsCherrYY CsCherrYY commented Feb 10, 2023

Signed-off-by: Shi Chen chenshi@microsoft.com

fix #2442, Now the additionalEdit is calculated from a fake ICompilationUnit with applying the incoming paste content, once the paste range is affecting current imports, there might be some overlap among insertText and additionalEdit.

With this PR we only do add missing imports on paste when the pasted range is within the original primary type's source range, so that we can guarantee that there is no overlap among insertText and additionalEdit.

@CsCherrYY CsCherrYY marked this pull request as ready for review February 13, 2023 02:20
Copy link
Contributor

@datho7561 datho7561 left a comment

Choose a reason for hiding this comment

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

This works for me and the code looks good. Thanks, Shi!

Signed-off-by: Shi Chen <chenshi@microsoft.com>
@rgrunber rgrunber merged commit eef3e3f into eclipse-jdtls:master Feb 13, 2023
@CsCherrYY CsCherrYY deleted the cs-issue2442 branch February 14, 2023 01:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add missing imports on paste introduces unexpected imports when the file is in wrong package
3 participants