mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-22 07:35:08 +00:00
Add cross references and semantic navigation
parent
dba61dc16b
commit
7ed906883d
@ -48,3 +48,48 @@ The Visual Studio Code ccls extension supports [semantic highlighting](https://m
|
||||
"ccls.highlighting.enabled.staticMemberVariables": true,
|
||||
"ccls.highlighting.enabled.globalVariables": true,
|
||||
```
|
||||
|
||||
### Cross references
|
||||
|
||||
You could set custom lookup using keybindings. Use command palette (`ctrl + shift + p` by default) -> `Open keyboard shortcuts file`
|
||||
|
||||
```javascript
|
||||
// functions called by current selected function, up to 3rd level.
|
||||
{"key":"<ctrl-shift-alt-c>","command":"ccls.call","args":{"callee":true,"levels":3}}
|
||||
|
||||
// functions that call this function. This is what "Show Cross References" shows by default
|
||||
{"key":"<your-shortcuts>","command":"ccls.call"}
|
||||
|
||||
// see inheritance instead of base
|
||||
{"key":"<your-shortcuts>","command":"ccls.base","args":{"derived":true,"levels":2}}
|
||||
|
||||
// nested classes / types in a namespace (kind: 2)
|
||||
{"key":"<your-shortcuts>","command":"ccls.member","args":{"kind":2}}
|
||||
|
||||
// member functions / functions in a namespace(kind 3)
|
||||
{"key":"<your-shortcuts>","command":"ccls.member","args":{"kind":3}}
|
||||
```
|
||||
|
||||
For VSCodeVim users, here's how to set arguments in User Settings (`settings.json`)
|
||||
```json
|
||||
"vim.normalModeKeyBindingsNonRecursive": [
|
||||
{
|
||||
"before":["<leader>","t"],
|
||||
"commands":[{"command":"ccls.call","args":{"levels":2,"callee":true}}]
|
||||
}
|
||||
]
|
||||
```
|
||||
So you could hit `<space>-t` to see callees up to 3rd level if you set `<leader>` to `<space>`
|
||||
|
||||
### Semantic Navigation
|
||||
|
||||
The command is `ccls.navigate`, which need an argument `direction`. ("D" => first child declaration "L" => previous declaration "R" => next declaration "U" => parent declaration)
|
||||
|
||||
```json
|
||||
"vim.normalModeKeyBindingsNonRecursive": [
|
||||
{"before":["<leader>","j"],"commands":[{"command":"ccls.navigate","args":{"direction":"R"}}]},
|
||||
{"before":["<leader>","k"],"commands":[{"command":"ccls.navigate","args":{"direction":"L"}}]},
|
||||
{"before":["<leader>","h"],"commands":[{"command":"ccls.navigate","args":{"direction":"U"}}]},
|
||||
{"before":["<leader>","l"],"commands":[{"command":"ccls.navigate","args":{"direction":"D"}}]}
|
||||
]
|
||||
```
|
Loading…
Reference in New Issue
Block a user