Prajwal S N
6ef9fba442
chore: revert changes to README
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:43 +05:30
Prajwal S N
90bb91d2c6
fix: use temporary buffer for conditional newline
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:04 +05:30
Prajwal S N
3eb09287b2
chore: run dfmt on all files
...
_sigh_ should've done this at the beginning, but better late than never.
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:04 +05:30
Prajwal S N
7f81285c1f
feat: conditional template constraint style
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:04 +05:30
Prajwal S N
6e97ea81d1
feat: track line length
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:04 +05:30
Prajwal S N
16028a8f62
fix: store unit tests in AST
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:04 +05:30
Prajwal S N
3b80011673
chore: make it compile with latest DMD
...
Some breaking changes in upstream borked the AST walker, it's been fixed
in this commit.
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2024-01-04 21:18:03 +05:30
Prajwal S N
0897c83e86
feat: non-conditional template constraints styles
...
The non-conditional styles for `dfmt_template_constraint_style` are
supported for now. The conditional ones will require line length
tracking, which is yet to be implmented.
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-12-14 00:15:53 +05:30
Prajwal S N
0259887791
feat: add `dfmt_space_before_named_arg_colon`
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-12-13 18:59:19 +05:30
Prajwal S N
14024a5725
feat: add `dfmt_compact_labeled_statements`
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-12-13 18:40:26 +05:30
Prajwal S N
07bfe5c208
feat: add brace styles
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-12-01 17:45:33 +05:30
Prajwal S N
b4e36d998b
feat: add `dfmt_selective_import_space`
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-23 00:11:24 +05:30
Prajwal S N
62e47bb5d4
feat: add `dfmt_space_after_keywords`
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-23 00:11:00 +05:30
Prajwal S N
90c9040898
feat: add 4 transformations
...
- dfmt_space_before_function_parameters
- dfmt_space_after_cast
- dfmt_align_switch_statements
- dfmt_space_before_aa_colon
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-10 17:12:58 +05:30
Prajwal S N
ded6e8d37b
fix: iron out some bugs
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-10 00:02:54 +05:30
Prajwal S N
decdc79445
fix: add indentation logic
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-08 23:43:25 +05:30
Prajwal S N
3ac8e5afa6
feat: implement visitors and writers
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-08 23:43:23 +05:30
Prajwal S N
6c1c543194
feat: make it compile with dmd AST
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-08 23:40:57 +05:30
Prajwal S N
806e7589c9
refactor: lexer in `indentation.d` and `wrapping.d`
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-08 23:40:36 +05:30
Prajwal S N
61206bc0ca
refactor: lexer in `tokens.d`
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-08 23:40:36 +05:30
Prajwal S N
34174badd0
chore(deps): add dmd library
...
Signed-off-by: Prajwal S N <prajwalnadig21@gmail.com>
2023-11-08 23:40:36 +05:30
Daniel Zuncke
2ea6c43a66
Use libdparse to check for named arg
...
Remove custom named arg parser
2023-10-26 20:10:50 +00:00
Daniel Zuncke
9f377100f0
Remove unnecessary tok!"comment" filter
2023-10-26 20:10:50 +00:00
Daniel Zuncke
20b8badf8c
Fix issue #586
2023-10-26 20:10:50 +00:00
Daniel Zuncke
35e55bc9b2
Fix #578 ternary expressions in AA literals not properly formatted ( #591 )
2023-10-22 17:52:14 +09:00
Daniel Zuncke
08fe5d6855
Confirm token equality, safer loop
...
Using different variable to iterate to guarantee unchanged behaviour
if anything doesn't work as intended.
2023-10-18 10:22:48 +02:00
Daniel Zuncke
c0452dbd11
Update test to include both known cases
...
I have formatted them both to look like the the individual bad output
and not like the actual output from formatting the issue0432.d file with
the current implementation. The current implementation makes it look
like a new / different problem.
2023-10-18 10:22:48 +02:00
Daniel Zuncke
876bbe33c1
Fix issue #432
...
Overview:
Array astInformation.structInitEndLocations is used to find index to use
in astInformation.indentInfoSortedByEndLocation.
Both are sorted, first is used to find the array index, second is
accessed at that index to get brace indentation information.
Problem:
structInitEndLocations is generated from struct initializers
exclusively while the brace information array also contains entries
for function literal initializers. Thus when function literal init(s)
are used, we get accumulating off by one errors in the second array:
match value in structInitEndLocations and take that index:
[3, 50]
^--> index 1
take brace indent information from that index:
[3, 15, 50]
| ^--> the one we want
^------> the one we get (function literal init)
Solution:
This guarantees that searching forward works.
While better search strategies than linear are possible, this should be
enough for any sane and most of the insane code files.
2023-10-18 10:22:48 +02:00
WebFreak001
1e765fb781
add knr test variant for no_space_after_keyword
...
The generator is so outdated and basic that it didn't generate this.
2023-07-26 16:13:48 +02:00
Robert Schadek
c43803575d
No space after keywords
...
Readme update
test files
2023-07-26 16:13:48 +02:00
WebFreak001
470e65f7cc
bump minimum libdparse version, fix #583
2023-07-19 14:43:24 +02:00
Eugen Wissner
6f41b20d5b
Remove travis
2023-05-01 23:01:54 +02:00
Razvan Nitu
49b9fe4051
Merge pull request #579 from belka-ew/bug/revert-array-indent-on-line
...
Keep "(" indentation with a "]" in the same line
2023-04-07 23:19:48 +08:00
Eugen Wissner
fec7394175
Add reflow_property_chains option
...
Recalculate the splitting of property chains into multiple lines.
2023-03-29 11:29:59 +02:00
Eugen Wissner
727472c365
Keep "(" indentation with a "]" in the same line
2023-03-20 18:23:33 +01:00
WebFreak001
840aeee45e
add missing test
2023-03-01 22:07:37 +01:00
WebFreak001
a91f044958
add some missing hasCurrent checks
2023-03-01 22:07:37 +01:00
Eugen Wissner
dba8c87ebc
Revert operator indentation in an argument list
2023-02-06 10:17:09 +01:00
Eugen Wissner
a4fbc6f881
Revert chain indentation in an argument list
2023-01-15 20:51:03 +01:00
Eugen Wissner
57f57d95de
Fix else indentation after array literal
2023-01-14 02:18:28 +01:00
WebFreak001
4a6078779a
Fix #568 , don't output empty files without error
...
Now when an error in formatting happens, it never outputs anything and
doesn't override the file when working inplace.
Additionally dfmt is no longer able to fail in the middle of a file, as
now we first write everything to a buffer and only if everything was
successful, that buffer is printed to stdout or written to the inplace
file.
This should also guard against segfaults with inplace file formatting
erasing parts of the file, as well as the user thinking it was
successful, even though dfmt didn't finish properly.
2022-10-15 02:33:04 +02:00
Iain Buclaw
e251e4343a
Remove appveyor.yml
...
This pipeline isn't in use anymore.
2022-10-06 21:10:01 +02:00
Iain Buclaw
02070df593
Update downloads.dlang.org links to use https
2022-10-06 21:10:01 +02:00
Andrey Proskurin
6744df20f3
Add knr brace style to README
2022-09-14 13:25:04 +02:00
Eugen Wissner
8d42254d47
Fix indentation of callchains with comments
...
Weird formatting and indentation of multiline callchains with comments
in the middle.
2022-08-06 08:55:43 +02:00
Bastiaan Veelo
2a4af7a2b2
Retain line ending by default. ( #553 )
2022-07-28 17:21:10 +02:00
Eugen Wissner
026a58e273
Very long chained calls in array literals are indented weirdly
2022-07-28 17:14:01 +02:00
Bastiaan Veelo
4947beec6b
CI
...
Add GitHub action.
2022-07-14 23:19:37 +02:00
belka-ew
d862d8aef1
Fix array literal indentation in foreach ( #554 )
2022-06-14 12:35:54 +00:00
skyline131313
036da91542
Update dub.json to remove dependency on `rdmd` ( #547 )
2022-06-13 16:23:56 +02:00