fix: remove newline when removing unused import#54
Merged
AJenbo merged 1 commit intoAJenbo:mainfrom Mar 31, 2026
Merged
Conversation
AJenbo
added a commit
to calebdw/phpantom_lsp
that referenced
this pull request
Mar 31, 2026
When removing unused imports, the blank line separating the import block from the class body was left behind. The deletion edit now consumes adjacent blank lines intelligently: - When the entire import block is removed, the trailing separator line is consumed so no stray blank line remains before the class. - When an import between two groups is removed, the doubled blank line is collapsed into one. - When imports remain on both sides of a gap, the gap is preserved. The edit builder receives a set of all lines being removed so that bulk removal can reason about which imports will survive after the operation. Closes AJenbo#50 Contributed by @calebdw in AJenbo#54
530a53b to
eb0f9fa
Compare
When removing unused imports, the blank line separating the import block from the class body was left behind. The deletion edit now consumes adjacent blank lines intelligently: - When the entire import block is removed, the trailing separator line is consumed so no stray blank line remains before the class. - When an import between two groups is removed, the doubled blank line is collapsed into one. - When imports remain on both sides of a gap, the gap is preserved. The edit builder receives a set of all lines being removed so that bulk removal can reason about which imports will survive after the operation. Closes AJenbo#50 Contributed by @calebdw in AJenbo#54
eb0f9fa to
8a88190
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #54 +/- ##
==========================================
+ Coverage 87.78% 87.80% +0.02%
==========================================
Files 144 144
Lines 82890 83117 +227
==========================================
+ Hits 72762 72978 +216
- Misses 10128 10139 +11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #50
Note that I basically just had gpt-5.4 take a crack at it, so feel free to update as you see fit. I did test it out and it fixed the issue
Best,