gdb/dap: stop setting CompletionItem.length

Message ID 20260801160233.79-2-oleg.tolmatcev@gmail.com
State New
Headers
Series gdb/dap: stop setting CompletionItem.length |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 success Test passed
linaro-tcwg-bot/tcwg_gdb_check--master-arm success Test passed

Commit Message

Oleg Tolmatcev Aug. 1, 2026, 4:02 p.m. UTC
  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(-)
  

Patch

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}