Hack Language Support in PhpStorm Postponed

Hack is a programming language for HHVM by Facebook. Support for Hack has been the most-voted feature request in our PhpStorm issue tracker for quite a while. We have announced in our roadmap that we would investigate the possibility of introducing Hack support in the IDE by PhpStorm 9 release. So here is an update on this.

Our team has conducted a thorough investigation and developed a prototype. We’ve reached a decision to postpone Hack language support in PhpStorm. Let me shed some light on our reasons.

  • We agree with Facebook that it’s not viable to write support for Hack from scratch.
  • We’re unable to deliver the level of functionality & quality expected from an IDE by JetBrains, with the currently available Hack tooling APIs.
  • Official tooling is coming via Nuclide, an IDE by Facebook.

The entire concept of getting Hack in PhpStorm was based on reliance on Hacklang built-in tooling support, including typechecker, reference resolution, and completion, all of which are part of the normal distribution package. Initial prototyping showed that using this approach was feasible, but further we went into development, the more we found it to be unsuitable for anything more serious than experiments.

Why we don’t want to write our own support for Hack

You might ask, “Why doesn’t JetBrains just write their own support for Hack?”. The answer is, “Hack is not PHP.”

We’d have to provide full support for a complete new language, which entails implementing a parser, type checker, navigation, completion, inspections, and so on. No part of PHP support that we have now can be reused for Hack, given the fundamental differences between the languages. We’d then have to maintain and enhance it, closely following the evolution of Hacklang.

All this would require a significant effort from our side, thus delaying other improvements and features that need to be implemented in other subsystems of PhpStorm. This would affect over 300,000 PHP developers using PhpStorm. Given the current adoption rate of Hack, we believe this is a trade-off that we should not rationally make.

With the current Hack tooling API, we’re unable to deliver the level of functionality & quality expected from an IDE by JetBrains

During our initial investigation, we relied on HHVM and Hack tooling running within self-contained Vagrant images, providing users with both runtime and IDE tools (annotations, completion, and so on). That was the only way to bring to all the platforms supported by PhpStorm (as HHVM itself is still not cross-platform), and to have the user environment set up and running with relative ease. Code completion and analysis were quite limited – similar to what Facebook provided for vi and Emacs users, plus some basic navigation. In addition, the way of reaching API services (via command line/SSH) has proved to be unsuitable for anything more serious than experiments, especially from the perspective of editor performance and stability.

We expected that, as our scheduled release approached, Hacklang tooling would mature, the APIs would become more suitable for real-world workloads, and the user experience would improve. Unfortunately that hasn’t been the case. As far as we know, the previously discussed improvement of the initial API is no longer part of HHVM/Hack strategy, and a completely new API to be used by Nuclide is being built. More on that below.

Given our team’s focus on prioritizing performance and editing experience, and despite our desire to bring Hack support into PhpStorm, with the current state of its tooling APIs we’re unable to provide the level of support that would meet either JetBrains’ quality standards or our customers’ expectations.

Official tooling: Nuclide, an IDE by Facebook

Some time ago Facebook announced Nuclide, a unified IDE for Hack/React/Flow. Nuclide is described as a set of packages for Atom editor. All advancements in Hack tooling API seem to be going into those packages. While these are supposed to be reusable by third parties, they have yet to be published, documented and tested for real-world usage.

While we look forward to the final result of Facebook’s effort, so far their focus has seemed to shift from the vision initially discussed. Bringing these services (and their configuration) into the picture would significantly complicate setup for PhpStorm users. As such, this effectively removes any possible integration from the PhpStorm 9 release timeframe.

Given the above, we’ve decided to postpone Hack language support in PhpStorm until either Hack language seems greater adoption or the options for integrating with the original tooling change dramatically.

We hope this answers the most urgent questions you’ve raised about Hack. Let’s live and see how things pan out.

Develop with pleasure!
– JetBrains PhpStorm Team

This entry was posted in General Announcements and tagged , , . Bookmark the permalink.