Skip to content

Commit

Permalink
Fix placement of diagnostics with same start and end positions
Browse files Browse the repository at this point in the history
Some servers such as cquery and clangd publish diagnostic with 
identical start and end positions.

* eglot.el (eglot-handle-notification
  :textDocument/publishDiagnostics): Add 1 to :line since LSP lines
  are 0-based.  Don't subtract 1 from :character, since both emacs and
  LSP have 0-based columns.
  • Loading branch information
mkcms authored and joaotavora committed Aug 3, 2018
1 parent e476411 commit e935718
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions eglot.el
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,8 @@ Uses THING, FACE, DEFS and PREPEND."
(let* ((st (plist-get range :start))
(diag-region
(flymake-diag-region
(current-buffer) (plist-get st :line)
(1- (plist-get st :character)))))
(current-buffer) (1+ (plist-get st :line))
(plist-get st :character))))
(setq beg (car diag-region)
end (cdr diag-region))))
(eglot--make-diag (current-buffer) beg end
Expand Down

0 comments on commit e935718

Please sign in to comment.