[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 05ff697 29/69: Document current API breaches a bi
From: |
João Távora |
Subject: |
[elpa] externals/eglot 05ff697 29/69: Document current API breaches a bit |
Date: |
Fri, 22 Jun 2018 11:54:58 -0400 (EDT) |
branch: externals/eglot
commit 05ff697756f28671fadc4aaa5c494934768ee0d2
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
Document current API breaches a bit
* eglot-tests.el (eglot--call-with-dirs-and-files)
(auto-reconnect): use eglot--process
* eglot.el (eglot-shutdown, eglot, eglot-reconnect)
(eglot--connect): Use eglot--process
(eglot--process): Alias to concentrate the hack here.
(eglot--signal-textDocument/didChange): Tweak comment.
---
eglot-tests.el | 8 ++++----
eglot.el | 19 ++++++++++++-------
2 files changed, 16 insertions(+), 11 deletions(-)
diff --git a/eglot-tests.el b/eglot-tests.el
index 8afbfa5..777d2da 100644
--- a/eglot-tests.el
+++ b/eglot-tests.el
@@ -67,7 +67,7 @@
(let ((eglot-autoreconnect nil))
(mapc #'eglot-shutdown
(cl-remove-if-not
- (lambda (server) (process-live-p (jsonrpc--process server)))
+ (lambda (server) (process-live-p (eglot--process server)))
new-servers)))
(dolist (buf new-buffers) ;; have to save otherwise will get prompted
(with-current-buffer buf (save-buffer) (kill-buffer)))
@@ -145,13 +145,13 @@
;; In 1.2 seconds > `eglot-autoreconnect' kill servers. We
;; should have a automatic reconnection.
(run-with-timer 1.2 nil (lambda () (delete-process
- (jsonrpc--process server))))
- (while (process-live-p (jsonrpc--process server))
+ (eglot--process server))))
+ (while (process-live-p (eglot--process server))
(accept-process-output nil 0.5))
(should (jsonrpc-current-connection))
;; Now try again too quickly
(setq server (jsonrpc-current-connection))
- (let ((proc (jsonrpc--process server)))
+ (let ((proc (eglot--process server)))
(run-with-timer 0.5 nil (lambda () (delete-process proc)))
(while (process-live-p proc) (accept-process-output nil 0.5)))
(should (not (jsonrpc-current-connection))))))))
diff --git a/eglot.el b/eglot.el
index 1328331..ccb7b49 100644
--- a/eglot.el
+++ b/eglot.el
@@ -191,6 +191,11 @@ lasted more than that many seconds."
(defvar eglot--servers-by-project (make-hash-table :test #'equal)
"Keys are projects. Values are lists of processes.")
+;; HACK: Do something to fix this in the jsonrpc API or here, but in
+;; the meantime concentrate the hack here.
+(defalias 'eglot--process 'jsonrpc--process
+ "An abuse of `jsonrpc--process', a jsonrpc.el internal.")
+
(defun eglot-shutdown (server &optional _interactive)
"Politely ask SERVER to quit.
Forcefully quit it if it doesn't respond. Don't leave this
@@ -206,9 +211,9 @@ function with the server still running."
;; Turn off `eglot--managed-mode' where appropriate.
(dolist (buffer (eglot--managed-buffers server))
(with-current-buffer buffer (eglot--managed-mode-onoff server -1)))
- (when (process-live-p (jsonrpc--process server))
+ (when (process-live-p (eglot--process server))
(eglot--warn "Brutally deleting non-compliant server %s" (jsonrpc-name
server))
- (delete-process (jsonrpc--process server)))))
+ (delete-process (eglot--process server)))))
(defun eglot--on-shutdown (server)
"Called by jsonrpc.el when SERVER is already dead."
@@ -330,7 +335,7 @@ INTERACTIVE is t if called interactively."
(car (project-roots project)))))
(current-server (jsonrpc-current-connection))
(live-p (and current-server
- (process-live-p (jsonrpc--process current-server)))))
+ (process-live-p (eglot--process current-server)))))
(if (and live-p
interactive
(y-or-n-p "[eglot] Live process found, reconnect instead? "))
@@ -351,7 +356,7 @@ managing `%s' buffers in project `%s'."
"Reconnect to SERVER.
INTERACTIVE is t if called interactively."
(interactive (list (jsonrpc-current-connection-or-lose) t))
- (when (process-live-p (jsonrpc--process server))
+ (when (process-live-p (eglot--process server))
(eglot-shutdown server interactive))
(eglot--connect (eglot--project server)
(eglot--major-mode server)
@@ -391,7 +396,7 @@ And NICKNAME and CONTACT."
server
:initialize
(jsonrpc-obj :processId (unless (eq (process-type
- (jsonrpc--process server))
+ (eglot--process server))
'network)
(emacs-pid))
:rootPath (expand-file-name
@@ -415,7 +420,7 @@ And NICKNAME and CONTACT."
(setf (eglot--inhibit-autoreconnect server)
(null eglot-autoreconnect)))))))
(setq success server))
- (unless (or success (not (process-live-p (jsonrpc--process server)))
+ (unless (or success (not (process-live-p (eglot--process server)))
(eglot--moribund server))
(eglot-shutdown server)))))
@@ -851,7 +856,7 @@ Records START, END and PRE-CHANGE-LENGTH locally."
:text after-text)])))))
(setq eglot--recent-changes (cons [] []))
(setf (eglot--spinner server) (list nil :textDocument/didChange t))
- ;; HACK!
+ ;; HACK! perhaps jsonrpc should just call this on every send
(jsonrpc--call-deferred server))))
(defun eglot--signal-textDocument/didOpen ()
- [elpa] externals/eglot 7f2e894 11/69: Merge branch 'master' into jsonrpc-refactor (using good ol' git merge), (continued)
- [elpa] externals/eglot 7f2e894 11/69: Merge branch 'master' into jsonrpc-refactor (using good ol' git merge), João Távora, 2018/06/22
- [elpa] externals/eglot e5ba4f6 18/69: Automatically reply with error if dispatcher doesn't, João Távora, 2018/06/22
- [elpa] externals/eglot 33ae871 09/69: More flexible jrpc.el and improve eglot.el's doc, João Távora, 2018/06/22
- [elpa] externals/eglot 3265c1d 10/69: Simpler callback protocol for JSONRPC parameters and results, João Távora, 2018/06/22
- [elpa] externals/eglot e906d25 14/69: Overhaul JSON and JSRONRPC error handling, João Távora, 2018/06/22
- [elpa] externals/eglot 7cd94b9 12/69: Improve jrpc.el's doc (and change jrpc-request's protocol a tiny bit), João Távora, 2018/06/22
- [elpa] externals/eglot 489182d 24/69: New jsonrpc-error error type, João Távora, 2018/06/22
- [elpa] externals/eglot 5cea412 20/69: Fix typos and phrasing in commentary and docstrings, João Távora, 2018/06/22
- [elpa] externals/eglot c30f0f3 23/69: Get rid of jsonrpc.el customization group and timeout, João Távora, 2018/06/22
- [elpa] externals/eglot 5e8fe4c 26/69: Add jsonrpc-tests.el, João Távora, 2018/06/22
- [elpa] externals/eglot 05ff697 29/69: Document current API breaches a bit,
João Távora <=
- [elpa] externals/eglot 258e3b0 07/69: Merge master into jsonrpc-refactor (using imerge), João Távora, 2018/06/22
- [elpa] externals/eglot 4bbf810 25/69: Don't return implementation details in jsonrpc-async-request, João Távora, 2018/06/22
- [elpa] externals/eglot 5874af9 32/69: Fix deferred actions (forgot the crucial non-local exit), João Távora, 2018/06/22
- [elpa] externals/eglot 481f16e 33/69: * eglot.el (eglot-eldoc-function): Remove spurious log message, João Távora, 2018/06/22
- [elpa] externals/eglot c43dff4 35/69: On request timeout, clear it from the deferred actions, João Távora, 2018/06/22
- [elpa] externals/eglot 870c60a 04/69: Merge master into jsonrpc-refactor (using imerge), João Távora, 2018/06/22
- [elpa] externals/eglot 980f3e7 34/69: Fix another merge-related bug in eglot-eldoc-function, João Távora, 2018/06/22
- [elpa] externals/eglot fab7f8b 44/69: Improve Makefile test targets, João Távora, 2018/06/22
- [elpa] externals/eglot d7e1b92 42/69: * jsonrpc.el (jsonrpc-message): Fix formatting bug., João Távora, 2018/06/22
- [elpa] externals/eglot 0ba7964 40/69: * jsonrpc.el (jsonrpc-log-event): Log time of event., João Távora, 2018/06/22