Parametric: formatting - #677
Conversation
79abb8f to
f0930d1
Compare
|
DavyLandman
left a comment
There was a problem hiding this comment.
I see this is a bit of a challenging API, especially if we want to make this more user-friendly for DSL users.
I have the feeling we should involve @jurgenvinju who has been on the topic of formatting/pretty-printing for quite some time already. I suspect that we're missing some opportunities of matching this up with something already in the standard library, or something that we might should add to the standard library first.
|
This PR is missing the adjacent: |
4b58c98 to
4aca661
Compare
bac08fb to
2b7fb47
Compare
DavyLandman
left a comment
There was a problem hiding this comment.
I think this is going in the right direction, but I'm not sure what I should have been reviewing, the implementation or the design?
2b7fb47 to
e05f700
Compare
9e7fe1a to
523c2fe
Compare
523c2fe to
ab448fc
Compare
|
Is there an opportunity to use the Focus abstraction for this contribution? Especially for the range alternative. That way language engineers don't have to go search for the right trees anymore, and they could easily support only a few top-level types for starters, and they could easily recover the required indentation level from the parent tree's layout siblings. |
@jurgenvinju I thought about this, but the tricky part there is that a range does not necessarily correspond to an exact tree. Even if we give a focus tree that ends at the largest tree encapsulating the range, there would still be the need to filter the edits so they are not outside of the given range. |
7a9d722 to
01d9853
Compare
|
…ure/lsp-formatting
This was a detailed manual merge
There was a problem hiding this comment.
ESLint found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.
|
|
@jurgenvinju and I made sure that all the changes necessary to format Rascal code are now available in #1102. This PR will be left draft for a while until we are ready to clean this up and resume work on DSL formatting. |
This work by @toinehartman and YT introduces the Rascal formatter to VScode. * [x] links the Rascal formatter from the stdlib to the `formatDocument` and `formatSelection` capabilities in LSP for Rascal * [x] maps all FormattingOptions, taken from: #677 * [x] support for formatting only a selection via the `Focus` mechanism, also taken from #677 * [x] works with subTreeEditFormatter from `util::Formatters` correctly * [x] adds two UI tests, one for whole file formatting and one for selection formatting



_range == _input@\loc.Design:
Closes #130.