From c9f5e9a6c3e19622a11a06059c990c7e9e4a4776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felici=C3=A1n=20N=C3=A9meth?= Date: Sun, 19 Jan 2020 11:13:20 +0100 Subject: [PATCH] Fix #361: abide by LSP when reporting and moving to columns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * eglot.el (eglot-current-column-function): Set to eglot-lsp-abiding-column. (eglot-move-to-column-function): Set to eglot-move-to-lsp-abiding-column. * NEWS.md: Log the change here as well. Co-authored-by: João Távora #361: https://github.com/joaotavora/eglot/issues/361 --- lisp/progmodes/eglot.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 2a50611d36..5d363ed303 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -1002,15 +1002,15 @@ CONNECT-ARGS are passed as additional arguments to (defun eglot-current-column () (- (point) (point-at-bol))) -(defvar eglot-current-column-function #'eglot-current-column +(defvar eglot-current-column-function #'eglot-lsp-abiding-column "Function to calculate the current column. This is the inverse operation of `eglot-move-to-column-function' (which see). It is a function of no arguments returning a column number. For buffers managed by fully LSP-compliant servers, this should be set to -`eglot-lsp-abiding-column', and `eglot-current-column' (the default) -for all others.") +`eglot-lsp-abiding-column' (the default), and +`eglot-current-column' for all others.") (defun eglot-lsp-abiding-column () "Calculate current COLUMN as defined by the LSP spec." @@ -1026,7 +1026,7 @@ for all others.") :character (progn (when pos (goto-char pos)) (funcall eglot-current-column-function))))) -(defvar eglot-move-to-column-function #'eglot-move-to-column +(defvar eglot-move-to-column-function #'eglot-move-to-lsp-abiding-column "Function to move to a column reported by the LSP server. According to the standard, LSP column/character offsets are based @@ -1036,8 +1036,8 @@ where X is a multi-byte character, it actually means `b', not `c'. However, many servers don't follow the spec this closely. For buffers managed by fully LSP-compliant servers, this should -be set to `eglot-move-to-lsp-abiding-column', and -`eglot-move-to-column' (the default) for all others.") +be set to `eglot-move-to-lsp-abiding-column' (the default), and +`eglot-move-to-column' for all others.") (defun eglot-move-to-column (column) "Move to COLUMN without closely following the LSP spec."