-
Notifications
You must be signed in to change notification settings - Fork 49
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
Indentation is way off #27
Comments
I have an example of some multi-line expressions that took a bit of work to format. Here's about what I would like: let simple = Add(
left: Number(1),
right: Number(2)
)
let complex = Multiply(
left: Add(
left: Number(1),
right: Number(2)
),
right: Number(3)
) But this is what you currently get: let expression = Add(
// this level of indent is kind of ok
left: Number(1),
right: Number(2)
)
// <= but it would be nice for this to be back here
// <= indent should be reset back to the previous statement
// but is instead here, and we keep getting deeper!
let complex = Multiply(
left: Add(
left: Number(1),
right: Number(2)
),
right: Number(3)
) Actually, here's the same thing in Ruby: simple = Add.new(
Number.new(1),
Number.new(2)
)
complex = Multiply.new(
Number.new(1),
Add.new(
Number.new(2),
Number.new(3)
)
) Which is probably a much more sane approach: let simple = Add(
Number(1),
Number(2)
)
let complex = Multiply(
left: Number(1),
right: Add(
left: Number(2),
right: Number(3)
)
) |
@sharplet this indentation around parens was actually intentional. Rather than aligning on colons like Objective-C this is setup to align on the opening paren similar to python. The second example is definitely an issue though. I'm definitely open to suggestions about this. Xcode currently indents this like this: let bar = Add(
left: 5,
right: 6
) |
@supermarin @sharplet if both of you could try the branch from this PR #30 that would be great. It entirely changes indentation. It is not currently handling the parens example any differently, but it should fix the other examples. |
Here are 2 examples, let's start with a simpler one:
As you type, indentation gets immediately wrong on
required init
,. Even if you select all and+
, it stays screwed.A more complex example is by pasting the sample code from Quick:
The text was updated successfully, but these errors were encountered: