facebookarchive / nuclide

An open IDE for web and native mobile development, built on top of Atom
https://nuclide.io
Other
7.79k stars 682 forks source link

Outline, Hyperclick and other features stop working #1358

Closed ssandler closed 7 years ago

ssandler commented 7 years ago

Issue and Steps to Reproduce

I'm trying out Nuclide for Hacklang development. The issue is that almost all of the features stop working shortly after startup. Hyperclick just becomes a spinning wheel, the same for the outline, and mousing over objects does not reveal their structure. This happens reliably, and restarting always fixes it for a bit. I checked the Nuclide console and the Atom console, and saw no log entries at all.

This does not impact type checker errors. Those always work.

Expected Behavior

Hack support will either not fail, or will clean itself up quickly if it does.

Actual Behavior

Once this error occurs, these features never work until a restart of Atom.

Versions

Additional Details

ljw1004 commented 7 years ago

@ssandler Thanks for reporting. What you've describe is actually just a small tip of the iceberg where the connection between Hack and Nuclide is inadequate. I've spent the past six months rewriting all of this connection code (inside both the Hack project and the Nuclide project). The resulting work is currently in beta-testing with a small group of users, and I'm expecting it to go out in the 3.23 hhvm release (Nov17).

So sorry to say that I don't think it's worth pursuing this issue in the current legacy hack/nuclide.

How to unblock you? Hmm... I'm not actually sure. I'm kind of hoping you can live with this unacceptable behavior for a few weeks longer...

ssandler commented 7 years ago

Thanks for the speedy response @ljw1004 ! That's great to hear, and yes I can wait a few weeks 😄

Since you mentioned VScode... I was using VScode before trying this out, and wanted to switch over because the Nuclide toolset seems excellent. Pranay at Slack made a plugin for VSCode that works nicely and quite a few of us have been using it for Hack development for months. https://marketplace.visualstudio.com/items?itemName=pranayagarwal.vscode-hack. I'd be happy to put you in touch with him.

ljw1004 commented 7 years ago

Thanks for the pointer. Actually we're going for a slightly different approach. The way Pranay's plugin works is when VSCode asks for something e.g. "please show me hover at line 15 column 23" then it invokes a command-line utility hh_client --type-at-pos 15:23.

What we're doing is making hh_client lsp itself a native speaker of LSP. This means we have the ability to report stuff out-of-band (i.e. not solely in response to a request from VSCode). So for instance when hh_server stops, or is restarted, or is busy doing a typecheck, then the editor will show that straight away and can offer a "[Restart]" button when needed.

It also means that our LSP adapter has much easier access to the internals of hh_server. I'll be working to get Hack doc-comments into hover and autocomplete next month.

rightparen commented 7 years ago

Closing issue at @ljw1004 's request.

fredemmott commented 7 years ago

@ssandler: you can experiment with this by:

brew unlink hhvm
brew install hhvm/hhvm-preview

Then change getUseLspConnection() in ~/.atom/packages/nuclide/pkg/nuclide-hack/lib/HackLanguage.js to always return true (or Promise(true) depending on what version of nuclide you have)

We now have homebrew binaries for high sierra, but not sierra, so if you've not upgraded that'll be a slow build-from-source. I'll try to get sierra binaries/bottles up later today or tomorrow.

ssandler commented 7 years ago

Sorry for not replying here! I tried upgrading to hhvm 3.23 locally but the optional shape field change causes a lot of hh_client errors, and our servers aren't upgraded yet.

Question about that, the hhvm 3.22 docs suggest that there is a way to opt-out of optional_shape_field in 3.23. How does one do that?

fredemmott commented 7 years ago

disable_optional_and_unknown_shape_fields in experimental_options will get you this - however, this is likely to give you other problems - e.g. dependencies that target 3.23+ may not be usable with this set.

ssandler commented 7 years ago

Thank you!! That worked. I'll switch over to 3.23 full time so I can try out the LSP changes.

I did have to git update-index --assume-unchanged .hhconfig so that my changes to .hhconfig wouldn't propagate to coworkers laptops who have not upgraded to 3.23 (otherwise they'd get Failure("invalid experimental feature disable_optional_and_unknown_shape_fields")).