Make formatexpr use the same option as conform.format() #837
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.
The options for
formatexpris different than those used inconform.format(). This discrepancy causes issues when one sets up filetype-specific values forlsp_formatortimeout_ms. For example, I use the following values forformatters_by_ft:I also format buffers on save.
Now when I edit a
.Cfile and runwq,clangdkicks in as I setlsp_format = "prefer". The file is formatted byclangdand saved correctly. Everything is good.Now if I try to use
gq, the format is performed bytrim_newlinesandtrim_whitespace, because the default values forlsp_formatinformatexprisfallback. This inconsistency causes confusion when usingconform. See also #824 #408 #752This PR resolves this issue so that
formatexprwill respect options used byformatters_by_ft.