$ccls/inheritanceHierarchy :flat t

Fangrui Song 2018-08-21 20:21:43 -07:00
parent ae5c996b9e
commit 75ebe1c566
2 changed files with 20 additions and 5 deletions

@ -112,6 +112,8 @@ Check https://github.com/emacs-lsp/lsp-ui for a supplement of lsp-mode. It provi
![references + hydra](https://ptpb.pw/fhWh.jpg)
Refer to [MaskRay's doom-emacs configuration](https://github.com/MaskRay/Config/blob/master/home/.config/doom/modules/private/my-cc/autoload.el) for fine-grained `textDocument/references` (different roles: Read/Write/Dynamic/...)
### Symbol highlight
The identifier (or user-defined operator) at point is highlighted with its other references. If you build trunk libclang, the references will be differentiated for different usage: read/write.
@ -143,6 +145,19 @@ Aside from definitions/references/workspace symbol, ccls provides some LSP exten
(lsp-ui-peek-find-custom 'random "$ccls/random") ;; jump to a random declaration
```
There are flattened versions of hierarchies with `:flat t`:
```elisp
(defun ccls/bases ()
(interactive)
(lsp-ui-peek-find-custom 'base "$ccls/inheritanceHierarchy"
(append (lsp--text-document-position-params) '(:flat t :level 3))))
(defun ccls/derived ()
(interactive)
(lsp-ui-peek-find-custom 'derived "$ccls/inheritanceHierarchy"
(append (lsp--text-document-position-params) '(:flat t :level 3 :derived t))))
```
### Documentation (comments)
lsp-ui-doc.el renders comments in a child frame (Emacs >= 26) or inline (< 26).

@ -71,10 +71,10 @@ or any other
### Custom cross references
```vim
nn xb :call LanguageClient#findLocations({'method':'$ccls/inheritanceHierarchy','flat':v:true,'level':3,'derived':v:false})<cr>
nn xd :call LanguageClient#findLocations({'method':'$ccls/inheritanceHierarchy','flat':v:true,'level':3,'derived':v:true})<cr>
nn xe :call LanguageClient#findLocations({'method':'$ccls/callers'})<cr>
nn xv :call LanguageClient#findLocations({'method':'$ccls/vars'})<cr>
nn xV :call LanguageClient#findLocations({'method':'$ccls/vars','kind':1})<cr>
nn <silent> xb :call LanguageClient#findLocations({'method':'$ccls/inheritanceHierarchy','flat':v:true,'levels':3,'derived':v:false})<cr>
nn <silent> xd :call LanguageClient#findLocations({'method':'$ccls/inheritanceHierarchy','flat':v:true,'levels':3,'derived':v:true})<cr>
nn <silent> xe :call LanguageClient#findLocations({'method':'$ccls/callers'})<cr>
nn <silent> xv :call LanguageClient#findLocations({'method':'$ccls/vars'})<cr>
nn <silent> xV :call LanguageClient#findLocations({'method':'$ccls/vars','kind':1})<cr>
nn xx x
```