mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Add LSP-Extensions.md
parent
d6d6d0b280
commit
7059a9bed2
79
LSP-Extensions.md
Normal file
79
LSP-Extensions.md
Normal file
@ -0,0 +1,79 @@
|
||||
## 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`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_call.cc)
|
||||
|
||||
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 with `kind`
|
||||
* return: `Location[]`
|
||||
|
||||
### [`$ccls/call`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_call.cc)
|
||||
|
||||
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: `TextDocumentPositionParams` extended with `callee, callType`
|
||||
* return: `Location[]`
|
||||
|
||||
#### `hierarchy: true`
|
||||
|
||||
* initial params: `TextDocumentPositionParams` extended with `callee, callType`. The result includes `id` and `kind` which are used to expand a node.
|
||||
* params: `id, kind, callee, callType`
|
||||
|
||||
Optional `levels` and `qualified` can be used to customize the hierarchy.
|
||||
|
||||
### [`$ccls/inheritance`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_inheritance.cc)
|
||||
|
||||
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: `TextDocumentPositionParams` extended with `derived`
|
||||
* return: `Location[]`
|
||||
|
||||
#### `hierarchy: true`
|
||||
|
||||
* initial params: `TextDocumentPositionParams` extended with `derived`. The result includes `id` and `kind` which are used to expand a node.
|
||||
* params: `id, kind, derived`
|
||||
|
||||
Optional `levels` and `qualified` can be used to customize the hierarchy.
|
||||
|
||||
### [`ccls/member`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_member.cc)
|
||||
|
||||
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: `TextDocumentPositionParams` extended with `derived`
|
||||
* return: `Location[]`
|
||||
|
||||
#### `hierarchy: true`
|
||||
|
||||
* initial params: `TextDocumentPositionParams` extended with `derived`. The result includes `id` and `kind` 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.
|
||||
|
||||
### [`$ccls/navigate`](https://github.com/MaskRay/ccls/blob/master/src/messages/ccls_navigate.cc)
|
||||
|
||||
Semantic movement among declarations.
|
||||
|
||||
* params: `TextDocumentPositionParams` extended with `direction`. The allowed values of `direction`:
|
||||
+ `"U"`: parent
|
||||
+ `"D"`: first child
|
||||
+ `"L"`: left sibling
|
||||
+ `"R"`: right sibling
|
||||
* return: `Location[]`
|
@ -18,4 +18,5 @@
|
||||
* [[Customization]]
|
||||
* [[Debugging]]
|
||||
* [[FAQ]]
|
||||
* [[LSP Extensions]]
|
||||
* [[LSP]]
|
||||
|
Loading…
Reference in New Issue
Block a user