When https://github.com/facebook/reason/pull/1990 is merged, most cases where userland preservation of whitespace is absolutely a must-have, will be covered. There are other cases left, where whitespace preservation might make sense to group pieces of code together:
;
},
};
```
- objects/classes
Aside from jsx most things are trivial to implement now that the intelligent whitespace interleaving algorithm™ is in place.
The question is, should we? Prettier/Gofmt implements all of these cases.
Are there cases that are absolutely a must? In some cases (variants, record types?), it might hinder and introduce an extra burden on the developer.
The record and module type formatting cases particularly impact fields which are documented in rei files and refmt removes whitespace before the document blocks.
When https://github.com/facebook/reason/pull/1990 is merged, most cases where userland preservation of whitespace is absolutely a must-have, will be covered. There are other cases left, where whitespace preservation might make sense to group pieces of code together:
jsx
types with record rows
(poly)-variant types
record expressions
let make = (~greeting, _children) => { / spread the other default fields of component here and override a few / ...component,
initialState: () => {count: 0, show: true},
/ State transitions / reducer: (action, state) => switch (action) { | Click => ReasonReact.Update({...state, count: state.count + 1}) | Toggle => ReasonReact.Update({...state, show: ! state.show}) },
render: self => { let message = "You've clicked this " ++ string_of_int(self.state.count) ++ " times(s)";