Comments (8)
@NColey if your example is correct, then the problem is case class A
must be followed by a list of parameters (otherwise it should be a case object
). when i tried class A
instead, it aligned correctly.
from scalafmt.
@kitbellew I'm sorry that was a typo on my end. The issue I'm seeing is specifically with case object
s. I have fixed the example.
from scalafmt.
@NColey weird. case object
works for me. specifically, i added this:
<<< ONLY #3762
object a {
case object A extends Something
case object AAA extends Something
}
>>>
object a {
case object A extends Something
case object AAA extends Something
}
to the end of DefaultWithAlign.stat
file and ran FormatTests
.
from scalafmt.
are you sure that your example is not just similar to what you specified but in reality is a lot longer? scalafmt no longer allows alignment to overflow maxColumn
unless explicitly configured to do this.
from scalafmt.
@kitbellew so I created a super minimal reproduction of the issue here if that helps. If you clone that down and run scalafmt
with the latest CLI it will remove the alignment from extends in alignment.scala
even though it was previously aligned (or at least it does for me with scalafmt 3.7.17
as the cli version).
Re maxColumn
-- when I bumped the version from 2.3.2
to 3.7.17
I responded to anything that was flagged as an error (i.e settings being renamed or removed) and that one wasn't flagged as an issue so I left it as is.
That said, if you look at the repo where I have reproduced this issue you can see I tried it with and without adjustments to maxColumn
and it still un-aligns case objects on the extends
portion. Totally open to something else in that config file being the issue though I have turned a number of settings on and off and can't seem to preserve the alignment that was there in 2.3.2
.
from scalafmt.
@NColey extends
is no longer owned by Defn.Object
but by the Template
field within it. so if you remove all your align { ... }
customizations, it formats correctly.
from scalafmt.
you should use AST Explorer linked from https://scalameta.org/scalafmt/docs/configuration.html#aligntokens
, it will show you tokens and trees.
from scalafmt.
OH! Oh wow thank you, that totally was the issue. I appreciate the AST Explorer suggestion as well, thank you so much 🙏 . I'll close this issue now but appreciate your help here.
from scalafmt.
Related Issues (20)
- 3.8.0 regression: tuple expression at the start of a line are moved to prior line (inside of match cases) HOT 2
- Scalafmt 3.8.0 update: suspicous reformatting HOT 3
- More newlines in unit tests after updating to 3.8.0 HOT 6
- Exception in scalafmt HOT 1
- Code no longer compiles after formatting HOT 1
- Implement fewer-braces rewrite
- Scalafmt in scala 3 dialect adds a new line after a `'` expression which changes behaviour of program HOT 6
- Properly formatted code using zio method `*>` is formatted so the code is no longer valid
- Wrong formatting of code blocks with partial functions returning tuples HOT 2
- apply more stringent scalafmt formatting
- `org.scalafmt.cli.FaliedToFormat` regression with `scala-xml` code on `RedundantBraces` rewrite rule HOT 4
- With `newlines.source = keep` linebreaks are not preserved in lists with non-numeric entries HOT 2
- With `newlines.source = keep` linebreaks are not preserved in function parameter lists HOT 3
- Preserve newlines more strictly HOT 12
- RedundantParens removes too much parens HOT 2
- `PositionExceptionImpl` complaining about expected `)` when encountering valid `<-` in for comprehension HOT 2
- Annotation argument is not a constant
- Feature request: code style for `match` dot-notation HOT 5
- Error with `RedundantBraces` and XML attribute in v3.8.1 HOT 1
- `if` + `then` rejected with significant indentation off HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scalafmt.