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

feat: support auto folding of comments and add folding preferences page #1171

Merged
merged 1 commit into from
Jan 13, 2025

Conversation

sebthom
Copy link
Contributor

@sebthom sebthom commented Jan 11, 2025

This PR implements auto folding for comments and regions and adds this new settings page:
image

This is a follow-up PR to #971 and solves #895 and #927

public static final String PREF_AUTOFOLD_REGIONS = "foldingReconcilingStrategy.collapseRegions"; //$NON-NLS-1$
public static final String PREF_AUTOFOLD_IMPORT_STATEMENTS = "foldingReconcilingStrategy.collapseImports"; //$NON-NLS-1$

public static final class PreferenceInitializer extends AbstractPreferenceInitializer {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is initializing the preferences to some value the preferred pattern? I think org.eclipse.lsp4e.ui.LoggingPreferencePage does not initialize its preferences, rather it relies on the defaults of IPreferenceStore.getBoolean. I think this is better because one can change the defaults in LSP4E any time and they will be changed for users as well unless they have set the values themselves. Do you agree with that or do you think it is better to initialize the values? Why then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know what the preferred way is TBH. I used it because one pref key needs a default value of true and with the initializer I have a single place to define it.

@rubenporras
Copy link
Contributor

@mickaelistria , do you know if there is a preferred way? (see my comment above)

@mickaelistria
Copy link
Contributor

One can set preference in a preference initializer, that's the right pattern.
RCP providers can still override it in their plugin_customization.ini files, this one will take priority over the PreferenceInitializer.

Copy link
Contributor

@rubenporras rubenporras left a comment

Choose a reason for hiding this comment

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

Thanks

@rubenporras rubenporras merged commit 5e38b95 into eclipse-lsp4e:main Jan 13, 2025
6 checks passed
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.

3 participants