Getting Started: Tools
The core tools are:
hh_client: this is the command line interface for Hack's static analysis; it is needed to verify that a project is valid Hack, and is used to find errors in your programs
hhvm: this is used to execute your Hack code, and can either be used for CLI (e.g.
hhvm foo.hack) or as a server, and has extensive documentation
You can use any plain-text editor to edit Hack files - however, enhanced integration with Hack is available for several editors.
We primarily recommend using Visual Studio Code with the VSCode-Hack extension; this provides standard IDE-like features such as syntax highlighting, go-to-definition, and in-line display of Hack errors.
hack-mode provides a major mode for Emacs users.
If you use a different editor or IDE with LSP support, configure it
hh_client lsp; if you use HHAST, you might want to configure it to
vendor/bin/hhast-lint --mode lsp, but keep in mind this will lead to your
editor automatically executing code from a project when that project is opened;
for this reason, the ALE integration has HHAST disabled by default, and Visual
Studio Code prompts to confirm before executing it.
Hack dependencies are currently managed using Composer, which must be executed
with PHP. Composer can be thought of as an equivalent to
hackfmtis a CLI code formatter included with HHVM and Hack, and is also used by the various editor and IDE integrations
- HHAST is added provides code style linting, and the ability to automatically modify code to adapt to some changes in the language or libraries
- hacktest and fbexpect are commonly used together for writing unit tests