-
Notifications
You must be signed in to change notification settings - Fork 136
Closed
Description
lsp--imenu-create-index
from lsp-imenu.el
(in lsp-mode) does not take hierarchy into consideration. I think it might be useful if it can be used to visualize arbitrary symbol hierarchy, where the most common ones are:
- member hierarchy: members of a type (e.g. members of a class/struct; enumeration constants in an enum; members in a module/namespace) are recursively expanded
struct B { B* x; int b; };
struct A { B b; int c; };
may expand to
A
B b
int b
B* x // pointer types can optionally be expanded
int b
B* x // but the client needs to explicitly trigger the expansion to avoid infinite recursion
int b
B* x
int c
- caller tree of a callable (e.g. function,method,...). (may be generalized to reference tree)
void foo() { bar(); quz(); foo(); }
void bar() { quz(); }
is visualized as:
quz
foo
foo // explicit expansion to avoid infinite recursion
bar
foo
foo
- inheritance hierarchy (e.g. all derived classes of a C++ base class, or overriden virtual functions of a base function; Rust trait/impl; Java interface...)
struct B : A {};
struct C : B {};
struct D : B {};
is visualized as:
A
B
C
D
interface SymbolInformation {
name: string;
// id is missing; name may be insufficient to identify a symbol
kind: number;
location: Location;
containerName?: string; // containerName is a string. If it was an identifier, it could be used to describe a parent pointer tree
}
When the point is at a reference of a symbol, textDocument/documentHighlight
or other mechanism can be employed to highlight the imenu entry and there can be some keys to trigger these different kinds of hierarchies.
- $cquery/typeHierarchyTree is a kind of inheritance hierarchy
- $cquery/memberHierarchy is a kind of member hierarchy.
- $cquery/callerTreeInitial is a kind of call hierarchy.
I'd like to know if such extensions have been implemented in other servers. We should unify these server API interfaces and even standardize it.
Alexander-Miller, iromise, tutysara and artisdom
Metadata
Metadata
Assignees
Labels
No labels