Fixed `do_definition` to prevent jumping to base class
commit9a65738de92bd8c6a52e9c55c48684792c1657ad
authorMayank Patke <fishythefish@fb.com>
Wed, 6 Dec 2017 19:55:02 +0000 (6 11:55 -0800)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Wed, 6 Dec 2017 20:12:57 +0000 (6 12:12 -0800)
tree3a32d0addbbc4abbb8eaffa6ddff9e260e709db2
parent9d66ce82c9efdd74d0c6005309e5e968e5473fd6
Fixed `do_definition` to prevent jumping to base class

Summary: Cmd+Click (GoToDef) will no longer jump to a base class if that's where the most-derived constructor is defined. We do this by first filtering the results in `do_definition` down to those whose definition occurs in the class that is being clicked on. We then check to see if any of the remaining results are methods, so that we can jump to a constructor if it is defined. If no method exists, we will jump to the beginning of the class definition.

Reviewed By: ljw1004

Differential Revision: D6291848

fbshipit-source-id: 205b3e5bef20a4340ceb068ec1bd2f1ef7abe833
hphp/hack/src/client/clientLsp.ml
hphp/hack/test/integration/data/lsp_exchanges/definition.expected
hphp/hack/test/integration/data/lsp_exchanges/definition.php