[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 77755706f08: Gud LLDB fix for large completion count (bug#66625)
From: |
Gerd Moellmann |
Subject: |
master 77755706f08: Gud LLDB fix for large completion count (bug#66625) |
Date: |
Thu, 19 Oct 2023 02:45:24 -0400 (EDT) |
branch: master
commit 77755706f086ac3d8d1fc560aee4a29e0fb64c77
Author: Gerd Möllmann <gerd.moellmann@gmail.com>
Commit: Gerd Möllmann <gerd.moellmann@gmail.com>
Gud LLDB fix for large completion count (bug#66625)
* lisp/progmodes/gud.el (gud-lldb-max-completions): New defcustom.
(gud-lldb-def-python-completion-function): New argument.
(gud-lldb-fetch-completions): Pass max count to gud_complete.
(gud-lldb-initialize): Change text displayed at the end.
---
lisp/progmodes/gud.el | 40 +++++++++++++++++++++++-----------------
1 file changed, 23 insertions(+), 17 deletions(-)
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 86836e153e5..1c7810803e2 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -3855,7 +3855,7 @@ so they have been disabled."))
(defvar gud-lldb-history nil)
(defcustom gud-gud-lldb-command-name "lldb"
- "Default command to run an executable under LLDB in text command mode."
+ "Default command to run an executable under LLDB."
:type 'string)
(defun gud-lldb-marker-filter (string)
@@ -3897,6 +3897,25 @@ so they have been disabled."))
;;
;; If there is no common prefix, index 0 has an empty string "".
+(defcustom gud-lldb-max-completions 20
+ "Maximum number of completions to request from LLDB."
+ :type 'integer)
+
+(defvar gud-lldb-def-python-completion-function
+ "
+def gud_complete(s, max):
+ interpreter = lldb.debugger.GetCommandInterpreter()
+ string_list = lldb.SBStringList()
+ interpreter.HandleCompletion(s, len(s), len(s), max, string_list)
+ print('gud-completions: (')
+ # Specifying a max count doesn't seem to work in LLDB 17.
+ max = min(max, string_list.GetSize())
+ for i in range(max):
+ print(f'\"{string_list.GetStringAtIndex(i)}\" ')
+ print(')')
+"
+ "LLDB Python function for completion.")
+
(defun gud-lldb-fetch-completions (context command)
"Return the data to complete the LLDB command before point.
This is what the Python function we installed at initialzation
@@ -3908,8 +3927,8 @@ time returns, as a Lisp list."
(with-current-buffer output-buffer
(erase-buffer))
(comint-redirect-send-command-to-process
- (format "script --language python -- gud_complete('%s')"
- to-complete)
+ (format "script --language python -- gud_complete('%s', %d)"
+ to-complete gud-lldb-max-completions)
output-buffer process nil t)
;; Wait for output
(unwind-protect
@@ -3944,19 +3963,6 @@ time returns, as a Lisp list."
(completion-table-dynamic
(apply-partially #'gud-lldb-completions context)))))
-(defvar gud-lldb-def-python-completion-function
- "
-def gud_complete(s):
- interpreter = lldb.debugger.GetCommandInterpreter()
- string_list = lldb.SBStringList()
- interpreter.HandleCompletion(s, len(s), len(s), -1, string_list)
- print('gud-completions: (')
- for i in range(string_list.GetSize()):
- print(f'\"{string_list.GetStringAtIndex(i)}\" ')
- print(')')
-"
- "LLDB command to define a Python function for completion.")
-
(defun gud-lldb-send-python (python)
(gud-basic-call "script --language python --")
(mapc #'gud-basic-call (split-string python "\n"))
@@ -3967,7 +3973,7 @@ def gud_complete(s):
(gud-lldb-send-python gud-lldb-def-python-completion-function)
(gud-basic-call "settings set stop-line-count-before 0")
(gud-basic-call "settings set stop-line-count-after 0")
- (gud-basic-call "script --language python -- print('Gud initialized')"))
+ (gud-basic-call "script --language python -- print('Gud initialized.')"))
;;;###autoload
(defun lldb (command-line)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 77755706f08: Gud LLDB fix for large completion count (bug#66625),
Gerd Moellmann <=