Skip to content

Commit

Permalink
Adapt lsp--send-request-async change by lsp-mode #452
Browse files Browse the repository at this point in the history
  • Loading branch information
MaskRay committed Oct 24, 2018
1 parent 06b0406 commit 05d17b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
9 changes: 4 additions & 5 deletions lsp-ui-doc.el
Original file line number Diff line number Diff line change
Expand Up @@ -303,24 +303,23 @@ We don't extract the string that `lps-line' is already displaying."
(lsp--send-request-async (lsp--make-request "textDocument/hover"
(lsp--text-document-position-params))
(lambda (hover)
(lsp-ui-doc--callback hover bounds (current-buffer)))))))
(lsp-ui-doc--callback hover bounds))))))
((looking-at "[[:graph:]]")
(lsp--send-request-async (lsp--make-request "textDocument/hover"
(lsp--text-document-position-params))
(lambda (hover)
(lsp-ui-doc--callback hover (cons (point) (1+ (point))) (current-buffer)))))
(lsp-ui-doc--callback hover (cons (point) (1+ (point)))))))
(t
(setq lsp-ui-doc--string-eldoc nil)
(lsp-ui-doc--hide-frame)))))

(defun lsp-ui-doc--callback (hover bounds buffer)
(defun lsp-ui-doc--callback (hover bounds)
"Process the received documentation.
HOVER is the doc returned by the LS.
BOUNDS are points of the symbol that have been requested.
BUFFER is the buffer where the request has been made."
(if (and hover
(lsp--point-is-within-bounds-p (car bounds) (cdr bounds))
(equal buffer (current-buffer)))
(lsp--point-is-within-bounds-p (car bounds) (cdr bounds)))
(let ((doc (lsp-ui-doc--extract (gethash "contents" hover))))
(setq lsp-ui-doc--bounds bounds)
(lsp-ui-doc--display (thing-at-point 'symbol t) doc))
Expand Down
3 changes: 2 additions & 1 deletion lsp-ui-sideline.el
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,8 @@ to the language server."
:range (lsp--region-to-range bol eol)
:context (list :diagnostics (lsp--cur-line-diagnotics)))
(lsp--text-document-code-action-params)))
#'lsp-ui-sideline--code-actions))
#'lsp-ui-sideline--code-actions
'alive))
;; Go through all symbols and request hover information. Note that the symbols are
;; traversed backwards as `forward-symbol' with a positive argument will jump just past the
;; current symbol. By going from the end of the line towards the front, point will be placed
Expand Down

0 comments on commit 05d17b3

Please sign in to comment.