-
Notifications
You must be signed in to change notification settings - Fork 682
No settings for Hack code formatter #996
Comments
This should probably be filed against HHVM, as this uses
IIRC the plan is to make a complete replacement once @ericlippert's work on the full fidelity parser is complete |
@fredemmott What does FB use for formatting, then? |
|
An FB-free option would be to extend https://github.com/phplang/phack to fully support parsing Hack (as well as the transpilation stuff, it contains an extended nikic/php-parser), then either address phplang/phack#7 or build a separate printer on top of that AST. The work needed on the parser is pretty much stuff not marked 'Alpha' in the table in Phack's README |
You would also need to add blank lines (as statements?) to the AST so they are preserved in the output (I think PHP-Parser already has AST nodes for non-doc comments). |
@fredemmott Does it have options for indent/margin? I couldn't see any in that file. |
hardcoded - but that's the new thing, so might get fixed :) AIUI this should be an issue against hack, as it'll still end up talking to the typechecker server; a fix would probalby involve the options going into .hhconfig. |
https://github.com/facebook/hhvm/blob/master/hphp/hack/src/hackfmt/hack_format.ml#L217 < reference for hardcoding |
There doesn't appear to be any settings for the Hack code formatter. At a minimum I think it should support:
The double space indent can be changed to a tab with post-processing provided you have no multiline string literals, but there's no workaround for the code width and indent size which influence the wrapping, and 80 chars would be considered too narrow by many teams.
Versions
The text was updated successfully, but these errors were encountered: