Skip to content

Commit

Permalink
Make sure that the correct position type is used
Browse files Browse the repository at this point in the history
  • Loading branch information
yyoncho committed Nov 1, 2023
1 parent d845d7a commit 7e1942e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lsp-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -5074,12 +5074,16 @@ identifier and the position respectively."
(lsp-point-in-range? left-start right)
(lsp-point-in-range? left-end right)))

(defun lsp-make-position-1 (position)
(lsp-make-position :line (plist-get position :line)
:character (plist-get position :character)))

(defun lsp-cur-possition-diagnostics ()
"Return any diagnostics that apply to the current line."
(-let* ((start (if (use-region-p) (region-beginning) (point)))
(end (if (use-region-p) (region-end) (point)))
(current-range (lsp-make-range :start (lsp-point-to-position start)
:end (lsp-point-to-position end))))
(current-range (lsp-make-range :start (lsp-make-position-1 (lsp-point-to-position start))
:end (lsp-make-position-1 (lsp-point-to-position end)))))
(->> (lsp--get-buffer-diagnostics)
(-filter
(-lambda ((&Diagnostic :range))
Expand Down

0 comments on commit 7e1942e

Please sign in to comment.