Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] Implement type/call hierarchy handling #4221

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

bstaletic
Copy link
Collaborator

@bstaletic bstaletic commented Feb 11, 2024

PR Prelude

Thank you for working on YCM! :)

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your PR:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have included tests for the changes in my PR. If not, I have included a
    rationale for why I haven't.
  • I understand my PR may be closed if it becomes obvious I didn'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> and j/k come to mind...

Oh yes, there's also <plug>(YCMCallHierarchy) and <plug>(YCMTypeHierarchy) that just call youcompletem#hierarchy#StartRequest(). Users should be using these, instead of directly calling the function.


This change is Reviewable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant