Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a way to specify hackfmt options via .hhconfig #8266

Closed
ssandler opened this issue Jul 19, 2018 · 3 comments
Closed

Add a way to specify hackfmt options via .hhconfig #8266

ssandler opened this issue Jul 19, 2018 · 3 comments

Comments

@ssandler
Copy link
Contributor

HHVM Version

3.27.1

Operating System and Version

MacOS High Sierra

Standalone code, or other way to reproduce the problem

The LSP currently makes it possible to specify using tabs vs. spaces, and the indent width (which covers the --tabs and --indent-width arguments of hackfmt. It would be great to be able to specify --line-width somehow as well.

@fredemmott
Copy link
Contributor

Given the LSP already supports editor-provided formatting settings (in FormattingOptions), we should probably extend that.

If that's impractical, an initializationOption would likely be best

@fredemmott fredemmott changed the title Add a way to specify --line-width when running hackfmt via LSP Add a way to specify hackfmt options via .hhconfig Aug 7, 2018
@fredemmott
Copy link
Contributor

fredemmott commented Aug 7, 2018

Following discussion in slack:

  • .hhconfig for now
  • in case of conflict with LSP formatting options, editor wins to avoid confusing/frustrating users
  • example settings: hackfmt.tabs=true, hackfmt.line_width=180 - not stuck to this syntax, but we want individual settings, not a CLI args string or string list

jeffomatic added a commit to jeffomatic/hhvm that referenced this issue Feb 2, 2019
This change allows users to control hackfmt options through .hhconfig.
The following options can be configured:

- hackfmt.add_trailing_commas
- hackfmt.indent_width
- hackfmt.tabs
- hackfmt.line_width

Each of the options will be superseded by the equivalent command-line
arguments if provided, except for add_trailing_commas, which is not
exposed via CLI args.

hackfmt will make a best-effort attempt to discover the location
of .hhconfig. It will search ancestor paths of the given file, or
if no file is provided, the working directory. If --root is
provided explicitly, hackfmt will look for .hhconfig under that
directory.

Addresses facebook#8266
hhvm-bot pushed a commit that referenced this issue Feb 13, 2019
Summary:
This change allows users to control `hackfmt` options through `.hhconfig`. The following options can be configured:

- `hackfmt.add_trailing_commas`
- `hackfmt.indent_width`
- `hackfmt.tabs`
- `hackfmt.line_width`

Each of the options will be superseded by the equivalent command-line arguments if provided, except for `add_trailing_commas`, which is not exposed via CLI args.

Addresses #8266
Pull Request resolved: #8422

Differential Revision: D13825102

Pulled By: fredemmott

fbshipit-source-id: 92b55a109aa56f1fadb16aab926cc0670890a92c
@ssandler
Copy link
Contributor Author

Closing as this was fixed in #8422

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants