emacs-ccls
emacs-ccls copied to clipboard
Pass "ccls.xref" command name as a string, not a symbol, to lsp--send-execute-command...
...in the lsp-execute-command method definition.
This fixes error '(wrong-type-argument json-value-p ccls.xref)' on attempt to click on any code lens reference.
It seems that the old elisp-only json serializer did accept a symbol as a JSON value and serialized it as a string; now, when Emacs is built with native JSON support, it is not more valid.
P.S. Maybe (symbol-name command)
would have been better, but since this method is explicitly restricted to ccls.xref, it seems passing the command name verbatim is OK?
Bump. It would be nice if this fix (or other better fix) can be merged.
I'm totally a newbie when coding in emacs lisp but it can be more generic by checking native JSON support ?
(cl-defmethod lsp-execute-command
((_server (eql ccls)) (command (eql ccls.xref)) arguments)
(when-let ((command (if (functionp 'json-serialize)
(symbol-name command)
command))
(xrefs (lsp--locations-to-xref-items
(lsp--send-execute-command command arguments))))
(xref--show-xrefs xrefs nil)))
Any update, pls?
I get this error also, but ccls.el has:
(cl-defmethod lsp-execute-command
((_server (eql ccls)) (command (eql ccls.xref)) arguments)
(when-let ((xrefs (lsp--locations-to-xref-items
(lsp--send-execute-command (symbol-name command) arguments))))
(xref--show-xrefs xrefs nil)))
ie this PR has been superceeded but the same symptoms still happen.
EDIT: actually strike that, looks like I modified it earlier but forgot to recompile the file..
Sorry, any update on this, I still getting this error, and from master branch, the ccls.el still remain
(cl-defmethod lsp-execute-command
((_server (eql ccls)) (command (eql ccls.xref)) arguments)
(when-let ((xrefs (lsp--locations-to-xref-items
(lsp--send-execute-command command arguments))))
(xref--show-xrefs xrefs nil)))
I can confirm that this PR fixes the issue for me for this issue: https://github.com/emacs-lsp/emacs-ccls/issues/109
I have raised a discussion in the discord to see if we can get this merged.