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

Call Hierarchy #468

Closed
svenefftinge opened this issue May 1, 2018 · 5 comments
Closed

Call Hierarchy #468

svenefftinge opened this issue May 1, 2018 · 5 comments
Labels
feature-request Request for new features or functionality
Milestone

Comments

@svenefftinge
Copy link
Contributor

The LSP should define a request from the client to server to obtain callers for a definition as well as obtaining the containing callable definitions (e.g. containing method declaration).
Based on that an editor can provide a call hierarchy helping the user to understand the code better.

@MarkZ3
Copy link

MarkZ3 commented May 4, 2018

Cquery has an extension for this. Perhaps a god place to start:
https://github.com/cquery-project/cquery/blob/master/src/messages/cquery_call_hierarchy.cc#L23

@dbaeumer
Copy link
Member

dbaeumer commented May 8, 2018

See also the discussion here microsoft/vscode-languageserver-node#346 about and idea to how more general implement this.

AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Jan 22, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Jan 23, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Jan 23, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Jan 23, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Feb 1, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Mar 6, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Mar 6, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Mar 6, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Mar 6, 2019
AlexTugarev added a commit to typescript-language-server/typescript-language-server that referenced this issue Mar 8, 2019
@dbaeumer dbaeumer added the feature-request Request for new features or functionality label Oct 31, 2019
@dbaeumer dbaeumer added this to the 3.16 milestone Oct 31, 2019
@kjeremy
Copy link
Contributor

kjeremy commented Jan 8, 2020

This is now implemented in rust analyzer: rust-lang/rust-analyzer#2698

@HighCommander4
Copy link

I am implementing this new API in the C++ language server clangd, and I have run into an issue:

The API consists of an initial textDocument/prepareCallHierarchy request to get a CallHierarchyItem based on a file location, and then callHierarchy/incomingCalls and callHierarchy/outgoingCalls requests which send a CallHierarchyItem as input and get back a list of CallHierarchyItems representing the children of the input item in the tree.

If the language server uses some sort of internal identifier to identify entities (such as functions) in the workspace, there is no way with the current API to "stash" such an identifier in a CallHierarchyItem such that the client sends it back in an incomingCalls or outgoingCalls request and the server knows what to operate on using that identifier. Instead, the server needs to "re-identify" the entity in question based on the user-facing fields in the CallHierarchyItem (name, location, etc.) only. For some server implementations, including ours, this process can be expensive and inaccurate.

There is a type hierarchy proposal which has a lot in common with this call hierarchy proposal, including having TypeHierarchyItems and calls to resolve the hierarchy one level at a time. In that proposal, TypeHierarchyItem has an optional data field of type any which can be used (and is used, by the clangd implementation of the type hierarchy proposal) to stash the server's internal identifier.

Could such a data field please be added to CallHierarchyItem as well?

@dbaeumer
Copy link
Member

Added the data property.

Also closing the issue since call hierarchies are part of the upcoming 3.16.0 spec.

@vscodebot vscodebot bot locked and limited conversation to collaborators Dec 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

5 participants