Is your feature request related to a problem? Please describe.
While implementing an example Pico formatter in Rascal as part of usethesource/rascal-language-servers#677, it turned out that the current Tree2Box and Box2Text algorithms do not allow for the amount of customization that the configuration options of LSP do.
Describe the solution you'd like
An extension of Tree2Box and Box2Text that allow for at least supporting LSP's formatting options.
- Tab size - how many spaces to indent with.
- Tabs or spaces - pick whether to use tabs or spaces.
- Trim trailing whitespace - trim whitespace on the end of a line.
Optional
- Insert final newline - insert a newline at the end of a formatted string [could be a
String utility]
- Trim final newlines - remove newlines at the end of a formatted string [could be a
String utility]
Describe alternatives you've considered
Implement as string utilities (#2373). This requires re-processing the carefully formatted string, where a tree-based approach suits the problem better.
Additional context
-
Is your feature request related to a problem? Please describe.
While implementing an example Pico formatter in Rascal as part of usethesource/rascal-language-servers#677, it turned out that the current
Tree2BoxandBox2Textalgorithms do not allow for the amount of customization that the configuration options of LSP do.Describe the solution you'd like
An extension of
Tree2BoxandBox2Textthat allow for at least supporting LSP's formatting options.Optional
Stringutility]Stringutility]Describe alternatives you've considered
Implement as string utilities (#2373). This requires re-processing the carefully formatted string, where a tree-based approach suits the problem better.
Additional context
-