From 8de83e4319140826a4b3f5d72d86b8d380fc8737 Mon Sep 17 00:00:00 2001 From: Nikita Bloshchanevich Date: Wed, 4 Nov 2020 10:08:19 +0100 Subject: [PATCH 1/2] Don't use `lsp-execute-command' That function is a liability and needs to be eliminated; use :action-handlers instead. --- ccls.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ccls.el b/ccls.el index 65b6984..6ff2588 100644 --- a/ccls.el +++ b/ccls.el @@ -145,11 +145,10 @@ DIRECTION can be \"D\", \"L\", \"R\" or \"U\"." ccls-root-files)) (expand-file-name dir)))) -(cl-defmethod lsp-execute-command - ((_server (eql ccls)) (command (eql ccls.xref)) arguments) +(lsp-defun ccls--show-xrefs ((&Command :arguments?)) (when-let ((xrefs (lsp--locations-to-xref-items (lsp--send-execute-command command arguments)))) - (xref--show-xrefs xrefs nil))) + (lsp-show-xrefs xrefs nil t))) (advice-add 'lsp--suggest-project-root :before-until #'ccls--suggest-project-root) @@ -162,6 +161,7 @@ DIRECTION can be \"D\", \"L\", \"R\" or \"U\"." :notification-handlers (lsp-ht ("$ccls/publishSkippedRanges" #'ccls--publish-skipped-ranges) ("$ccls/publishSemanticHighlight" #'ccls--publish-semantic-highlight)) + :action-handlers (lsp-ht ("ccls.xref" #'ccls--show-xrefs)) :initialization-options (lambda () ccls-initialization-options) :library-folders-fn ccls-library-folders-fn)) From 1b04d4d4f5c09e873e6728fa64a5245e3e2f4994 Mon Sep 17 00:00:00 2001 From: Nikita Bloshchanevich Date: Thu, 5 Nov 2020 13:12:09 +0100 Subject: [PATCH 2/2] Fix `ccls--show-xrefs' `ccls--show-xrefs' (and by extension and refs lenses) now actually works, instead of throwing a type error. --- ccls.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ccls.el b/ccls.el index 6ff2588..0b15c16 100644 --- a/ccls.el +++ b/ccls.el @@ -145,9 +145,9 @@ DIRECTION can be \"D\", \"L\", \"R\" or \"U\"." ccls-root-files)) (expand-file-name dir)))) -(lsp-defun ccls--show-xrefs ((&Command :arguments?)) +(lsp-defun ccls--show-xrefs ((&Command :command :arguments?)) (when-let ((xrefs (lsp--locations-to-xref-items - (lsp--send-execute-command command arguments)))) + (lsp--send-execute-command command arguments?)))) (lsp-show-xrefs xrefs nil t))) (advice-add 'lsp--suggest-project-root :before-until #'ccls--suggest-project-root)