Repository navigation
Generate formatter settings from the server instead of a static file - #4579
Open
robstryker wants to merge 1 commit into
Open
robstryker wants to merge 1 commit into
robstryker wants to merge 1 commit into
Conversation
java.open.formatter.settings (added 2018, last touched 2021) created a
new settings file by byte-copying a bundled static template,
formatters/eclipse-formatter.xml - 405 undocumented, uncommented
options with no curation, frozen at whatever Eclipse defaults were
true when that file was last updated by hand.
Replace the static copy with a live call to the server's new
java.project.generateFormatterSettings command (eclipse-jdtls/eclipse.jdt.ls),
which generates the same kind of file from the project's actual
current effective settings, with the ~25 most commonly customized
options documented and live at the top and everything else present
but commented out - something to find and uncomment instead of a wall
of undocumented options or no file at all.
Also, while already touching this code:
- Fixed java.format.settings.url being updated before the file write
was confirmed to succeed - a user declining or a write failing used
to leave the setting pointing at a file that doesn't exist.
- Dropped the redundant second confirmation dialog ("are you sure you
want to create it?") on top of the existing input-box prompt - one
clear ask instead of two for what's now a single action.
- Added a cross-link from java.format.settings.url's own description
to this command, so a user looking at that setting (the natural
place to look when wondering how to customize formatting) can
discover it without already knowing it exists via the wiki or
Command Palette.
The workspace-root-vs-global file location logic, the already-
configured/remote-URL fast paths, and the command id are all
unchanged.
This branch has not been deployed
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.
Summary
Requires eclipse-jdtls/eclipse.jdt.ls#3989.
java.open.formatter.settings(added 2018, last touched 2021) created a new settings file bybyte-copying a bundled static template,
formatters/eclipse-formatter.xml- 405 undocumented,uncommented options with no curation, frozen at whatever Eclipse defaults were true when that file
was last updated by hand.
This replaces the static copy with a live call to the server's new
java.project.generateFormatterSettingscommand, which generates the same kind of file from theproject's actual current effective settings, with the ~25 most commonly customized options
documented and live at the top and everything else present but commented out - something to find
and uncomment instead of a wall of undocumented options or no file at all.
Also fixed/cleaned up while already touching this code
java.format.settings.urlwas being updated before the file write was confirmed to succeed - auser declining the old "are you sure?" dialog, or a failed write, used to leave the setting
pointing at a file that doesn't exist. Now it's only updated after a successful write.
the existing input-box prompt - one clear ask instead of two for what's now a single action.
java.format.settings.url's own description to this command, so a userlooking at that setting (the natural place to look when wondering how to customize formatting) can
discover it without already knowing it exists via the wiki or Command Palette.
The workspace-root-vs-global file location logic, the already-configured/remote-URL fast paths, and
the command id (
java.open.formatter.settings) are all unchanged.Test plan
tsc --noEmitcompiles cleannpm run eslintpasses cleanjava.format.settings.urlset, ina workspace with no existing formatter file - confirm the input box prompt appears, the
generated file is written to the workspace root, the setting gets updated, and the file opens
with the new curated/commented format