-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Weird multi-line string indentation #501
Comments
this looks correct to me, if you look at how the text is placed in relation to the opening """ in the original text it's the same in the formatted output. It can lead to weird text in some cases, but you can indent the words more as one 1 way to get around it. This is done intentionally so that strings are left intact. This nests because the current rule is that if a string is multiline in a function call, the function call is automatically nested. |
Well, that's not the invariant I expected :)
parses the same and looks nicer, imho. |
true, would this backfire in other cases though? |
Well, Julia disregards
Sooo, sure, there are case where indentation isn't possible. |
would it be bad to align the lines to the first " if they currently appear prior to it? If it's a good idea it wouldn't be difficult to do (i think) |
Not 100% sure if it's related, but this function myfunction_foo(io::IO)
write(io, """
""")
end goes into function myfunction_foo(io::IO)
write(
io,
"""
""",
)
end which does seem pretty weird to me. |
that's intentional. the distance between the start and end quotes stays consistent. |
That doesn't seem necessary? The string wouldn't change? So it could just go into function myfunction_foo(io::IO)
write(
io,
"""
""",
)
end Or if we do insist on keeping the distance, then it could go into function myfunction_foo(io::IO)
write(
io,
"""
""",
)
end which would still be a bit weird, but slightly better? Basically, it should be aligning the ending |
Yeah, that's not required. Julia doesn't care about leading whitespace common to all lines inside of the string, cf
|
these are different based on the positioning of the quotations though, which is why it's maintained. |
They are only different based on the distance between |
if the other way is more aesthetically pleasing I would be open to it. Not sure when i would get around to doing a PR atm |
Imho we should never indent multi-line strings by less than the surrounding code. IIRC CSTParser handles multi-line strings with common leading whitespace fairly well, so maybe it'll be easy to implement this here. |
makes sense. I'd be assist with a PR. |
Not strictly an issue since it parses correctly, but does look weird.
Originally reported at julia-vscode/julia-vscode#2545.
The text was updated successfully, but these errors were encountered: