-
Notifications
You must be signed in to change notification settings - Fork 260
LSP Extensions
Aside from definitions/references/workspace symbol, ccls provides some LSP extensions that find base/derived classes/methods, vars of a type, callers of a function.
It can be seen as a specialized textDocument/references
. It finds all variables when the cursor is at a type of a variable (the type of the variable will be used). Whether local variables/parameters/struct members are returned can be specified with kind
.
- params:
TextDocumentPositionParams
extended withkind
- return:
Location[]
Find callers (callee: false
, default) or callees (callee: true
) when the cursor is at a function.
The method returns either a flattened Location[]
, or a hierarchical type.
- params:
TextDocumentPositionParams
extended withcallee, callType
- return:
Location[]
- initial params:
TextDocumentPositionParams
extended withcallee, callType
. The result includesid
andkind
which are used to expand a node. - params:
id, kind, callee, callType
Optional levels
and qualified
can be used to customize the hierarchy.
Find base classes (derived: false
, default) or derived classes (derived: true
).
It can also used to jump between the primary template and partial specializations.
- params:
TextDocumentPositionParams
extended withderived
- return:
Location[]
- initial params:
TextDocumentPositionParams
extended withderived
. The result includesid
andkind
which are used to expand a node. - params:
id, kind, derived
Optional levels
and qualified
can be used to customize the hierarchy.
Find member variables/functions/types when the cursor is at a class/struct/union or a variable (the type of which will be used). Find local variables when the cursor is at a function.
-
kind: 4
(default), member variables are returned. -
kind: 3
, member functions are returned. -
kind: 2
, member types are returned.
- params:
TextDocumentPositionParams
extended withderived
- return:
Location[]
- initial params:
TextDocumentPositionParams
extended withderived
. The result includesid
andkind
which are used to expand a node. - params:
id, kind, derived
Returned nodes can be furthe expanded if kind: 4
.
Optional levels
and qualified
can be used to customize the hierarchy.
Semantic movement among declarations.
- params:
TextDocumentPositionParams
extended withdirection
. The allowed values ofdirection
:-
"U"
: parent -
"D"
: first child -
"L"
: left sibling -
"R"
: right sibling
-
- return:
Location[]