(defun eglot--after-change (beg end pre-change-length)
"Hook onto `after-change-functions'.
Records BEG, END and PRE-CHANGE-LENGTH locally."
+ (cl-incf eglot--versioned-identifier)
(pcase (car-safe eglot--recent-changes)
(`(,lsp-beg ,lsp-end
(,b-beg . ,b-beg-marker)
(if (eq eglot--recent-changes :pending) (setq eglot--recent-changes nil))
(track-changes-fetch
id (lambda (beg end before)
+ (cl-incf eglot--versioned-identifier)
(cond
((eq eglot--recent-changes :emacs-messup) nil)
((eq before 'error) (setf eglot--recent-changes :emacs-messup))
eglot--recent-changes))))))
(defun eglot--track-changes-signal (id &optional distance)
- (cl-incf eglot--versioned-identifier)
(cond
(distance
;; When distance is <100, we may as well coalesce the changes.
(defun eglot--signal-textDocument/didChange ()
"Send textDocument/didChange to server."
+ (when eglot--track-changes
+ (eglot--track-changes-fetch eglot--track-changes))
(when eglot--recent-changes
- (when eglot--track-changes
- (eglot--track-changes-fetch eglot--track-changes))
(let* ((server (eglot--current-server-or-lose))
(sync-capability (eglot-server-capable :textDocumentSync))
(sync-kind (if (numberp sync-capability) sync-capability
(should (looking-back "\"foo.bar\": \""))
(should (looking-at "fb\"$"))))))
+(defun eglot-tests--get (object path)
+ (dolist (op path)
+ (setq object (if (natnump op) (aref object op)
+ (plist-get object op))))
+ object)
+
(defun eglot-tests--lsp-abiding-column-1 ()
(eglot--with-fixture
'(("project" .
(insert "p ")
(eglot--signal-textDocument/didChange)
(eglot--wait-for (c-notifs 2) (&key params &allow-other-keys)
- (should (equal 71 (cadddr (cadadr (aref (cadddr params) 0))))))
+ (message "PARAMS=%S" params)
+ (should (equal 71 (eglot-tests--get
+ params
+ '(:contentChanges 0
+ :range :start :character)))))
(beginning-of-line)
(should (eq eglot-move-to-linepos-function #'eglot-move-to-utf-16-linepos))
(funcall eglot-move-to-linepos-function 71)