[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/dape 8cc8b262c1 059/123: Add custom formatting to dape-
From: |
ELPA Syncer |
Subject: |
[elpa] externals/dape 8cc8b262c1 059/123: Add custom formatting to dape-info variables |
Date: |
Tue, 5 Dec 2023 03:58:00 -0500 (EST) |
branch: externals/dape
commit 8cc8b262c15a4168747b5f92fc4e2e3048f839f6
Author: Daniel Pettersson <daniel@dpettersson.net>
Commit: Daniel Pettersson <daniel@dpettersson.net>
Add custom formatting to dape-info variables
Multi line strings in the dape-info buffer looks off, add custom flag
for turning it on again.
---
dape.el | 66 +++++++++++++++++++++++++++++++++++++----------------------------
1 file changed, 38 insertions(+), 28 deletions(-)
diff --git a/dape.el b/dape.el
index 235e265462..838a515f24 100644
--- a/dape.el
+++ b/dape.el
@@ -168,8 +168,12 @@ The hook is run with one argument, the compilation buffer."
"Maximum length of inline variable overlays."
:type 'natnum)
-(defcustom dape--debug-on
- '(io info error std-server)
+(defcustom dape-info-buffer-variable-format 'line
+ "How variables are formatted in *dape-info* buffer."
+ :type '(choice (const :tag "Truncate string at new line" line)
+ (const :tag "No formatting" nil)))
+
+(defcustom dape--debug-on '(io info error std-server)
"Types of logs should be printed to *dape-debug*."
:type '(set (const :tag "dap IO" io)
(const :tag "info logging" info)
@@ -1900,32 +1904,38 @@ Depth is decided by `dape--info-variables-fetch-depth'."
(defun dape--variable-to-widget (tree variable)
"Create variable widget from VARIABLE under TREE."
- (cond
- ((zerop (plist-get variable :variablesReference))
- (widget-convert
- 'item
- :tag (dape--variable-string variable)))
- (t
- (widget-convert
- 'dape--tree-widget
- :parent tree
- :key (plist-get variable :name)
- :default (equal (plist-get variable :presentationHint) "locals")
- :tag (dape--variable-string variable)
- :expander-p
- (lambda (tree)
- (if (plist-get variable :variables)
- t
- (dape--variables (dape--live-process)
- variable
- (dape--callback
- (when (plist-get variable :variables)
- (dape--info-update-widget tree))))
- nil))
- :expander
- (lambda (tree)
- (mapcar (apply-partially 'dape--variable-to-widget tree)
- (plist-get variable :variables)))))))
+ (let ((variable-string (dape--variable-string variable)))
+ ;; Apply formatting
+ (when (eq dape-info-buffer-variable-format 'line)
+ (setq variable-string
+ (substring variable-string
+ 0 (string-match-p "\n" variable-string))))
+ (cond
+ ((zerop (plist-get variable :variablesReference))
+ (widget-convert
+ 'item
+ :tag variable-string))
+ (t
+ (widget-convert
+ 'dape--tree-widget
+ :parent tree
+ :key (plist-get variable :name)
+ :default (equal (plist-get variable :presentationHint) "locals")
+ :tag variable-string
+ :expander-p
+ (lambda (tree)
+ (if (plist-get variable :variables)
+ t
+ (dape--variables (dape--live-process)
+ variable
+ (dape--callback
+ (when (plist-get variable :variables)
+ (dape--info-update-widget tree))))
+ nil))
+ :expander
+ (lambda (tree)
+ (mapcar (apply-partially 'dape--variable-to-widget tree)
+ (plist-get variable :variables))))))))
(defun dape--expand-scopes-p (tree)
"Expander predicate for `dape--scopes-widget'."
- [elpa] externals/dape 87c91273ec 107/123: Add error message on launch/attach fail, (continued)
- [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
- [elpa] externals/dape 41cfcc3ce3 089/123: Variety of dape--tree-widget performance "hacks", ELPA Syncer, 2023/12/05
- [elpa] externals/dape b7c578992d 094/123: Fix unnecessary newline in stopped repl text, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 4c990a5769 110/123: Rename `dape-breakpoint-*' functions for discoverability, ELPA Syncer, 2023/12/05
- [elpa] externals/dape f02fc87e82 116/123: Fix fringe check when placing breakpoints, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 8cc8b262c1 059/123: Add custom formatting to dape-info variables,
ELPA Syncer <=
- [elpa] externals/dape ebd9ebf6a8 074/123: Default to "sensible" values in `dape-config' when missing, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 5c62153574 042/123: Fix various customization types, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 3770a22b28 060/123: Cleanup before emacs exits #8, ELPA Syncer, 2023/12/05
- [elpa] externals/dape b27a7db84c 071/123: Add defcustom buffer actions to Dape buffers, ELPA Syncer, 2023/12/05
- [elpa] externals/dape f982879c17 080/123: Cleanup timeouts before restart, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 5f65524007 102/123: Fix REPL completions when process has never stopped #15, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 2831601925 014/123: Small README improvements, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 3a05121b02 019/123: Fix adapter examples, ELPA Syncer, 2023/12/05
- [elpa] externals/dape df0c2d8357 023/123: Require success to launch/attach after initialize, ELPA Syncer, 2023/12/05
- [elpa] externals/dape 161501b4a5 029/123: Fix example in readme, ELPA Syncer, 2023/12/05