scalafmt icon indicating copy to clipboard operation
scalafmt copied to clipboard

Is there a way to annotate a list/map to always keep it sorted?

Open feiluo-db opened this issue 2 years ago • 1 comments

Steps

Given code like this:

val myList = (
  "b",
  "c",
  "d",
  "a",
  ....
)

Expectation

I would like to add a comment/annotation to this long list to keep it sorted.

val myList = (
// sorted: start
  "b",
  "c",
  "d",
  "a",
  ....
// sorted: end
)

feiluo-db avatar Aug 11 '22 19:08 feiluo-db

Thanks for reporting! I think it's unlikely that it can be covered by scalaftmt, since this changes the semantics of the program and would go beyond what a formater should do.

tgodzik avatar Aug 12 '22 06:08 tgodzik