diff options
| author | Stefan Monnier | 2024-04-18 23:39:30 -0400 |
|---|---|---|
| committer | Stefan Monnier | 2024-04-18 23:39:30 -0400 |
| commit | c833892140fbf4be45161bf85d4c1253c5503949 (patch) | |
| tree | 70c3542d8e69e355ea4d8e4f86b26e444684b422 /test | |
| parent | a3f6d92714c31ccb87f56b13ee2606c05493c87d (diff) | |
| download | emacs-c833892140fbf4be45161bf85d4c1253c5503949.tar.gz emacs-c833892140fbf4be45161bf85d4c1253c5503949.zip | |
(eglot--signal-textDocument/didChange): Fix tests
The tests call `eglot--signal-textDocument/didChange` eagerly,
which means in the case where we use `track-changes` that they
call it before the tracker's signal has been called.
So make sure we fetch pending changes even if we haven't yet
been notified of them, and make sure `eglot--versioned-identifier`
is incremented even when the signal is not called.
* lisp/progmodes/eglot.el (eglot--track-changes-fetch)
(eglot--after-change): Increment `eglot--versioned-identifier` here...
(eglot--track-changes-signal): ...instead of here.
(eglot--signal-textDocument/didChange): Try and fetch changes even if the
tracker's signal wasn't called yet.
* test/lisp/progmodes/eglot-tests.el (eglot-tests--get): New function.
(eglot-tests--lsp-abiding-column-1): Use it.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/progmodes/eglot-tests.el | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/lisp/progmodes/eglot-tests.el b/test/lisp/progmodes/eglot-tests.el index 4725885038e..e501e24f5d2 100644 --- a/test/lisp/progmodes/eglot-tests.el +++ b/test/lisp/progmodes/eglot-tests.el | |||
| @@ -821,6 +821,12 @@ int main() { | |||
| 821 | (should (looking-back "\"foo.bar\": \"")) | 821 | (should (looking-back "\"foo.bar\": \"")) |
| 822 | (should (looking-at "fb\"$")))))) | 822 | (should (looking-at "fb\"$")))))) |
| 823 | 823 | ||
| 824 | (defun eglot-tests--get (object path) | ||
| 825 | (dolist (op path) | ||
| 826 | (setq object (if (natnump op) (aref object op) | ||
| 827 | (plist-get object op)))) | ||
| 828 | object) | ||
| 829 | |||
| 824 | (defun eglot-tests--lsp-abiding-column-1 () | 830 | (defun eglot-tests--lsp-abiding-column-1 () |
| 825 | (eglot--with-fixture | 831 | (eglot--with-fixture |
| 826 | '(("project" . | 832 | '(("project" . |
| @@ -837,7 +843,11 @@ int main() { | |||
| 837 | (insert "p ") | 843 | (insert "p ") |
| 838 | (eglot--signal-textDocument/didChange) | 844 | (eglot--signal-textDocument/didChange) |
| 839 | (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys) | 845 | (eglot--wait-for (c-notifs 2) (&key params &allow-other-keys) |
| 840 | (should (equal 71 (cadddr (cadadr (aref (cadddr params) 0)))))) | 846 | (message "PARAMS=%S" params) |
| 847 | (should (equal 71 (eglot-tests--get | ||
| 848 | params | ||
| 849 | '(:contentChanges 0 | ||
| 850 | :range :start :character))))) | ||
| 841 | (beginning-of-line) | 851 | (beginning-of-line) |
| 842 | (should (eq eglot-move-to-linepos-function #'eglot-move-to-utf-16-linepos)) | 852 | (should (eq eglot-move-to-linepos-function #'eglot-move-to-utf-16-linepos)) |
| 843 | (funcall eglot-move-to-linepos-function 71) | 853 | (funcall eglot-move-to-linepos-function 71) |