Skip to content

Display the first line of MarkupContent in eldoc #1607

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -4715,9 +4715,11 @@ CONTENTS - MarkedString | MarkedString[] | MarkupContent
RENDER-ALL - nil if only the signature should be rendered."
(cond
((and (hash-table-p contents) (gethash "kind" contents))
;; MarkupContent, deprecated by LSP but actually very flexible.
;; It tends to be long and is not suitable in echo area.
(if render-all (lsp--render-element contents) ""))
;; MarkupContent.
;; It tends to be long and is not suitable to display fully in the echo area.
;; Just display the first line which is typically the signature.
(let ((rendered (lsp--render-element contents)))
(if render-all rendered (car (split-string rendered "\n")))))
((and (stringp contents) (not (string-match-p "\n" contents)))
;; If the contents is a single string containing a single line,
;; render it always.
Expand Down