[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/eglot 92c4bdf 6/8: New M-x eglot-stderr-buffer useful f
From: |
João Távora |
Subject: |
[elpa] externals/eglot 92c4bdf 6/8: New M-x eglot-stderr-buffer useful for debugging |
Date: |
Tue, 29 May 2018 22:21:25 -0400 (EDT) |
branch: externals/eglot
commit 92c4bdfbbce037d02e363b49b1e51aed2ec86104
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>
New M-x eglot-stderr-buffer useful for debugging
* eglot.el (eglot--make-process): Save stderr buffer in process.
(eglot-stderr-buffer): New interactive command.
(eglot--mode-line-format): Bind C-mouse-1 to new
eglot-stderr-buffer.
---
README.md | 3 +++
eglot.el | 38 +++++++++++++++++++++-----------------
2 files changed, 24 insertions(+), 17 deletions(-)
diff --git a/README.md b/README.md
index 3b95438..c88f804 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,9 @@ Here's a summary of available commands:
- `M-x eglot-events-buffer` jumps to the events buffer for debugging
communication with the server.
+- `M-x eglot-stderr-buffer` if the LSP server is printing useful debug
+information in stderr, jumps to a buffer with these contents.
+
There are *no keybindings* specific to Eglot, but you can bind stuff
in `eglot-mode-map`, which is active as long as Eglot is managing a
file in your project. The commands don't need to be Eglot-specific,
diff --git a/eglot.el b/eglot.el
index d754993..f3bf2b7 100644
--- a/eglot.el
+++ b/eglot.el
@@ -233,22 +233,21 @@ DEFERRED request from BUF, to be sent not later than
TIMER as ID."
"Make a process object from CONTACT.
NAME is used to name the the started process or connection.
CONTACT is in `eglot'. Returns a process object."
- (let* ((buffer (get-buffer-create (format "*%s stdout*" name)))
+ (let* ((stdout (format "*%s stdout*" name)) stderr
(proc (cond
((processp contact) contact)
((integerp (cadr contact))
- (apply #'open-network-stream name buffer contact))
+ (apply #'open-network-stream name stdout contact))
(t (make-process
- :name name
- :command contact
- :coding 'no-conversion
- :connection-type 'pipe
- :stderr (get-buffer-create (format "*%s stderr*"
name)))))))
- (set-process-buffer proc buffer)
- (set-marker (process-mark proc) (with-current-buffer buffer (point-min)))
+ :name name :command contact :buffer stdout
+ :coding 'no-conversion :connection-type 'pipe
+ :stderr (setq stderr (format "*%s stderr*" name)))))))
+ (process-put proc 'eglot-stderr stderr)
+ (set-process-buffer proc (get-buffer-create stdout))
+ (set-marker (process-mark proc) (with-current-buffer stdout (point-min)))
(set-process-filter proc #'eglot--process-filter)
(set-process-sentinel proc #'eglot--process-sentinel)
- (with-current-buffer buffer
+ (with-current-buffer stdout
(let ((inhibit-read-only t)) (erase-buffer) (read-only-mode t)))
proc))
@@ -544,6 +543,12 @@ INTERACTIVE is t if called interactively."
(when interactive (display-buffer buffer))
buffer))
+(defun eglot-stderr-buffer (server)
+ "Pop to stderr of SERVER, if it exists, else error."
+ (interactive (list (eglot--current-server-or-lose)))
+ (if-let ((b (process-get (eglot--process server) 'eglot-stderr)))
+ (pop-to-buffer b) (user-error "[eglot] No stderr buffer!")))
+
(defun eglot--log-event (server message &optional type)
"Log an eglot-related event.
SERVER is the current server. MESSAGE is a JSON-like plist.
@@ -934,26 +939,25 @@ Uses THING, FACE, DEFS and PREPEND."
(when name
`(":" ,(eglot--mode-line-props
name 'eglot-mode-line
- '((mouse-1 eglot-events-buffer "go to events buffer")
+ '((C-mouse-1 eglot-stderr-buffer "go to stderr buffer")
+ (mouse-1 eglot-events-buffer "go to events buffer")
(mouse-2 eglot-shutdown "quit server")
(mouse-3 eglot-reconnect "reconnect to server")))
,@(when serious-p
`("/" ,(eglot--mode-line-props
"error" 'compilation-mode-line-fail
- '((mouse-1 eglot-events-buffer "go to events buffer")
- (mouse-3 eglot-clear-status "clear this status"))
+ '((mouse-3 eglot-clear-status "clear this status"))
(format "An error occured: %s\n" status))))
,@(when (and doing (not done-p))
`("/" ,(eglot--mode-line-props
(format "%s%s" doing
(if detail (format ":%s" detail) ""))
- 'compilation-mode-line-run
- '((mouse-1 eglot-events-buffer "go to events buffer")))))
+ 'compilation-mode-line-run '())))
,@(when (cl-plusp pending)
`("/" ,(eglot--mode-line-props
(format "%d" pending) 'warning
- '((mouse-1 eglot-events-buffer "go to events buffer")
- (mouse-3 eglot-clear-status "clear this status"))
+ '((mouse-3 eglot-forget-pending-continuations
+ "forget these continuations"))
(format "%d pending requests\n" pending)))))))))
(add-to-list 'mode-line-misc-info
- [elpa] externals/eglot updated (796e3c2 -> 4211e0c), João Távora, 2018/05/29
- [elpa] externals/eglot ab8bbdb 2/8: Set eglot--versioned-identifier to 0 on didOpen, João Távora, 2018/05/29
- [elpa] externals/eglot 14c7647 4/8: Be more criterious before running the idle timer, João Távora, 2018/05/29
- [elpa] externals/eglot 9c5ff71 1/8: Correctly apply workspace edits in documentChanges form, João Távora, 2018/05/29
- [elpa] externals/eglot c2fd78f 3/8: Make eglot--recent-changes a simpler list, João Távora, 2018/05/29
- [elpa] externals/eglot 4416781 5/8: On reconnection, ignore errors of shutting down hung server, João Távora, 2018/05/29
- [elpa] externals/eglot 4211e0c 8/8: * eglot.el (Version): Bump to 0.7, João Távora, 2018/05/29
- [elpa] externals/eglot b97af33 7/8: More yak shaving, João Távora, 2018/05/29
- [elpa] externals/eglot 92c4bdf 6/8: New M-x eglot-stderr-buffer useful for debugging,
João Távora <=