* [PATCH] gdb/dap: compute CompletionItem.length from input
@ 2026-09-13 19:26 Oleg Tolmatcev
0 siblings, 0 replies; only message in thread
From: Oleg Tolmatcev @ 2026-09-13 19:26 UTC (permalink / raw)
To: gdb-patches; +Cc: Oleg Tolmatcev
The GDB/MI -complete command returns the complete command line,
including the prefix supplied by the user.
CompletionItem.length specifies how much of the existing input should
be replaced. Set it to the length of the text passed to -complete,
rather than the length of the returned completion.
---
gdb/python/lib/gdb/dap/completions.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/gdb/python/lib/gdb/dap/completions.py b/gdb/python/lib/gdb/dap/completions.py
index 5cc6e025ee5..8495e4f8b6b 100644
--- a/gdb/python/lib/gdb/dap/completions.py
+++ b/gdb/python/lib/gdb/dap/completions.py
@@ -49,7 +49,7 @@ def completions(
completion = None
if "completion" in mi_result:
completion = mi_result["completion"]
- result.append({"label": completion, "length": len(completion)})
+ result.append({"label": completion, "length": len(text)})
# If `-complete' finds one match then `completion' and `matches'
# will contain the same one match.
if (
@@ -59,5 +59,5 @@ def completions(
):
return {"targets": result}
for match in mi_result["matches"]:
- result.append({"label": match, "length": len(match)})
+ result.append({"label": match, "length": len(text)})
return {"targets": result}
--
2.55.0.windows.5
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-13 19:30 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-13 19:26 [PATCH] gdb/dap: compute CompletionItem.length from input Oleg Tolmatcev
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox