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

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

[elpa] externals/eglot cddab30 06/26: * eglot.el (eglot--current-column)


From: João Távora
Subject: [elpa] externals/eglot cddab30 06/26: * eglot.el (eglot--current-column): New helper.
Date: Sun, 9 Dec 2018 19:11:25 -0500 (EST)

branch: externals/eglot
commit cddab30728e91a9c3b201087467662a567e95f6f
Author: Michał Krzywkowski <address@hidden>
Commit: Michał Krzywkowski <address@hidden>

    * eglot.el (eglot--current-column): New helper.
    
    (eglot-current-column-function): Set to eglot--current-column.
    (eglot--pos-to-lsp-position): Don't bind tab-width anymore.
    (eglot--xref-make): Use eglot--current-column.
---
 eglot.el | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/eglot.el b/eglot.el
index 1522935..94de8d1 100644
--- a/eglot.el
+++ b/eglot.el
@@ -811,7 +811,9 @@ CONNECT-ARGS are passed as additional arguments to
   (let ((warning-minimum-level :error))
     (display-warning 'eglot (apply #'format format args) :warning)))
 
-(defvar eglot-current-column-function #'current-column
+(defun eglot--current-column () (- (point) (point-at-bol)))
+
+(defvar eglot-current-column-function #'eglot--current-column
   "Function to calculate the current column.
 
 This is the inverse operation of
@@ -833,8 +835,7 @@ for all others.")
   (eglot--widening
    (list :line (1- (line-number-at-pos pos t)) ; F!@&#$CKING OFF-BY-ONE
          :character (progn (when pos (goto-char pos))
-                           (let ((tab-width 1))
-                             (funcall eglot-current-column-function))))))
+                           (funcall eglot-current-column-function)))))
 
 (defvar eglot-move-to-column-function #'move-to-column
   "Function to move to a column reported by the LSP server.
@@ -1502,11 +1503,10 @@ Try to visit the target file for a richer summary line."
                   (eglot--widening
                    (pcase-let* ((`(,beg . ,end) (eglot--range-region range))
                                 (bol (progn (goto-char beg) (point-at-bol)))
-                                (substring (buffer-substring bol 
(point-at-eol)))
-                                (tab-width 1))
+                                (substring (buffer-substring bol 
(point-at-eol))))
                      (add-face-text-property (- beg bol) (- end bol) 'highlight
                                              t substring)
-                     (list substring (1+ (current-line)) (current-column))))))
+                     (list substring (1+ (current-line)) 
(eglot--current-column))))))
        (`(,summary ,line ,column)
         (cond
          (visiting (with-current-buffer visiting (funcall collect)))



reply via email to

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