When you add a whitespace or a semicolon to the end of the line, it works just fine. But I think I know what causes this. Look at the string below:
"var value\(raw: i) = 6 func foo() {}"
When I input it to the CodeBlockItemListSyntax
the macro generates this:
var value0 = 6
func foo() {
}
Did you see what it did? It automatically indented the code for you. It also does the same thing with the semicolon (and also escape sequences?), too:
"var value\(raw: i) = 6;func foo() {}"
Into:
var value0 = 6;
func foo() {
}
I think what CBILS
doest is just stash the string literals side by side (using your input):
"var value1 = 0var value2 = 0var value3 = 0"
When swift tries to parse this it does it like so:
(var value1 = 0var) (value2 = 0var) (value3 = 0)
┬────────────┬─── ┬──────────┬── ─┬────────
| ╰some | ╰─some ╰ set value
╰─ var init. value╰─ set value value
And when swift tries to indent this it puts a line break between every statement (in parenthesis), so the end result becomes:
var value1 = 0var
value2 = 0var
value3 = 0
But if you make the value a string literal an instead of an integer literal it works fine. Why is that?
Because anything that has a start and an end (terminating) (e.g. ()
""
[]
{}
) has no possibility of intersecting with something (e.g. ""abc
-> ("")(abc)
)
The developer for this library has forgot to put seperators between the code blocks. So put a whitespace or a semicolon at the end to fix this issue. And report the bug to the authors. :)