[PATCH] gdb/dap: stop setting CompletionItem.length

Oleg Tolmatcev <[email protected]> Sat, 1 Aug 2026 18:02:34 +0200
Newsgroups gmane.comp.gdb.patches
Message-ID <[email protected]>
Do not set the CompletionItem.length field in completions responses.
According to the DAP spec, length says how many characters the
completion text should overwrite. It is not the length of the
completion label, so using the label length here is wrong.
---
 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..fb8f078d046 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})
     # 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})
     return {"targets": result}
-- 
2.55.0.windows.1