eglot
eglot copied to clipboard
MS python language server: wrong-type-argument error in `eglot--format-markup`
(plist-get markup :value)
is nil
in eglot--format-markup
function when the language server returns '(:kind "plaintext")
, (insert string)
would lead to error Wrong type argument: char-or-string-p, nil
.
Isn't the :value
field required? If yes, then that's a server-side issue.
Yes. An issue has been submitted.
I modified the function to get it working with omnisharp-roslyn (C#) like this:
(defun eglot--format-markup (markup)
"Format MARKUP according to LSP's spec."
(unless markup
(setq markup ""))
(pcase-let ((`(,string ,mode)
(if (stringp markup) (list (string-trim markup)
(intern "gfm-view-mode"))
(list (plist-get markup :value)
major-mode))))
(with-temp-buffer
(insert string)
(ignore-errors (funcall mode)) (font-lock-ensure) (buffer-string))))
Maybe this helps you with this server too.
Also, since it seems to be a common issue, maybe this could be part of eglot-strict-mode
?
(when (and (not markup) (not eglot-strict-mode) ;; set response to "" to avoid errors