Please sign in to comment.
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hack `--ide-refactor` support for class constants
Summary: Added rename refactor support for class constants in Hack. Quick Explanation for the change in `findRefsService.ml`: Since identifying constants across the workspace is already supported in Find-References, adding rename support for class constants was initially a matter of just supplying the right types. Furthermore, although Find-References tends to ignore the definition of constants, methods, classes, etc.. we're usually able to include the definitions anyways when calling its services from the refactor command call by simply passing in the appropriate boolean value. However, in this case, finding and including the definition of constants hadn't yet been implemented in `findRefsService.ml`. My edits implement this so that when the user renames a constant, the constant is renamed at its definition as well. NOTE: Currently, renaming constants doesn't work for cases where it is being referenced with `self` or `static` (i.e. `static::CONSTANT`). I've put a task out for this and will try to revisit this issue later. Reviewed By: arxanas Differential Revision: D8758310 fbshipit-source-id: 3dd8feeda4d366bf3b350918ba4097e6e4974548
- Loading branch information
Showing with 440 additions and 248 deletions.
- +15 −1 hphp/hack/src/server/findRefsService.ml
- +7 −0 hphp/hack/src/server/serverRefactor.ml
- +2 −0 hphp/hack/src/server/serverRefactorTypes.ml
- +350 −213 hphp/hack/test/integration/data/lsp_exchanges/rename.expected
- +41 −11 hphp/hack/test/integration/data/lsp_exchanges/rename.json
- +25 −23 hphp/hack/test/integration/data/lsp_exchanges/rename.php
Oops, something went wrong.