Commit Graph

182 Commits

Author SHA1 Message Date
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 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
Robert Schadek c43803575d No space after keywords
Readme update

test files
2023-07-26 16:13:48 +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 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
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
belka-ew d862d8aef1
Fix array literal indentation in foreach (#554) 2022-06-14 12:35:54 +00:00
Bastiaan Veelo f81ddeadbd
obey `end_of_line` setting in all tokens (#550)
Multi-line tokens would be written with `LF`, regardless the `end_of_line` setting.

Fixes #228 and also produces end_of_line specified line-endings in strings.
2022-05-25 13:21:07 +02:00
Eugen Wissner 77e2ba4e3d Fix array indentation as argument 2022-05-23 14:09:26 +02:00
Razvan Nitu 2beb819851
Merge pull request #535 from dlang-community/single-indent
Add single_indent option
2021-10-22 16:22:40 +03:00
Eugen Wissner e8bd41c70d
Fix comment before contract
Fixes #451.
2021-09-07 14:29:45 +02:00
belka-ew f6490b31c9
Format multiline arrays first (#538) 2021-06-16 17:23:27 +03:00
Eugen Wissner 995c21ab87 Format do like body after function attributes 2021-06-14 21:06:32 +00:00
Eugen Wissner 821b9be9e9 Fix double array indentation inside parens 2021-06-12 05:39:30 +00:00
Eugen Wissner ea36fbf58b
Add single_indent option 2021-05-18 06:36:57 +02:00
Eugen Wissner 1f21a97713 Don't indent associative array keys as labels 2021-03-09 11:38:33 +01:00
Eugen Wissner c4b6a7e7e3 Don't write a space after the return attribute
Fixes #521.
2021-02-27 16:06:06 +01:00
Eugen Wissner e6199aaa9b Don't output an extra newline after a comment
with keep_line_breaks=true.

Fixes #509 and #490.
2020-10-10 07:25:27 +02:00
Hackerpilot 41e8c05558 Fix #515 2020-10-07 02:19:55 -07:00
Brian Schott 7659b1ae1a
Fix Issue 508 (#511)
Fix Issue 508
merged-on-behalf-of: Brian Schott <Hackerpilot@users.noreply.github.com>
2020-10-01 08:35:20 +02:00
Eugen Wissner eab4cac12f Regenerate line break hints after newline
Fixes #486.
2020-09-04 00:14:25 +02:00
Eugen Wissner 94351246f6 Keep line break after function attributes
Fixes #504.
2020-09-02 09:09:19 +02:00
Eugen Wissner d100c40dab Print colon in AA before identifiers 2020-08-27 09:43:25 +02:00
Eugen Wissner 58b2c6ebc6 Break line on multiline strings
Fixes #476.
2020-08-10 15:25:59 +02:00
Mathis Beer b5dbb0e031 Fix issue 483: indent continuing case statements on the same level 2020-07-22 10:27:52 +02:00
Mathis Beer e4f2f20720 Fix issue 497: insert space before function/delegate in function type that returns template instantiated with parenless value argument 2020-07-20 08:04:51 +02:00
Eugen Wissner ef83514541 keep_line_breaks: Compare with the token end line 2020-03-24 14:39:31 +01:00
Eugen Wissner 394da5d02a Fix break after comma, before this 2020-03-22 17:54:59 +01:00
Eugen Wissner 5f0d2843e6 Support disabling automatic line breaks
Support disabling automatic line breaks With --keep_line_breaks.
2020-03-07 21:14:10 +01:00
Eugen Wissner 27929e4cc5 Wrap the argument list of a template function
Fixes #454.
2020-01-12 22:49:16 +01:00
Eugen Wissner 0795a477f1 Put space between a comment and an identifier
Fixes #452.
2020-01-05 23:11:18 +01:00
Eugen Wissner 8f779b33bf Put a space in contract expressions
Fixes #448.
2020-01-05 20:28:56 +01:00
WebFreak001 79ae2c09d0 trivially fix #195
probably fixed in previous libdparse
2019-11-25 17:09:51 +01:00
WebFreak001 28b32d9d77 trivially fix #134
was fixed in the past
2019-11-25 17:09:51 +01:00
WebFreak001 d33b878965 fix #430 already working
resolved with previous libdparse update
2019-11-25 17:09:51 +01:00
sobaya b3946b7525 Add: Test for nested struct formatting 2019-08-03 08:55:32 +09:00
sobaya 05db8ae8fa Fix: indentation for wrapping in struct initializer 2019-08-01 17:43:45 +09:00
sobaya 81c607a115 Fix: extrace space after first field 2019-08-01 16:58:41 +09:00
sobaya 1024f16715 Add: struct fields to the test of issue 256 2019-07-30 23:04:02 +09:00
sobaya ac61efe767 Fix: Issue 256 "named member struct initialisers" 2019-07-30 13:02:48 +09:00
Kotet 3af8edc57f Fix #361 - Unexpected empty new line if function header ends with a comment 2019-05-14 09:00:56 +09:00