]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix placement of diagnostics with same start and end positions
authorMichal Krzywkowski <k.michal@zoho.com>
Fri, 3 Aug 2018 08:22:18 +0000 (10:22 +0200)
committerJoão Távora <joaotavora@gmail.com>
Fri, 3 Aug 2018 08:22:18 +0000 (09:22 +0100)
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.

lisp/progmodes/eglot.el

index 0bb162b07c9a120fb647e2bfb022cb42394e9a60..58efc1668633afee7462cd6996ec99c6ea2db1c3 100644 (file)
@@ -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