Repository navigation
Fix formatter comment handling in calls and interpolations - #16016
Merged
josevalim merged 2 commits intoOct 27, 2026
Merged
Conversation
Comments between arguments of a call with trailing keywords forced the leading arguments into separate lines, but the keyword list was still glued to the last argument, so formatting was not idempotent. Comments inside interpolations were only moved out of strings, so they were dropped in heredoc sigils and charlists and could end up commenting out the closing interpolation delimiter in sigils and quoted atoms.
A comment after the value of the first keyword in a call without parens, such as @moduledoc deprecated: "..." # comment, was written after the key, with the value at the start of the next line. Closes elixir-lang#16015
Member
|
💚 💙 💜 💛 ❤️ |
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.
Closes #16015.
Three comment bugs in the formatter. The first two only happen on main, since #15893:
}and the output didn't compile. In heredoc sigils and charlists the comment was dropped. They're now moved outside, like for strings.@moduledoc deprecated: "..." # comment, ended up after the key, with the value at column 0. The value now goes on its own line, under the comment.I checked by adding comments to Elixir's own lib files and formatting them twice: nothing changes on the second run. Formatting the repo itself doesn't change any file.