From f8c8c70f8a7ec5649b5dd3f5af559f59eff65724 Mon Sep 17 00:00:00 2001 From: jicksaw Date: Thu, 30 Jun 2022 10:39:33 +0300 Subject: [PATCH] Reduce eldoc noise from hover messages Also close https://github.com/joaotavora/eglot/issues/985 Only echo hover response content, without response range. LSP specification says the range is meant to visualize a hover. Maybe echoing the range is useful for some, but it seems non-standard behavior. Example issue: haskell-language-server responds with range set to whole file when hovering a comment -> Large, useless eldoc * eglot.el (eglot--hover-info): Remove text selected by range from output Copyright-paperwork-exempt: Yes GitHub-reference: fix https://github.com/joaotavora/eglot/issues/514 --- lisp/progmodes/eglot.el | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index bde4a23f8e4..b058183fb96 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -2711,13 +2711,10 @@ for which LSP on-type-formatting should be requested." (eglot--signal-textDocument/didChange) (eldoc))))))))) -(defun eglot--hover-info (contents &optional range) - (let ((heading (and range (pcase-let ((`(,beg . ,end) (eglot--range-region range))) - (concat (buffer-substring beg end) ": ")))) - (body (mapconcat #'eglot--format-markup - (if (vectorp contents) contents (list contents)) "\n"))) - (when (or heading (cl-plusp (length body))) (concat heading body)))) - +(defun eglot--hover-info (contents &optional _range) + (mapconcat #'eglot--format-markup + (if (vectorp contents) contents (list contents)) "\n")) + (defun eglot--sig-info (sigs active-sig sig-help-active-param) (cl-loop for (sig . moresigs) on (append sigs nil) for i from 0 -- 2.39.5