[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/elpa f76f04e 057/139: More correctly keep track of didO
From: |
João Távora |
Subject: |
[elpa] externals/elpa f76f04e 057/139: More correctly keep track of didOpen/didClose per buffer |
Date: |
Mon, 14 May 2018 09:53:34 -0400 (EDT) |
branch: externals/elpa
commit f76f04e1226dc6a3ebe7b913ee9c6ddaef73634e
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
More correctly keep track of didOpen/didClose per buffer
* eglot.el (eglot--buffer-open-count): Now a process-local var.
(eglot--signal-textDocument/didOpen, eglot--signal-textDocument/didClose):
Use it.
---
eglot.el | 42 +++++++++++++++++++++++++++---------------
1 file changed, 27 insertions(+), 15 deletions(-)
diff --git a/eglot.el b/eglot.el
index bdd339d..ac52b9a 100644
--- a/eglot.el
+++ b/eglot.el
@@ -138,6 +138,9 @@ A list (WHAT SERIOUS-P)." t)
Must be a function of one arg, a name, returning a process
object.")
+(eglot--define-process-var eglot--buffer-open-count (make-hash-table)
+ "Keeps track of didOpen/didClose notifs for each buffer.")
+
(defun eglot-make-local-process (name command)
"Make a local LSP process from COMMAND.
NAME is a name to give the inferior process or connection.
@@ -1026,26 +1029,35 @@ Records START, END and PRE-CHANGE-LENGTH locally."
(setq eglot--recent-before-changes nil
eglot--recent-after-changes nil))
-(defvar-local eglot--buffer-open-count 0)
(defun eglot--signal-textDocument/didOpen ()
"Send textDocument/didOpen to server."
- (cl-incf eglot--buffer-open-count)
- (when (> eglot--buffer-open-count 1)
- (error "Too many textDocument/didOpen notifs for %s" (current-buffer)))
- (eglot--notify (eglot--current-process-or-lose)
- :textDocument/didOpen
- (eglot--obj :textDocument
- (eglot--current-buffer-TextDocumentItem))))
+ (let* ((proc (eglot--current-process-or-lose))
+ (count (1+ (or (gethash (current-buffer)
+ (eglot--buffer-open-count proc))
+ 0))))
+ (when (> count 1)
+ (eglot--error "Too many textDocument/didOpen notifs for %s"
(current-buffer)))
+ (setf (gethash (current-buffer) (eglot--buffer-open-count proc))
+ count)
+ (eglot--notify proc
+ :textDocument/didOpen
+ (eglot--obj :textDocument
+ (eglot--current-buffer-TextDocumentItem)))))
(defun eglot--signal-textDocument/didClose ()
"Send textDocument/didClose to server."
- (cl-decf eglot--buffer-open-count)
- (when (< eglot--buffer-open-count 0)
- (error "Too many textDocument/didClose notifs for %s" (current-buffer)))
- (eglot--notify (eglot--current-process-or-lose)
- :textDocument/didClose
- (eglot--obj :textDocument
- (eglot--current-buffer-TextDocumentItem))))
+ (let* ((proc (eglot--current-process-or-lose))
+ (count (1- (or (gethash (current-buffer)
+ (eglot--buffer-open-count proc))
+ 0))))
+ (when (< count 0)
+ (eglot--error "Too many textDocument/didClose notifs for %s"
(current-buffer)))
+ (setf (gethash (current-buffer) (eglot--buffer-open-count proc))
+ count)
+ (eglot--notify proc
+ :textDocument/didClose
+ (eglot--obj :textDocument
+ (eglot--current-buffer-TextDocumentItem)))))
(defun eglot--signal-textDocument/willSave ()
"Send textDocument/willSave to server."
- [elpa] externals/elpa cc183a6 043/139: Fix assorted bugs, (continued)
- [elpa] externals/elpa cc183a6 043/139: Fix assorted bugs, João Távora, 2018/05/14
- [elpa] externals/elpa e8f859e 031/139: Rework commands for connecting and reconnecting, João Távora, 2018/05/14
- [elpa] externals/elpa b511b7d 036/139: Redesign and simplify parser, João Távora, 2018/05/14
- [elpa] externals/elpa b4dd4f8 022/139: Report server status in the mode-line, João Távora, 2018/05/14
- [elpa] externals/elpa 46bb1c0 049/139: Reorganize file, João Távora, 2018/05/14
- [elpa] externals/elpa b69302c 060/139: Make M-x eglot's interactive spec a separate function, João Távora, 2018/05/14
- [elpa] externals/elpa b657b32 068/139: Use rootUri instead of rootPath, João Távora, 2018/05/14
- [elpa] externals/elpa eebd32b 059/139: When user declines to reconnect, first quit existing server, João Távora, 2018/05/14
- [elpa] externals/elpa f1b6485 053/139: Trim some edges and add a bunch of boring RPC methods, João Távora, 2018/05/14
- [elpa] externals/elpa df5d76d 065/139: Reply to client/registerCapability (don't handle it yet), João Távora, 2018/05/14
- [elpa] externals/elpa f76f04e 057/139: More correctly keep track of didOpen/didClose per buffer,
João Távora <=
- [elpa] externals/elpa a199c8e 070/139: Honour textDocumentSync, João Távora, 2018/05/14
- [elpa] externals/elpa 79a2a1e 069/139: Be quite explicit about our lack of capabilities right now, João Távora, 2018/05/14
- [elpa] externals/elpa ff5a03d 074/139: Very basic xref support, João Távora, 2018/05/14
- [elpa] externals/elpa b1554fc 055/139: * eglot.el (eglot--process-receive): Skip null method notifs., João Távora, 2018/05/14
- [elpa] externals/elpa 9882bf2 072/139: Cleanup mistake with TextDocumentItem and TextDocumentIdentifier, João Távora, 2018/05/14
- [elpa] externals/elpa fc6879f 084/139: Explain why didOpen on after-revert-hook is a bad idea, João Távora, 2018/05/14
- [elpa] externals/elpa fdb4de1 039/139: Simplify flymake integration, João Távora, 2018/05/14
- [elpa] externals/elpa 39e8b9e 081/139: Add (dummy) tests and Travis CI integration, João Távora, 2018/05/14
- [elpa] externals/elpa 1356844 097/139: Fix odd bugs, João Távora, 2018/05/14
- [elpa] externals/elpa 889ef20 085/139: Tweak the async request engine., João Távora, 2018/05/14