]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix flymake diagnostic positions
authorJoão Távora <joaotavora@gmail.com>
Thu, 3 May 2018 14:46:27 +0000 (15:46 +0100)
committerJoão Távora <joaotavora@gmail.com>
Thu, 3 May 2018 14:46:27 +0000 (15:46 +0100)
It's better not to use flymake-diag-region here.

* eglot.el (eglot--textDocument/publishDiagnostics):
Calculate position by hand.

lisp/progmodes/eglot.el

index 86c0a4c05fa4e8d57ea735f80567a5718f46dd55..bb0427aca73dff090ecc8684353cc1a02d85a82a 100644 (file)
@@ -637,10 +637,13 @@ running.  INTERACTIVE is t if called interactively."
       (with-current-buffer buffer
         (cl-flet ((pos-at
                    (pos-plist)
-                   (car (flymake-diag-region
-                         (current-buffer)
-                         (plist-get pos-plist :line)
-                         (plist-get pos-plist :character)))))
+                   (save-excursion
+                     (goto-char (point-min))
+                     (forward-line (plist-get pos-plist :line))
+                     (forward-char
+                      (min (plist-get pos-plist :character)
+                           (- (line-end-position)
+                              (line-beginning-position)))))))
           (cl-loop for diag-spec across diagnostics
                    collect (cl-destructuring-bind (&key range severity
                                                         _code _source message)