-
Notifications
You must be signed in to change notification settings - Fork 147
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
Handle long type parameter lists #77
Comments
+1 Also, if the method has several parameter lists the formatter currently puts them all on one line, even if I manually So:
is always reformatted to
whereas
is kept as is (or even properly aligned). |
+1 The problem only gets worse with widespread
instead of:
|
+1
|
+1 |
I'd also really like to see this feature, and I'd be willing to open a PR to implement it myself. However, I could use a few pointers from a maintainer with regard to where to start in the codebase, if anyone's willing to point me in the right direction. |
At a glance it looks like a quick and dirty proof of concept could be achieved by disabling formatting on this line. i.e. change to Then create an executable jar to test whether or not sample scala file containing various long type paramater lists leaves applicable code blocks unformatted. If that works we can look into creating a new Preference Descriptor that allows users to opt-in to type parameter list formatting. |
This is fixed in 0.2.4 To enable the below formatting style set either
Note that this does not automatically format sources to the desired format, but rather prevents the default behavior of collapsing param groups into a single line. Also, type params can be placed on a newline, but unlike paren groups, a bracket group spanning multiple lines collapses to a single line (sorry, bracket handling code is seriously hairy). |
First, thanks for developing Scalariform. I use it hundreds of times a day.
The issue: I code in an extremely functional style, and often have very long type parameter lists. For example, this is a function signature from my code:
def relativeBenchmark[E <% RuntimeConfig => ExperimentRunner[R], R <% RuntimeConfig => ExperimentSummary](experiment: E): Double
Scalariform, used from Eclipse, tries to put all the type parameters on one line, meaning the above signature would extend beyond the 80 character mark.
Ideally: Please detect when a type parameter list is long and distribute it across multiple lines. I like this format:
def relativeBenchmark[
E <% RuntimeConfig => ExperimentRunner[R],
R <% RuntimeConfig => ExperimentSummary](experiment: E): Double
I'd be happy with: Don't format type parameter lists that extend across multiple lines.
The text was updated successfully, but these errors were encountered: