Skip to content

Commit d292641

Browse files
committed
[lsp-ui-doc] Request textDocument/hover on symbols like ->
1 parent 4b2f9cc commit d292641

File tree

1 file changed

+15
-9
lines changed

1 file changed

+15
-9
lines changed

lsp-ui-doc.el

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -296,16 +296,22 @@ We don't extract the string that `lps-line' is already displaying."
296296
(when (and (bound-and-true-p lsp--cur-workspace)
297297
(not (bound-and-true-p lsp-ui-peek-mode))
298298
(lsp--capability "hoverProvider"))
299-
(if (symbol-at-point)
300-
(let ((bounds (bounds-of-thing-at-point 'symbol)))
301-
(unless (equal lsp-ui-doc--bounds bounds)
302-
(lsp--send-request-async (lsp--make-request "textDocument/hover"
303-
(lsp--text-document-position-params))
304-
(lambda (hover)
305-
(lsp-ui-doc--callback hover bounds (current-buffer))
306-
))))
299+
(cond
300+
((symbol-at-point)
301+
(let ((bounds (bounds-of-thing-at-point 'symbol)))
302+
(unless (equal lsp-ui-doc--bounds bounds)
303+
(lsp--send-request-async (lsp--make-request "textDocument/hover"
304+
(lsp--text-document-position-params))
305+
(lambda (hover)
306+
(lsp-ui-doc--callback hover bounds (current-buffer)))))))
307+
((looking-at "[[:graph:]]")
308+
(lsp--send-request-async (lsp--make-request "textDocument/hover"
309+
(lsp--text-document-position-params))
310+
(lambda (hover)
311+
(lsp-ui-doc--callback hover (cons (point) (1+ (point))) (current-buffer)))))
312+
(t
307313
(setq lsp-ui-doc--string-eldoc nil)
308-
(lsp-ui-doc--hide-frame))))
314+
(lsp-ui-doc--hide-frame)))))
309315

310316
(defun lsp-ui-doc--callback (hover bounds buffer)
311317
"Process the received documentation.

0 commit comments

Comments
 (0)