Jean Klingler
5902c29ad5
Add :migrate_unless option to formatter ( #13844 )
2024-09-20 23:00:01 +09:00
Jean Klingler
5eddb4bbfe
Rework migrate options for the formatter ( #13841 )
2024-09-20 17:34:59 +09:00
Jean Klingler
8cb6abf6d2
Formatter fix: next_break_fits respects line_length ( #13792 )
...
* Refactor fits to return :fit | :no_fit
* Formatter fix: next_break_fits respects line_length
2024-09-18 23:13:11 +09:00
José Valim
b799e9eda4
Revert formatter changes to ||| and &&&, closes #13711
2024-07-29 02:23:57 +02:00
José Valim
d9cf285d71
Enforce parens when formatting on more operators ( #13711 )
...
* On bitwise operators
* On right precedence operators which are semantically
non-associative (such as -- and potentially ---)
2024-07-08 18:23:14 +02:00
José Valim
25e6ce4271
Add pending deprecations
2024-05-24 13:11:29 +02:00
José Valim
67c3ad5196
Add brackets around keyword lists when formatting with when, closes #13503
2024-04-23 09:34:03 +02:00
José Valim
b8f069d08e
Fix parsing of ambiguous operators followed by containers
...
Closes #13402 .
2024-03-09 11:17:06 +01:00
Jean Klingler
5ec63f0e1a
Fix charlist formatting issue on '\"' ( #13364 )
2024-02-24 00:02:00 +09:00
José Valim
55cd5a4a22
Revert "Do not escape \ in uppercase sigils, closes #8989 "
...
This reverts commit 51d23cbba8
due to a regression.
Closes #13262 .
2024-01-17 23:28:21 +01:00
Jean Klingler
e58e267586
Formatter keeps quotes in atom keys ( #13108 )
2023-11-15 21:35:25 +09:00
José Valim
51d23cbba8
Do not escape \ in uppercase sigils, closes #8989
2023-11-13 11:53:44 +01:00
José Valim
bb1f1af113
Trim trailing whitespace on heredocs with \r\n
2023-10-29 08:51:48 +01:00
Jean Klingler
8f9265b7f3
Fix formatter for :* in bitstring modifiers ( #12923 )
2023-09-12 04:02:23 +09:00
Andrea Leopardi
c402e8336c
Add support for multi-letter uppercase sigils ( #12448 )
2023-03-05 13:10:28 -06:00
José Valim
7b73407af8
Respect line breaks after =
...
Many editors use indentation for collapsing
so folks may want to use `var =` followed by
new line to collapse. This PR makes it possible
and aligns `=` with other operators.
2023-01-04 12:06:58 +01:00
sabiwara
7ebfcc7de9
Fix formatter error on nested do without parenthesis ( #12274 )
2022-11-27 15:15:18 +01:00
José Valim
26a4f3cefd
Consider closing ) on keyword break, closes #12206
2022-10-19 11:36:41 +02:00
sabiwara
5e818fc176
Fix formatter: size*unit shortcut in bitstring ( #12201 )
2022-10-14 21:49:11 +02:00
José Valim
0a1a5991d9
Remove unecessary parens in nullary type funs
2022-10-14 13:55:23 +02:00
José Valim
9fb3cf6030
Fix ambiguity in &INT with brackets
2022-10-08 10:52:37 +02:00
José Valim
7a3638c7c1
Consistently use normalize prefix for AST changing options
2022-09-07 15:55:37 +02:00
sabiwara
29bf449f3f
Evaluate formating charlists as ~c sigils ( #12064 )
2022-08-10 06:47:00 +02:00
José Valim
76a683f41c
Add deprecations
2022-07-27 17:18:53 +02:00
Luc Fueston
31cbdbd6e0
nfc and additional normalizations for identifiers ( #11859 )
...
* nfc by default
* suggest nfkc on unexpected tokens when nfkc would have worked
* support additional normalizations (just micro/mu for now)
* parser, formatter tests
* tweak Macro.inner_classify(atom) not to rely on not_nfc causing error
2022-05-23 09:44:44 +02:00
5054aca720
Add the :normalize_bitstring_modifiers formatter option ( #11840 )
...
Co-authored-by: Andrea Leopardi <an.leopardi@gmail.com >
Co-authored-by: José Valim <jose.valim@gmail.com >
2022-05-17 07:54:14 +02:00
sabiwara
71d410d0c8
Fix bug when formatting :"\\" ( #11699 )
2022-03-12 16:58:55 +01:00
José Valim
1ede05bef6
Add no_limit to Inspect.Algebra
...
Closes #11675 .
2022-03-03 18:23:56 +01:00
José Valim
b562bb17fe
Add opening delimiter to sigil metadata/opts
2022-02-17 20:43:13 +01:00
José Valim
b5c2020503
Allow iodata in sigil formatting functions
2022-02-17 14:57:04 +01:00
José Valim
b52f274406
Add .. as a nullary operator that returns 0..-1//1 ( #11623 )
2022-02-13 15:18:53 +01:00
José Valim
bee0bb56be
Do not emit warnings when formatting code
...
Closes #11595 .
2022-01-26 13:37:53 +01:00
Matt McCoy
1dedbb843d
Supply file and line to formatter plugins ( #11591 )
...
Allow formatter plugins to print errors with accurate file and
line information. The line is only provided when a sigil is being
formatted.
2022-01-24 08:36:07 +01:00
José Valim
a74d0cc390
Deprecate <|>
2021-12-13 20:13:03 +01:00
José Valim
02115046e2
Handle block and multiline clauses without line length
2021-12-11 10:19:06 +01:00
José Valim
f1b9d3e818
Deprecate use Bitwise and ~~~
...
Use `import` instead.
2021-12-09 21:08:57 +01:00
José Valim
0a972503ec
Add Macro.classify_atom/1 and Macro.inspect_atom/2 ( #11446 )
...
Today the formatter still uses some private APIs
and this commit aims to expose some of them.
In particular, Macro.classify_atom/1 was added to
expose if an atom is an alias, an identifier, quoted,
or unquoted.
Note that the API does not say anything about
operators, since they can fall within three distinct
categories:
* unquoted and callable, such as, `+`, `-`, and
most operators
* unquoted and not callable, such as, `.`, `..`,
and `..//`, which would be ambiguous when used
as `Module.OP()`
* quoted but callable, such as `::`, which is
ambiguous in the atom syntax but not as calls
This information still remains private, especially
because most times operators are used, we often still
want to learn about their precedence too.
We also exposed `inspect_atom/2` with three
distinct clauses to cover the different scenarios
atoms can be inspected at runtime and in source
code.
2021-12-05 15:02:06 +01:00
Maarten van Vliet
96293c2d89
Pass sigil/modifiers through to formatter ( #11348 )
...
This allows the formatter plugins to format content
based on whether it's a file or a sigil being formatted.
The modifiers could be used for additional options.
2021-10-26 14:06:06 +02:00
José Valim
dd4ef1ab0e
Support plugins in the formatter
2021-09-15 09:45:45 +02:00
José Valim
504b7b1b50
Allow custom sigil formatting on Code.format_string!
2021-09-15 09:45:45 +02:00
Aleksei Magusev
2f78233a0b
Standardize on do-end notation for the block syntax ( #11228 )
2021-09-06 10:59:57 +02:00
José Valim
d90c262f57
Do not touch hashbangs when formatting, closes #11215
2021-08-29 09:49:25 +02:00
José Valim
02592c86fd
Parse .: as expected, closes #11093
2021-06-29 12:39:05 +02:00
José Valim
3729b55b78
Fix formatter integration test
2021-05-22 21:24:51 +02:00
José Valim
4620775ec9
Format multiline inside interpolation on first run, closes #10996
2021-05-22 20:45:58 +02:00
José Valim
a1989d01f8
Respect keywords in access in code formatter
2021-05-11 12:37:52 +02:00
Eksperimental
d2a45f57af
Quote range operator atom
...
This commit has only the actual changes
Add tests for quoted range operator
2021-04-01 09:46:47 +02:00
José Valim
b849235472
Support stepped ranges ( #10810 )
2021-03-25 07:32:06 +01:00
José Valim
c9a171da5b
Deprecate ^^^
2021-03-23 10:23:58 +01:00
José Valim
9da5cb8b9e
Rewrite not (foo in bar) to foo not in bar
2021-03-07 20:00:08 +01:00