[RFC] Implement type/call hierarchy handling #4221
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR Prelude
Thank you for working on YCM! :)
Please complete these steps and check these boxes (by putting an
x
insidethe brackets) before filing your PR:
rationale for why I haven't.
actually perform all of these steps.
Why this change is necessary and useful
This is the client side pull request related to ycm-core/ycmd#1733
Again, tests and documentations are missing. Documentation is the easy part, but tests would be dreadful...
popup look
I have not paid much attention to the look of the popup.
The look is slightly off - for deep hierarchies the location of references in the file (
foo.cpp:8
for example) becomes misaligned.The context is is not right aligned either.
Basically, it's functional but ugly. If someone would be up for it, please send patches my way.
How to use this thing?
The only publicly available function here is
youcompleteme#hierarchy#StartRequest( kind )
. It takes'call'
or'type'
as the argyment. From there, YCM will fire a "prepare hierarchy" request and then open a popup with the results.While the popup is open, the following keys are used:
<Tab>
to resolve a hierarchy item in the "subtypes" / "incoming" direction.<S-Tab>
to resolve a hierarchy item in the "supertypes"/"outgoing" direction.<Up>
/<Down>
to select items in the popup.<CR>
to jump to the selected item and close the popup.<Esc>
to close the popup without jumping.Maybe we want more key bindings here?
<C-n>
/<C-p>
andj
/k
come to mind...Oh yes, there's also
<plug>(YCMCallHierarchy)
and<plug>(YCMTypeHierarchy)
that just callyoucompletem#hierarchy#StartRequest()
. Users should be using these, instead of directly calling the function.This change is