[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dape ae98178a3e 064/123: Improve repl when adapter proc
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dape ae98178a3e 064/123: Improve repl when adapter process non live |
Date: |
Tue, 5 Dec 2023 03:58:01 -0500 (EST) |
branch: externals/dape
commit ae98178a3ec7cccff98b7a686e15d8df06d2463f
Author: Daniel Pettersson <daniel@dpettersson.net>
Commit: Daniel Pettersson <daniel@dpettersson.net>
Improve repl when adapter process non live
- dape commands still work when dape--process dead
- fix issue where repl would print message without prompt char
---
dape.el | 110 +++++++++++++++++++++++++++++++---------------------------------
1 file changed, 53 insertions(+), 57 deletions(-)
diff --git a/dape.el b/dape.el
index e2b0352056..244e2cd636 100644
--- a/dape.el
+++ b/dape.el
@@ -307,7 +307,7 @@ Run step like COMMAND. If ARG is set run COMMAND ARG
times."
(dolist (thread dape--threads)
(plist-put thread :status "running"))
(dape--info-update-threads-widget)))))
- (message "No stopped thread.")))
+ (message "No live debug adapter process")))
(defun dape--thread-id-object ()
"Helper to construct a thread id object."
@@ -440,7 +440,8 @@ If EXTENDED end of line is after newline."
file
(regexp-quote
(expand-file-name
- (plist-get dape--config :cwd))))
+ (or (plist-get dape--config :cwd)
+ ""))))
(when line
(format ":%d"
line))))
@@ -2279,48 +2280,45 @@ interactively or if SELECT-BUFFER is non nil."
(defun dape--repl-input-sender (dummy-process input)
"Dape repl `comint-input-sender'."
(let (cmd)
- (if (not (dape--live-process t))
- (comint-output-filter dummy-process
- "DAPE server not running\n")
- (cond
- ;; Run previous input
- ((and (string-empty-p input)
- (not (string-empty-p (car (ring-elements comint-input-ring)))))
- (when-let ((last (car (ring-elements comint-input-ring))))
- (dape--repl-input-sender dummy-process last)))
- ;; Run command from `dape-named-commands'
- ((setq cmd
- (or (alist-get input dape-repl-commands nil nil 'equal)
- (and dape-repl-use-shorthand
- (cl-loop for (key . value) in dape-repl-commands
- when (equal (substring key 0 1) input)
- return value))))
- (setq dape--repl-insert-text-guard t)
- (comint-output-filter dummy-process "\n> ")
- (funcall cmd)
- (setq dape--repl-insert-text-guard nil))
- ;; Evaluate expression
- ((dape--stopped-threads)
- ;; FIXME `dape--repl-insert-text-guard' is used here to not mess up
ordering
- ;; when running commands that will itself trigger output request
- (setq dape--repl-insert-text-guard t)
- (dape--evaluate-expression (dape--live-process)
- (plist-get (dape--current-stack-frame) :id)
- (substring-no-properties input)
- "repl"
- (dape--callback
- (comint-output-filter dummy-process
- (concat
- (if success
- (plist-get body
:result)
- msg)
- "\n\n> "))
- (setq dape--repl-insert-text-guard nil))))
- (t
- (comint-output-filter
- dummy-process
- (format "* Unable to send \"%s\" no stopped threads *\n> "
- input)))))))
+ (cond
+ ;; Run previous input
+ ((and (string-empty-p input)
+ (not (string-empty-p (car (ring-elements comint-input-ring)))))
+ (when-let ((last (car (ring-elements comint-input-ring))))
+ (dape--repl-input-sender dummy-process last)))
+ ;; Run command from `dape-named-commands'
+ ((setq cmd
+ (or (alist-get input dape-repl-commands nil nil 'equal)
+ (and dape-repl-use-shorthand
+ (cl-loop for (key . value) in dape-repl-commands
+ when (equal (substring key 0 1) input)
+ return value))))
+ (setq dape--repl-insert-text-guard t)
+ (comint-output-filter dummy-process "\n> ")
+ (funcall cmd)
+ (setq dape--repl-insert-text-guard nil))
+ ;; Evaluate expression
+ ((dape--stopped-threads)
+ ;; FIXME `dape--repl-insert-text-guard' is used here to not mess up
ordering
+ ;; when running commands that will itself trigger output request
+ (setq dape--repl-insert-text-guard t)
+ (dape--evaluate-expression (dape--live-process)
+ (plist-get (dape--current-stack-frame) :id)
+ (substring-no-properties input)
+ "repl"
+ (dape--callback
+ (comint-output-filter dummy-process
+ (concat
+ (if success
+ (plist-get body
:result)
+ msg)
+ "\n\n> "))
+ (setq dape--repl-insert-text-guard nil))))
+ (t
+ (comint-output-filter
+ dummy-process
+ (format "* Unable to send \"%s\" no stopped threads *\n> "
+ input))))))
(defun dape--repl-completion-at-point ()
"Completion at point function for *dape-repl* buffer."
@@ -2347,15 +2345,14 @@ interactively or if SELECT-BUFFER is non nil."
(cdr bounds)
(completion-table-dynamic
(lambda (_str)
- (when-let ((frame-id (plist-get (dape--current-stack-frame) :id)))
- (dape-request
- (dape--live-process)
- "completions"
- (list :frameId frame-id
- :text str
- :column column
- :line 1)
- (dape--callback
+ (when-let ((process (dape--live-process t))
+ (frame-id (plist-get (dape--current-stack-frame) :id)))
+ (dape--with dape-request (process
+ "completions"
+ (list :frameId frame-id
+ :text str
+ :column column
+ :line 1))
(setq collection
(append
collection
@@ -2398,11 +2395,11 @@ interactively or if SELECT-BUFFER is non nil."
(propertize type
'face 'font-lock-type-face)))))
(plist-get body :targets))))
- (setq done t)))
+ (setq done t))
(while-no-input
(while (not done)
- (accept-process-output nil 0 1)))
- collection)))
+ (accept-process-output nil 0 1))))
+ collection))
:annotation-function
(lambda (str)
(when-let ((annotation
@@ -2410,7 +2407,6 @@ interactively or if SELECT-BUFFER is non nil."
nil nil 'equal)))
annotation)))))
-
(defvar dape--repl--prompt "> "
"Dape repl prompt.")
(defvar dape-repl-mode nil)
- [elpa] externals/dape ffaa4278cd 036/123: Fix checkdoc issues, (continued)
- [elpa] externals/dape ffaa4278cd 036/123: Fix checkdoc issues, ELPA Syncer, 2023/12/05
- [elpa] externals/dape de1508f4b3 037/123: Change to old style of keymap define with defvar, ELPA Syncer, 2023/12/05
- [elpa] externals/dape ee2aaad60f 038/123: Invoke customize-variable if dape-configs is null, ELPA Syncer, 2023/12/05
- [elpa] externals/dape a23bcb8e66 040/123: Add naively inline variable overlays, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 2a478560e9 052/123: Move breakpoint indications into the buffer margin #2, ELPA Syncer, 2023/12/05
- [elpa] externals/dape beaaca9c77 053/123: Fix missing server std out/err in debug buffer, ELPA Syncer, 2023/12/05
- [elpa] externals/dape ad8d8797fa 054/123: Fix missing newline for "stopped" event description, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 9eebb3c246 055/123: Fix missing newline from compilation failed msg, ELPA Syncer, 2023/12/05
- [elpa] externals/dape d6d79670f7 056/123: Slight rework of dape--read-config, ELPA Syncer, 2023/12/05
- [elpa] externals/dape cbbb807604 050/123: Fix type in readme cppdbg adapter example #3, ELPA Syncer, 2023/12/05
- [elpa] externals/dape ae98178a3e 064/123: Improve repl when adapter process non live,
ELPA Syncer <=
- [elpa] externals/dape 1d0cdcc466 070/123: Fix dape.el header #13, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 4a97094b10 077/123: Kill adapter on terminate event, ELPA Syncer, 2023/12/05
- [elpa] externals/dape bda32e7780 096/123: Fix issue of resetting start-debugging args #15, ELPA Syncer, 2023/12/05
- [elpa] externals/dape ba63e50434 106/123: Batteries included, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 87c91273ec 107/123: Add error message on launch/attach fail, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 2620078517 117/123: Improve error message on failed restart, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 0f545358e2 118/123: Fix strange usage of add to watch in scope buffer, ELPA Syncer, 2023/12/05
- [elpa] externals/dape c3fb0ebc32 075/123: Remove `dape--name', ELPA Syncer, 2023/12/05
- [elpa] externals/dape bc17ae80ff 078/123: Fix debuggee cleanup, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 30b2695154 087/123: Cancel timeout timers on process kill, ELPA Syncer, 2023/12/05