Closed Facsimiler closed 2 weeks ago
@Facsimiler are you reporting a bug, or are you asking for help in finding the right configuration parameter? if the latter, you should create a discussion or simply ask on discord.
@kitbellew I apologize. I've reviewed a number of online help instances, and gone through all of the settings, and it seems what I want to do is not possible. I meant to phrase this more as an enhancement request, and have updated the issue description accordingly. If what I'm requesting can already be done with existing settings, then please point me in the right direction.
@kitbellew I apologize. I've reviewed a number of online help instances, and gone through all of the settings,
Yes, it can be done. It's documented, with examples. So, perhaps, not all of the settings. Please see https://scalameta.org/scalafmt/docs/configuration.html.
@kitbellew If it's documented and there are examples, they are not on that page. Perhaps you could take a second to tell me what they are?
Something around https://scalameta.org/scalafmt/docs/configuration.html#binpackparentconstructors maybe ?
thank you, @tgodzik.
@Facsimiler please let us know if you still think the examples are not on that page.
@tgodzik @kitbellew I have tried those settings and they do not do what I want. They only insert newlines if the max column is exceeded. I want unconditional newlines before extends
, with
, and derives
. That doesn't seem possible.
Looks like the best we can do is binPack.parentConstructors = keep
but that will not split it into lines. I guess we don't have that setting then
keep
should work. re-opening.
@kitbellew @tgodzik Thanks, guys! I appreciate it!
keep
does work. please double-check, @Facsimiler .
I think @Facsimiler would want something along the lines of unfold
here.
@tgodzik Correct.
@kitbellew I mentioned in my original post that I could use keep
to retain the intended formatting, but I can't then change the single-line form to he multi-line form. So yes, some kind of unfold here (although that might imply unfolding any constructor arguments, which I don't want to do).
Ideally, I'd like a property something like newlines.alwaysBeforeExtendsOrDerives
. I guess some may want to keep with
clauses on the same line or a separate line, with explicit control of that too, but I'm not sure what to suggest for that...
@kitbellew I mentioned in my original post that I could use
keep
to retain the intended formatting, but I can't then change the single-line form to he multi-line form.
@Facsimiler when you say keep
without being more specific, this is understood to mean newlines.source = keep
.
if you had actually meant binPack.parentConstructors = keep
, saying so explicitly would have allowed us to avoid several iterations here.
@kitbellew Since I can't use parentConstructors = keep
unless I also have newlines.source = keep
, I didn't think that distinction was necessary. Since I want to use newlines.source = unfold
, I can't use parentConstructors = keep
in any case. I apologize that I didn't make that clear earlier.
@kitbellew Since I can't use
parentConstructors = keep
unless I also havenewlines.source = keep
, I didn't think that distinction was necessary. Since I want to usenewlines.source = unfold
, I can't useparentConstructors = keep
in any case. I apologize that I didn't make that clear earlier.
that is not accurate, you can use it with newline.source = null
(or not specifying it).
there's a reason why the submission template requires providing current configuration. perhaps next time you will be able to follow it.
I want to be able to force a newline before an
extends
(orwith
orderives
) clause, but there doesn't seem to be a way to achieve this.For example, let's say I have a definition such as:
No matter what formatting options I've used, I always seem to end up with:
I can't seem to obtain the former without using "keep" to keep the formatting, or changing the maxColumn setting to force wrapping earlier.
That is, I can't seem to find a way to reformat the latter to look like the former.
This formatting option is supported by IntelliJ, for example,
Am I missing something? If not, can I raise this feature as an enhancement request?
Thanks for your assistance!