From 1463b3e7b8fa7f5365ecf651218e5e65b47188aa Mon Sep 17 00:00:00 2001 From: John Ciolfi Date: Fri, 9 Dec 2022 14:44:49 -0500 Subject: [PATCH 1/3] Fix mouse-1 on 'N refs' Using Emacs 27 on Linux, prior to this commit, when clicking on the 'N refs' annotation created by code lens, you would get "cl--assertion-failed: Assertion failed: (functionp fetcher)". The issue is in ccls.el, lsp-execute-command which was calling xref--show-xrefs when it should have been calling lsp-show-xrefs. I also fixed a similar issue in ccls-code-lens.el. See https://github.com/emacs-lsp/lsp-mode/issues/3838 --- ccls-code-lens.el | 3 +-- ccls.el | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/ccls-code-lens.el b/ccls-code-lens.el index ed746f7..dec8351 100644 --- a/ccls-code-lens.el +++ b/ccls-code-lens.el @@ -69,8 +69,7 @@ (lambda () (interactive) (when-let ((xrefs (lsp--locations-to-xref-items (lsp--send-execute-command command arguments?)))) - ;; xref--show-xrefs takes a function since Emacs 27. - (xref--show-xrefs (if (functionp 'xref--create-fetcher) (lambda () xrefs) xrefs) nil)))) + (lsp-show-xrefs xrefs nil t)))) (propertize (concat lpad title rpad) 'face 'ccls-code-lens-face 'mouse-face 'ccls-code-lens-mouse-face diff --git a/ccls.el b/ccls.el index f858007..3608d44 100644 --- a/ccls.el +++ b/ccls.el @@ -149,7 +149,7 @@ DIRECTION can be \"D\", \"L\", \"R\" or \"U\"." ((_server (eql ccls)) (command (eql ccls.xref)) arguments) (when-let ((xrefs (lsp--locations-to-xref-items (lsp--send-execute-command "ccls.xref" arguments)))) - (xref--show-xrefs xrefs nil))) + (lsp-show-xrefs xrefs nil t))) (advice-add 'lsp--suggest-project-root :before-until #'ccls--suggest-project-root) From 49e389e6a0498f3f1916f11be4622786899658a1 Mon Sep 17 00:00:00 2001 From: John Ciolfi Date: Fri, 9 Dec 2022 15:08:35 -0500 Subject: [PATCH 2/3] Fix void-variable cur-buffer-workspaces in ccls-member-hierarchy Prior to this fix, when using ccls-member-hierarchy, followed by a mouse-1 clicking in the member hierarchy view, you'll see: Debugger entered--Lisp error: (void-variable cur-buffer-workspaces) ccls-tree-press() ccls-tree-press-and-switch() funcall-interactively(ccls-tree-press-and-switch) call-interactively(ccls-tree-press-and-switch nil nil) command-execute(ccls-tree-press-and-switch) --- ccls-tree.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ccls-tree.el b/ccls-tree.el index 2746010..d43bf5b 100644 --- a/ccls-tree.el +++ b/ccls-tree.el @@ -273,7 +273,7 @@ (unless lsp--buffer-workspaces (setq lsp--buffer-workspaces workspaces) (lsp-mode 1) - (dolist (workspace cur-buffer-workspaces) + (dolist (workspace workspaces) (lsp--open-in-workspace workspace))) (goto-char (lsp--position-to-point (cdr (ccls-tree-node-location node)))) (recenter) From accb5863b2eb4328362f87fe57aa660e10005476 Mon Sep 17 00:00:00 2001 From: John Ciolfi Date: Fri, 9 Dec 2022 15:32:18 -0500 Subject: [PATCH 3/3] ccls: fix a couple compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There's still two left (on Emacs 27): ccls-inheritance-hierarchy.el:49:1:Warning: Unused lexical variable ‘children’ ccls.el:153:27:Warning: Unused lexical argument ‘command’ Not sure what the right fix is for these (is it incomplete code?) --- ccls-code-lens.el | 2 +- ccls-semantic-highlight.el | 2 +- ccls.el | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/ccls-code-lens.el b/ccls-code-lens.el index dec8351..d645251 100644 --- a/ccls-code-lens.el +++ b/ccls-code-lens.el @@ -96,7 +96,7 @@ (goto-char 1) (let ((line 0) (col 0) ov) (seq-doseq (lens result) - (-let (([l0 c0 l1 c1 command?] lens) (pad " ")) + (-let (([l0 c0 l1 c1 command?] lens)) (pcase ccls-code-lens-position ('end (forward-line (- l0 line)) diff --git a/ccls-semantic-highlight.el b/ccls-semantic-highlight.el index 5c1cd6f..94c4135 100644 --- a/ccls-semantic-highlight.el +++ b/ccls-semantic-highlight.el @@ -250,7 +250,7 @@ If nil, disable semantic highlight." (with-current-buffer buffer (with-silent-modifications (ccls--clear-sem-highlights) - (let (ranges point0 point1 (line 0) overlays) + (let (overlays) (seq-doseq (symbol symbols) (-when-let* ((face (funcall ccls-sem-face-function symbol))) (seq-doseq (range (lsp:ccls-semantic-highlight-symbol-ranges symbol)) diff --git a/ccls.el b/ccls.el index 3608d44..6eab517 100644 --- a/ccls.el +++ b/ccls.el @@ -70,7 +70,8 @@ (defcustom ccls-initialization-options nil "initializationOptions" - :group 'ccls) + :group 'ccls + :type 'alist) (put 'ccls-initialization-options 'safe-local-variable 'listp) (defcustom ccls-root-files