[organize imports] Add preferences to keep existing star imports and to disable collapsing#3056
Open
m-froehlich wants to merge 1 commit into
Open
Conversation
…to disable collapsing Add two Organize Imports preferences, wired through CodeStyleConfiguration to the new ImportRewrite options: - "Keep existing star (.*) imports" (default off): existing on-demand imports are preserved instead of being expanded into single imports. - "Collapse single imports into star (.*) imports when the threshold is reached" (default on): when unchecked, the on-demand thresholds are ignored and no new on-demand import is created from single imports. The two checkboxes are shown next to the on-demand threshold fields on the Organize Imports preference page. The default values reproduce the current behaviour. Note: this depends on the new ImportRewrite API in eclipse.jdt.core (setKeepExistingOnDemandImports / setCollapseSingleImportsToOnDemand). Signed-off-by: m-froehlich <108868519+m-froehlich@users.noreply.github.com>
Author
|
This PR depends on eclipse-jdt/eclipse.jdt.core#5175, which adds the new ImportRewrite API used here (setKeepExistingOnDemandImports and setCollapseSingleImportsToOnDemand). The current build failure is expected: org.eclipse.jdt.core.manipulation compiles against that new API, which is not yet part of the target platform. It should resolve once #5175 is merged and picked up by a build. Suggested order: review/merge #5175 first, then re-trigger this build. The tests of the changed bundle itself already pass. |
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.
Add two Organize Imports preferences, wired through CodeStyleConfiguration to the new ImportRewrite options:
"Keep existing star (.*) imports" (default off): existing on-demand imports are preserved instead of being expanded into single imports.
"Collapse single imports into star (.*) imports when the threshold is reached" (default on): when unchecked, the on-demand thresholds are ignored and no new on-demand import is created from single imports.
The two checkboxes are shown next to the on-demand threshold fields on the Organize Imports preference page. The default values reproduce the current behaviour.
Note: this depends on the new ImportRewrite API in eclipse.jdt.core (setKeepExistingOnDemandImports / setCollapseSingleImportsToOnDemand).
What it does
How to test
Author checklist