-
Notifications
You must be signed in to change notification settings - Fork 22
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
Parts of expression should be indented relative to beginning of expression #11
Comments
There is currently no option to change the alignment as you want. At the moment, Floskell treats declarations inside I'm would like to understand exactly what option you're asking for. I see three possibilities at the moment
For options one and two, I would agree that a configuration option would fit in the design of Floskell. Option three feels a bit much of a special case, but might be implemented as a style option. |
I think something more like #2 is what I'm looking for. However, perhaps my request is more complex than what we've described so far. I think I'd say that for any expression (e.g. an infix expression, a normal function application, a case expression, etc), the 'subparts' of that expression, when they are moved to subsequent lines, are indented relative to the beginning of the expression. I think this rule should apply hierarchically, when expressions are nested inside each other. Here's another example, using
I'd like the cases that follow
Here's a more complex example. Assume the column limit is 80 columns. Undesirable, what floskell does today:
desired:
Here's another example, where we have several levels of nesting (e.g. the Undesirable, what floskell does today:
desired:
I think I've heard this idea, or something similar, called "the rectangle rule". Essentially, for every expression, draw the smallest possible rectangle that includes all parts of that expression; it should include no other expressions. I would identify the right hand side of any let binding/do binding/where binding/etc. as an expression. All of the examples given above violate the rule because the cases are less indented than It's probably helpful to look at some other examples... but this comment has gotten long enough. |
Thanks for the detailed explanation. I agree with you that this would fit nicely as an option for Floskell. |
Hi there! First, I love what you've created! Thank you!
My issue is that some infix operators, when part of an expression that spans multiple lines, can result in subsequent lines being indented less than the first line. Here's an example:
I don't like that the
<> makeASequence
is indented less than the firstmakeASequence
. At first glance, I think it misleads the mind into thinking that the second line is unrelated to the first. And it's different from normal function application, where I have an option to make arguments on subsequent lines align with the first argument; I can't do anything like that here.Here's what I would like:
I think that a continuation of an expression should be at least as indented as the beginning of that expression, or more indented. Note that
<>
seems to be known by floskell as a base infix operator.I'd be fine with an option that allowed for controlling this:
A) align subsequent lines with the first
B) indent them relative to the first by some constant
I think this option would fit right in with your existing option section, indent.
I tried changing all the obvious options in my floskell.json to see if any of them would achieve what I wanted. I also tried all the built-in styles. No luck. Hopefully I didn't overlook an already existing option.
The text was updated successfully, but these errors were encountered: