[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot f76f04e 057/139: More correctly keep track of did
From: |
João Távora |
Subject: |
[elpa] externals/eglot f76f04e 057/139: More correctly keep track of didOpen/didClose per buffer |
Date: |
Mon, 14 May 2018 09:54:53 -0400 (EDT) |
branch: externals/eglot
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/eglot fdb4de1 039/139: Simplify flymake integration, (continued)
- [elpa] externals/eglot fdb4de1 039/139: Simplify flymake integration, João Távora, 2018/05/14
- [elpa] externals/eglot cc183a6 043/139: Fix assorted bugs, João Távora, 2018/05/14
- [elpa] externals/eglot df5d76d 065/139: Reply to client/registerCapability (don't handle it yet), João Távora, 2018/05/14
- [elpa] externals/eglot c2862f4 063/139: Don't auto-reconnect if last attempt lasted less than 3 seconds, João Távora, 2018/05/14
- [elpa] externals/eglot f1b6485 053/139: Trim some edges and add a bunch of boring RPC methods, João Távora, 2018/05/14
- [elpa] externals/eglot 0e95167 042/139: Watch for files opened under umbrella of existing process, João Távora, 2018/05/14
- [elpa] externals/eglot 4d4b85d 061/139: eglot-editing-mode becomes eglot--managed-mode, João Távora, 2018/05/14
- [elpa] externals/eglot e7ffc31 067/139: Make reported capabilities into its own function, João Távora, 2018/05/14
- [elpa] externals/eglot 79a2a1e 069/139: Be quite explicit about our lack of capabilities right now, João Távora, 2018/05/14
- [elpa] externals/eglot 95187cf 058/139: Connect to LSP server via TCP, João Távora, 2018/05/14
- [elpa] externals/eglot f76f04e 057/139: More correctly keep track of didOpen/didClose per buffer,
João Távora <=
- [elpa] externals/eglot 46bb1c0 049/139: Reorganize file, João Távora, 2018/05/14
- [elpa] externals/eglot ff5a03d 074/139: Very basic xref support, João Távora, 2018/05/14
- [elpa] externals/eglot e9b5e54 077/139: ETOOMANYLAMBDAS, João Távora, 2018/05/14
- [elpa] externals/eglot dda11dd 095/139: Try to fix some textDocument/completion bugs, João Távora, 2018/05/14
- [elpa] externals/eglot ea918ab 066/139: Include source info in diagnostics, João Távora, 2018/05/14
- [elpa] externals/eglot a199c8e 070/139: Honour textDocumentSync, João Távora, 2018/05/14
- [elpa] externals/eglot e86f9b4 073/139: New helper eglot--sync-request, João Távora, 2018/05/14
- [elpa] externals/eglot 1add335 078/139: Workaround two suspected Emacs bugs, João Távora, 2018/05/14
- [elpa] externals/eglot 889ef20 085/139: Tweak the async request engine., João Távora, 2018/05/14
- [elpa] externals/eglot 193c57d 075/139: Half-decent xref support, João Távora, 2018/05/14