Extensions are still a work in progress, there’s a TODO in the code and might appear some edge-cases after this PR #2674.
There’s a bit of ambiguity on extensions/comments/sequences and I lack the vision to have a clear desired output, so let me explain what are the differences with code examples.
Current pp output:
/* Extension with pexp_apply */
[%defer
cleanup();
]
/* Extension with comment with pexp_apply */
[%defer
/* 2. comment attached to expr in extension */
cleanup();
];
/* Let sequence + extension with pexp_apply */
let () = {
/* random let binding */
let x = 1;
/* 1. comment attached to extension */
[%defer cleanup()];
/* 3. comment attached to next expr */
something_else();
};
/* Let sequence + extension with comment with pexp_apply */
let () = {
/* random let binding */
let x = 1;
/* 1. comment attached to extension */
[%defer
/* 2. comment attached to expr in extension */
cleanup()];
/* 3. comment attached to next expr */
something_else();
};
Note how being inside a sequence makes formatting different and I think this shoudn’t be the case, but unsure if applying the same formatting would make sense. That’s why I’m openning this issue.
Related: Attributes and other expressions add single space as identation.
Extensions are still a work in progress, there’s a TODO in the code and might appear some edge-cases after this PR #2674.
There’s a bit of ambiguity on extensions/comments/sequences and I lack the vision to have a clear desired output, so let me explain what are the differences with code examples.
Current pp output:
Note how being inside a sequence makes formatting different and I think this shoudn’t be the case, but unsure if applying the same formatting would make sense. That’s why I’m openning this issue.
Related: Attributes and other expressions add single space as identation.