Packages icon indicating copy to clipboard operation
Packages copied to clipboard

[D] newline after constructor name before open parentheses produces unexpected results

Open ernest-bruce opened this issue 1 year ago • 1 comments

What happened?

i like to style my D code so that the open parentheses after a functionname goes on a separate line, which works in most cases: Screen Shot 2023-04-28 at 14 06 34

however, as shown here, this doesnt work as expected in class constructors: Screen Shot 2023-04-28 at 14 01 29 Screen Shot 2023-04-28 at 14 02 28 Screen Shot 2023-04-28 at 14 02 47

im using Sublime Text 4143

ernest-bruce avatar Apr 28 '23 21:04 ernest-bruce

A this token on its own doesn't denote a constructor. The pattern the syntax definition uses (simplified test\s*\() however matches only if all required tokens are on the same line, because ST doesn't include the linefeed into \s and does lexing line-per-line only. That's what is called line-blindness.

A workaround may be to use ST's branching feature, but this would theoretically need to be implemented for more such situations and adds a lot of complexity to the syntax definition.

deathaxe avatar Apr 29 '23 08:04 deathaxe