Repository navigation
feat: let plugins skip formatting until the output is stable - #1469
Merged
Merged
Conversation
Adds `PluginInfo::skip_stable_format` for plugins that are sure formatting their output again never changes it, so dprint doesn't format each changed file at least one more time. Bumps dprint-core to 0.78.0.
Moves `skip_stable_format` from `PluginInfo` to `FileMatchingInfo` since the config can change whether the output is stable (ex. formatting embedded text with other plugins). It's not used when config overrides apply to the file.
…ps stable format When every plugin formatting a file skips formatting it again until it's stable, the text those plugins format with other plugins (ex. code blocks) is made stable instead unless those plugins say the same.
…ig applies When the plugin's configuration says to skip stable format and override config applies to a file, ask the plugin for the file matching info of the configuration with the override config merged in instead of always formatting until stable.
A plugin is either all in or all out, which removes asking the plugin about override config. Text the plugin formats with other plugins is still made stable unless those plugins also skip it.
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.
Adds
PluginInfo::skip_stable_format(skipStableFormatin the plugin info JSON) for plugins that are sure formatting their output again never changes it with any configuration. By default, dprint formats text a plugin changed again until it stops changing, which means formatting each changed file at least one more time.dprint fmt(including stdin), the editor service, and the LSP skip that only when every plugin formatting the file sets it.falseand they keep getting a stable format.PluginInfo.