mirror of
https://gitlab.com/dwt1/dotfiles.git
synced 2026-04-24 12:00:24 +10:00
Minor edits.
This commit is contained in:
@@ -129,7 +129,7 @@ simpler."
|
||||
|
||||
;; Eglot specific helper, courtesy of MaskRay
|
||||
;;;###autoload
|
||||
(defun +cc/eglot-ccls-inheritance-hierarchy (&optional derived)
|
||||
(defun +cc/eglot-ccls-show-inheritance-hierarchy (&optional derived)
|
||||
"Show inheritance hierarchy for the thing at point.
|
||||
If DERIVED is non-nil (interactively, with prefix argument), show
|
||||
the children of class at point."
|
||||
@@ -224,3 +224,95 @@ header files."
|
||||
(`c-mode 'ffap-c-path)
|
||||
(`c++-mode 'ffap-c++-path))
|
||||
(expand-file-name dir project-root)))))
|
||||
|
||||
|
||||
;;
|
||||
;;; CCLS specific helpers
|
||||
|
||||
;; ccls-show-vars ccls-show-base ccls-show-derived ccls-show-members have a
|
||||
;; parameter while others are interactive.
|
||||
;;
|
||||
;; (+cc/ccls-show-base 1) direct bases
|
||||
;; (+cc/ccls-show-derived 1) direct derived
|
||||
;; (+cc/ccls-show-member 2) => 2 (Type) => nested classes / types in a namespace
|
||||
;; (+cc/ccls-show-member 3) => 3 (Func) => member functions / functions in a namespace
|
||||
;; (+cc/ccls-show-member 0) => member variables / variables in a namespace
|
||||
;; (+cc/ccls-show-vars 1) => field
|
||||
;; (+cc/ccls-show-vars 2) => local variable
|
||||
;; (+cc/ccls-show-vars 3) => field or local variable. 3 = 1 | 2
|
||||
;; (+cc/ccls-show-vars 4) => parameter
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-callee ()
|
||||
"Show callees of symbol under point."
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "$ccls/call" '(:callee t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-caller ()
|
||||
"Show callers of symbol under point."
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "$ccls/call"))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-vars (kind)
|
||||
"Show variables of type KIND as symbol under point.
|
||||
1 -> field
|
||||
2 -> local variable
|
||||
3 -> field or local variables. 3 = 1 | 2.
|
||||
4 -> parameter"
|
||||
(lsp-ui-peek-find-custom "$ccls/vars" `(:kind ,kind)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-base (levels)
|
||||
"Show bases of class under point up to LEVELS levels (1 for direct bases)."
|
||||
(lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-derived (levels)
|
||||
"Show derived classes from class under point down to LEVELS levels (1 for direct derived)."
|
||||
(lsp-ui-peek-find-custom "$ccls/inheritance" `(:levels ,levels :derived t)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-member (kind)
|
||||
"Show member elements of kind KIND for class/namespace under point.
|
||||
0 -> member variables/ variables in a namespace
|
||||
2 -> nested classes / types in a namespace
|
||||
3 -> member functions / functions in a namespace"
|
||||
(lsp-ui-peek-find-custom "$ccls/member" `(:kind ,kind)))
|
||||
|
||||
;; The meaning of :role corresponds to https://github.com/maskray/ccls/blob/master/src/symbol.h
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-references-address ()
|
||||
"References w/ Role::Address bit (e.g. variables explicitly being taken addresses)"
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "textDocument/references"
|
||||
(plist-put (lsp--text-document-position-params) :role 128)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-references-macro ()
|
||||
"References w/ Role::Dynamic bit (macro expansions)"
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "textDocument/references"
|
||||
(plist-put (lsp--text-document-position-params) :role 64)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-references-not-call ()
|
||||
"References w/o Role::Call bit (e.g. where functions are taken addresses)"
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "textDocument/references"
|
||||
(plist-put (lsp--text-document-position-params) :excludeRole 32)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-references-read ()
|
||||
"References w/ Role::Read"
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "textDocument/references"
|
||||
(plist-put (lsp--text-document-position-params) :role 8)))
|
||||
|
||||
;;;###autoload
|
||||
(defun +cc/ccls-show-references-write ()
|
||||
"References w/ Role::Write"
|
||||
(interactive)
|
||||
(lsp-ui-peek-find-custom "textDocument/references"
|
||||
(plist-put (lsp--text-document-position-params) :role 16)))
|
||||
|
||||
Reference in New Issue
Block a user