Releases: JuliaEditorSupport/JuliaFormatter.jl
v2.9.2
JuliaFormatter v2.9.2
Fixed a bug where pipe_to_function_call would remove parentheses from the argument of a function call even if the argument was an assignment, changing the meaning of the code. (#1147, #1148)
Fixed a bug where BlueStyle formatting of array literals which exceeded the margin was not idempotent. (#1149, #1150)
Fixed a bug where short_to_long_function_def would not apply the correct indentation to the function body, leading to non-idempotent formatting. (#1127, #1151)
Fixed a bug where formatting a begin ... end block that had nothing but whitespace or comments inside it would be non-idempotent, or delete comments inside it. (#1153, #1154)
Closed issues:
v2.9.1
JuliaFormatter v2.9.1
Fixed a bug where separate_kwargs_with_semicolon would cause a change in the meaning of function calls such as f(p, q=r, s). (#625, #1141)
Fixed a bug where separate_kwargs_with_semicolon would not be triggered in certain cases, for example in the RHS of a short-form function definition, or in the default values of a function definition.
This bug also led to lack of idempotence in a number of cases (e.g. when a short-form function definition f(x, y) = g(x, y=z) was expanded to a long-form function definition, the second pass would then reformat the body of the function). (#1133, #1140, #1141)
Fixed a bug where comments in chained ternary expressions were not being handled correctly when expanded with BlueStyle, leading to invalid Julia code. (#1142, #1143)
Fixed a bug where keyword argument names that were operators were not being parenthesised when whitespace_in_kwargs = false, leading to invalid Julia code. (#1144, #1145)
Fixed a bug where short_to_long_function would trigger even inside macros or Expr objects, leading to a change in the meaning of the code. (#1124, #1145)
Fixed a bug where import_to_using would be triggered inside macros or Expr objects, leading to a change in the meaning of the code. (#1124, #1146)
Fixed a bug where import_to_using would be triggered for relative imports (e.g. import ..x, ..y), leading to a change in the meaning of the code.
This was previously fixed for single imports (e.g. import ..x), but not for multiple imports (e.g. import ..x, ..y). (#664, #723, #1146)
Merged pull requests:
- Fix
separate_kwargs_with_semicolonovercautiousness (#1141) (@penelopeysm) - Fix chained ternary comments with binary op conditions (#1143) (@penelopeysm)
- Parenthesise operators that are kwarg names (#1145) (@penelopeysm)
- Fix overeager
import_to_using(#1146) (@penelopeysm)
Closed issues:
- Misplaced semicolon in arbitrarily ordered keywords. (#625)
- short to long function def + semicolon to kwarg idempotence (#1133)
separate_kwargs_with_semicolondoesn't fire even when it probably should (#1140)- BlueStyle chained ternary fails to format when comments precede some operation (#1142)
- Apparently you can have
<as a valid keyword argument? (#1144)
v2.9.0
JuliaFormatter v2.9.0
Improved CLI exit codes (and error messages):
- if the app errors, returns 2
- if
--checkis enabled and files are not currently formatted, returns 1 - if
--checkis enabled and files are already formatted, returns 0 - otherwise returns 0.
Deprecated format_file(args...; kwargs...); format(args...; kwargs...) has exactly the same behaviour and can be used as a drop-in substitute. (#1137)
Added missing formatting options to the CLI app (previously only a subset of these could be specified on the command line). (#1135)
For all old formatting options, added aliases that used hyphens instead of underscores, and expect the actual value on the right-hand side of the = sign.
For example, what was previously --always_use_return and --no-always_use_return should now be specified as --always-use-return=true and --always-use-return=false.
This is done to improve consistency with .JuliaFormatter.toml and also generalisability to other types of options.
The underscore versions are still supported for backwards compatibility, but the hyphenated versions should be preferred going forwards. (#1135)
For all formatting options that require a value (e.g. --margin=80), also allow the value to be space-separated (i.e. --margin 80). (#1135)
Added an --ignore-config option to the CLI app, which will ignore any .JuliaFormatter.toml files and use only the options specified on the command line. (#1135)
Added a throw_on_error keyword argument to JuliaFormatter.format(), which causes any formatting errors to propagate to the caller. (#1130, #1136, #1138)
Merged pull requests:
- Rewrite CLI argument parsing code (#1135) (@penelopeysm)
- Simplify options / config / format_text dispatch (#1137) (@penelopeysm)
- throw on format (#1139) (@penelopeysm)
Closed issues:
- Inconsistent white-space around binary operators (#59)
- Feature request: Options as a function argument have higher priority compared to config file (#639)
- Refactor CLI arg parsing (#1031)
- FormatBot still doesn't catch the case where formatting doesn't even work (#1130)
- TagBot: Manual intervention needed for releases (#1134)
- Fix format() API (#1136)
v2.8.5
Fixed more bugs where BlueStyle's chained-ternary-to-if conversion would lead to loss of idempotence. (#1131, #1132).
What's Changed
- Fix blue chained ternary idempotence issue by @penelopeysm in #1132
Full Changelog: v2.8.4...v2.8.5
v2.8.4
JuliaFormatter v2.8.4
Disabled short_circuit_to_if for x && y and x || y statements at the end of a block (since the value of the expression is in fact being used).
This includes if there is a comment at the end of the function. (#887, #1129, #1128)
Fixed a bug where x && y would be expanded to if x; y; end with short_circuit_to_if=true even when the value of x && y was being used (e.g. as an argument to a function call), which would change the meaning of the code if x was false. (#1123, #1122)
Fixed a bug where indentation of x && y and x || y expressions were overly context-sensitive, leading to inconsistent and sometimes non-idempotent formatting. (#1121, #1122)
Fixed a bug where always_use_return would sometimes cause lack of idempotence.
(Note however that this option can still cause lack of idempotence if and only if combined with short_to_long_function_def.)
Furthermore, as a consequence of this fix, return will get prepended to throw(...) if that is the final expression in the function.
This differs from previous behaviour: if you do not want this, consider adding return nothing at the end of your function after the throw(...) statement, or just disable the always_use_return option. (#1125, #1128)
Closed issues:
- unstable number of spaces between in do block before comment (#908)
- range indexing idempotence (#1118)
- blue idempotence on binary chain (#1121)
short_circuit_to_ifconsidered harmful (#1123)- Properly fix always_use_return for the sake of proper idempotence (#1125)
- short_circuit_to_if doesn't recognise comments (#1129)
v2.8.3
v2.8.2
JuliaFormatter v2.8.2
Fixed a bug where JuliaFormatter would insert newlines around a parenthesised caller in a function definition, causing the function to be parsed differently on Julia 1.12.
This is probably a Julia bug and not really JuliaFormatter's fault, but this patch works around it. (#1114, #1117)
Merged pull requests:
- Fix parenthesised caller bug (#1117) (@penelopeysm)
Closed issues:
- callable struct idempotence (#1114)
v2.8.1
JuliaFormatter v2.8.1
Fixed a bug causing line comments inside array literals to be dropped or otherwise cause non-idempotent formatting. (#1113, #1115, #1116)
Merged pull requests:
- Fix changelog (#1111) (@penelopeysm)
- Add more regression repos for DefaultStyle (#1112) (@penelopeysm)
- fix comments in array literals (#1115) (@penelopeysm)
Closed issues:
v2.8.0
JuliaFormatter v2.8.0
Fixed a bug causing lack of idempotence in typed comprehension expressions (i.e., things like T[expr for x in y]). (#1105, #1106)
Fixed a bug causing lack of idempotence when using surround_whereop_typeparameters=true (when the { and } were inserted, line breaks were not initially being allowed next to them, but would be allowed on the second parse). (#1107, #1106)
Fixed a bug causing lack of idempotence when in / = / ∈ were being converted inside a for-expression (the change in character length was not being accounted for in nesting decisions). (#1108, #1106)
Added a new formatting option, v2_stable_multiline_strings, which aims to guarantee formatting idempotence with multiline strings.
By default this option is not enabled as it will lead to some changes in the formatting of expressions containing multiline strings: you must opt into it.
Please see the documentation for more information. (#1109, #1110)
Merged pull requests:
- Fix idempotence bugs (#1106) (@penelopeysm)
- Fix multiline string idempotence bug (#1110) (@penelopeysm)
Closed issues:
v2.7.0
JuliaFormatter v2.7.0
Improved usage messages for the jlfmt command-line tool. (#1098)
Added the ability to format only specific lines of a file, either via the --lines option to jlfmt, or the lines keyword argument to format_text(). (#191, #1099, #1100)
Merged pull requests:
- app: Clarify jlfmt check guidance for multiple inputs (#1098) (@aviatesk)
- Support line-range formatting (
lineskwarg andjlfmt --lines) (#1100) (@aviatesk) - Declare docs and test as Pkg workspace projects (#1101) (@aviatesk)
Closed issues: