File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed
Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -1229,16 +1229,18 @@ type MarkedString = string | { language: string; value: string };"
12291229 (lsp--point-is-within-bounds-p start end)
12301230 (eq (current-buffer ) buffer) (eldoc-display-message-p ))
12311231 (let ((contents (gethash " contents" hover)))
1232- (eldoc-message
1233- (mapconcat (lambda (e )
1234- (let (renderer)
1235- (if (hash-table-p e)
1236- (if (setq renderer (cdr (assoc-string
1237- (gethash " language" e) renderers)))
1238- (funcall renderer (gethash " value" e))
1239- (gethash " value" e))
1240- e)))
1241- (if (listp contents) contents (list contents)) " \n " ))))))
1232+ ; ; We may receive multiple MarkedString's in the Hover response,
1233+ ; ; render the last one because others are likely comments which will
1234+ ; ; make the eldoc message span multiple lines.
1235+ (when-let* ((e (if (consp contents) (car (last contents)) contents)))
1236+ (let (renderer)
1237+ (eldoc-message
1238+ (if (hash-table-p e)
1239+ (if (setq renderer (cdr (assoc-string
1240+ (gethash " language" e) renderers)))
1241+ (funcall renderer (gethash " value" e))
1242+ (gethash " value" e))
1243+ e))))))))
12421244
12431245(defun lsp-provide-marked-string-renderer (client language renderer )
12441246 (cl-check-type language string)
You can’t perform that action at this time.
0 commit comments