mirror of
https://github.com/MaskRay/ccls.git
synced 2024-11-28 02:21:57 +00:00
emacs: More references
parent
143208e40f
commit
9ac6805e01
53
Emacs.md
53
Emacs.md
@ -142,7 +142,8 @@ Aside from definitions/references/workspace symbol, ccls provides some LSP exten
|
|||||||
(lsp-find-custom "$ccls/call" '(:callee t))
|
(lsp-find-custom "$ccls/call" '(:callee t))
|
||||||
|
|
||||||
(lsp-find-custom "$ccls/vars")
|
(lsp-find-custom "$ccls/vars")
|
||||||
; Use lsp-goto-implementation or lsp-ui-peek-find-implementation for derived types/functions
|
; Use lsp-goto-implementation or lsp-ui-peek-find-implementation (textDocument/implementation) for derived types/functions
|
||||||
|
; $ccls/inheritance is more general
|
||||||
|
|
||||||
;; Alternatively, use lsp-ui-peek interface
|
;; Alternatively, use lsp-ui-peek interface
|
||||||
(lsp-ui-peek-find-custom "$ccls/call")
|
(lsp-ui-peek-find-custom "$ccls/call")
|
||||||
@ -152,31 +153,47 @@ Aside from definitions/references/workspace symbol, ccls provides some LSP exten
|
|||||||
Recommended helpers:
|
Recommended helpers:
|
||||||
|
|
||||||
```elisp
|
```elisp
|
||||||
(defun ccls/callee ()
|
(defun ccls/callee () (interactive) (lsp-ui-peek-find-custom "$ccls/call" '(:callee t)))
|
||||||
|
(defun ccls/caller () (interactive) (lsp-ui-peek-find-custom "$ccls/call"))
|
||||||
|
(defun ccls/vars (kind) (lsp-ui-peek-find-custom "$ccls/vars" `(:kind ,kind)))
|
||||||
|
(defun ccls/base (levels) (lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels)))
|
||||||
|
(defun ccls/derived (levels) (lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels :derived t)))
|
||||||
|
(defun ccls/member (kind) (interactive) (lsp-ui-peek-find-custom "$ccls/member" `(:kind ,kind)))
|
||||||
|
|
||||||
|
;; References w/ Role::Role
|
||||||
|
(defun ccls/references-read () (interactive)
|
||||||
|
(lsp-ui-peek-find-custom "textDocument/references"
|
||||||
|
(plist-put (lsp--text-document-position-params) :role 8)))
|
||||||
|
|
||||||
|
;; References w/ Role::Write
|
||||||
|
(defun ccls/references-write ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(lsp-ui-peek-find-custom "$ccls/call" '(:callee t)))
|
(lsp-ui-peek-find-custom "textDocument/references"
|
||||||
(defun ccls/caller ()
|
(plist-put (lsp--text-document-position-params) :role 16)))
|
||||||
(interactive)
|
|
||||||
(lsp-ui-peek-find-custom "$ccls/call"))
|
;; References w/ Role::Dynamic bit (macro expansions)
|
||||||
(defun ccls/vars (kind)
|
(defun ccls/references-macro () (interactive)
|
||||||
(lsp-ui-peek-find-custom "$ccls/vars" `(:kind ,kind)))
|
(lsp-ui-peek-find-custom "textDocument/references"
|
||||||
(defun ccls/base (levels)
|
(plist-put (lsp--text-document-position-params) :role 64)))
|
||||||
(lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels)))
|
|
||||||
(defun ccls/derived (levels)
|
;; References w/o Role::Call bit (e.g. where functions are taken addresses)
|
||||||
(lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels :derived t)))
|
(defun ccls/references-not-call () (interactive)
|
||||||
(defun ccls/member (kind)
|
(lsp-ui-peek-find-custom "textDocument/references"
|
||||||
(interactive)
|
(plist-put (lsp--text-document-position-params) :excludeRole 32)))
|
||||||
(lsp-ui-peek-find-custom "$ccls/member" `(:kind ,kind)))
|
|
||||||
|
|
||||||
;; ccls/vars ccls/base ccls/derived ccls/members have a parameter while others are interactive.
|
;; ccls/vars ccls/base ccls/derived ccls/members have a parameter while others are interactive.
|
||||||
;; (ccls/base 1)
|
;; (ccls/base 1) direct bases
|
||||||
;; (ccls/derived 1)
|
;; (ccls/derived 1) direct derived
|
||||||
;; (ccls/member 2) => 2 (Type) => nested classes / types in a namespace
|
;; (ccls/member 2) => 2 (Type) => nested classes / types in a namespace
|
||||||
;; (ccls/member 3) => 3 (Func) => member functions / functions in a namespace
|
;; (ccls/member 3) => 3 (Func) => member functions / functions in a namespace
|
||||||
;; (ccls/member 0) => member variables / variables in a namespace
|
;; (ccls/member 0) => member variables / variables in a namespace
|
||||||
;; (ccls/vars 3) => field or local variable
|
|
||||||
;; (ccls/vars 1) => field
|
;; (ccls/vars 1) => field
|
||||||
|
;; (ccls/vars 2) => local variable
|
||||||
|
;; (ccls/vars 3) => field or local variable. 3 = 1 | 2
|
||||||
;; (ccls/vars 4) => parameter
|
;; (ccls/vars 4) => parameter
|
||||||
|
|
||||||
|
;; References whose filenames are under this project
|
||||||
|
(lsp-ui-peek-find-references nil (list :folders (vector (projectile-project-root))))
|
||||||
```
|
```
|
||||||
|
|
||||||
Hierarchies provide a flattened xref interface:
|
Hierarchies provide a flattened xref interface:
|
||||||
|
Loading…
Reference in New Issue
Block a user