You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a question here trying to setup alignment on spark tokens. The problem I am facing that all the tokens do align with each other, which is in some cases fine.
But I'd like that some certain tokens align only with themselves. Like as and / in my example align with each other. Is there any way to configure so that:
as aligns only with as
/ aligns only with /
bunch of other tokens: ===, =!=, isin still align with each other
.select(
tpu /"field1" as "field1",
tpu /"fd" as "field1",
lit("sys1") as "field1",
tpe /"field1" as "field1",
bu /"fd" as "field1",
lit(null) as "field1"
)
Expectation
I would like the formatted output to look like this:
.select(
tpu /"field1" as "field1",
tpu /"fd" as "field1",
lit("sys1") as "field1",
tpe /"field1" as "field1",
bu /"fd" as "field1",
lit(null) as "field1"
)
The text was updated successfully, but these errors were encountered:
agolovenko
changed the title
[Question] Configure token to align only with itself
Configure token to align only with itself
Sep 4, 2024
As far as I understand, this is a new feature that I request. But again, I'd appreciate some comments on this topic, so far it's been quiet here.
If it's a new feature, then I'd propose introducing alignment groups. So that the tokens would align with each other only if they a members of the same group. The existing alignment tokes like (->, %, %%) would form the default group which would be also a default value for a group for backward compatibility of configs.
The config might look like this:
align.tokens."+" = [
{
group = "spark-select"code = "as"owners = [
{
regex = "Term.ApplyInfix"
}
]
},
{
group = "spark-select"code = "/"owners = [
{
regex = "Term.ApplyInfix"
}
]
},
{
group = "default"// not mandatory to specify 'default' group code = ":+"owners = [
{
regex = "Term.ApplyInfix"
}
]
}
]
Hi,
I've got a question here trying to setup alignment on spark tokens. The problem I am facing that all the tokens do align with each other, which is in some cases fine.
But I'd like that some certain tokens align only with themselves. Like
as
and/
in my example align with each other. Is there any way to configure so that:as
aligns only withas
/
aligns only with/
===
,=!=
,isin
still align with each otherConfiguration
Problem
Scalafmt formats code like this:
Expectation
I would like the formatted output to look like this:
The text was updated successfully, but these errors were encountered: