From: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
To: gdb-patches@sourceware.org
Cc: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
Subject: [PATCH] gdb/dap: compute CompletionItem.length from input
Date: Sun, 13 Sep 2026 21:26:14 +0200 [thread overview]
Message-ID: <20260913192613.1952-2-oleg.tolmatcev@gmail.com> (raw)
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
reply other threads:[~2026-09-13 19:30 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260913192613.1952-2-oleg.tolmatcev@gmail.com \
--to=oleg.tolmatcev@gmail.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox