emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/eglot 6e93622 27/69: Fix #273: leniently handle invalid


From: João Távora
Subject: [elpa] externals/eglot 6e93622 27/69: Fix #273: leniently handle invalid positions sent by some servers
Date: Sun, 20 Oct 2019 08:21:46 -0400 (EDT)

branch: externals/eglot
commit 6e936220110b95e037eb4eb06aae3cf1f60a8095
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    Fix #273: leniently handle invalid positions sent by some servers
    
    * eglot.el (eglot--lsp-position-to-point): Leniently squash
    invalid character positions to 0.
---
 eglot.el | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/eglot.el b/eglot.el
index ca63723..d470555 100644
--- a/eglot.el
+++ b/eglot.el
@@ -1020,8 +1020,14 @@ If optional MARKER, return a marker instead"
     (forward-line (min most-positive-fixnum
                        (plist-get pos-plist :line)))
     (unless (eobp) ;; if line was excessive leave point at eob
-      (let ((tab-width 1))
-        (funcall eglot-move-to-column-function (plist-get pos-plist 
:character))))
+      (let ((tab-width 1)
+            (col (plist-get pos-plist :character)))
+        (unless (wholenump col)
+          (eglot--warn
+           :eglot "Caution: LSP server sent invalid character position %s. 
Using 0 instead."
+           col)
+          (setq col 0))
+        (funcall eglot-move-to-column-function col)))
     (if marker (copy-marker (point-marker)) (point))))
 
 (defun eglot--path-to-uri (path)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]