Cross reference 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.
$ccls/vars
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:
TextDocumentPositionParamsextended withkind - return:
Location[]
$ccls/call
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.
hierarchy: false (default)
- params:
TextDocumentPositionParamsextended withcallee, callType - return:
Location[]
hierarchy: true
- initial params:
TextDocumentPositionParamsextended withcallee, callType. The result includesidandkindwhich are used to expand a node. - params:
id, kind, callee, callType
Optional levels and qualified can be used to customize the hierarchy.
$ccls/inheritance
Find base classes (derived: false, default) or derived classes (derived: true).
It can also used to jump between the primary template and partial specializations.
hierarchy: false (default)
- params:
TextDocumentPositionParamsextended withderived - return:
Location[]
hierarchy: true
- initial params:
TextDocumentPositionParamsextended withderived. The result includesidandkindwhich are used to expand a node. - params:
id, kind, derived
Optional levels and qualified can be used to customize the hierarchy.
ccls/member
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.
hierarchy: false (default)
- params:
TextDocumentPositionParamsextended withderived - return:
Location[]
hierarchy: true
- initial params:
TextDocumentPositionParamsextended withderived. The result includesidandkindwhich 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.
$ccls/navigate
Semantic movement among declarations.
- params:
TextDocumentPositionParamsextended withdirection. The allowed values ofdirection:"U": parent"D": first child"L": left sibling"R": right sibling
- return:
Location[]