]> git.eshelyaron.com Git - emacs.git/commit
Add ability to move to lsp-precise columns
authorJoão Távora <joaotavora@gmail.com>
Mon, 12 Nov 2018 22:29:38 +0000 (22:29 +0000)
committerJoão Távora <joaotavora@gmail.com>
Mon, 12 Nov 2018 22:57:22 +0000 (22:57 +0000)
commit9f44e74ca9d2b254fbf9fd1d5ccfde64e2b652f1
treed6b94894aee93d0512eb8b6ffc7e6a000a02557a
parenta0365b6f81864488b249de23c2b399e475f312a0
Add ability to move to lsp-precise columns

Also close https://github.com/joaotavora/eglot/issues/125.

Idea and much of design contributed by Michał Krzywkowski
<k.michal@zoho.com>

This introduces the variable eglot-move-to-column-function.

According to the standard, LSP column/character offsets are based
on a count of UTF-16 code units, not actual visual columns.  So
when LSP says position 3 of a line containing just \"aXbc\",
where X is a multi-byte character, it actually means `b', not
`c'.  This is what the function
`eglot-move-to-lsp-abiding-column' does.

However, many servers don't follow the spec this closely, and
thus this variable should be set to `move-to-column' in buffers
managed by those servers.

* eglot.el (eglot-move-to-column-function): New variable.
(eglot-move-to-lsp-abiding-column): New function.
(eglot--lsp-position-to-point): Use eglot-move-to-column-function.

GitHub-reference: fix https://github.com/joaotavora/eglot/issues/124
lisp/progmodes/eglot.el