[PATCH v1] gdb/DAP - Add completionsRequest
Lancelot SIX
lsix@lancelotsix.com
Thu Jun 29 08:33:13 GMT 2023
> +def _completions(text: str, column: int, line: Optional[int], frameId: Optional[int]):
> + cmd_output = gdb.execute("complete " + text, to_string=True)
> + result = []
> + for line in cmd_output.splitlines():
> + if "List may be truncated" not in line:
Hi Simon,
Instead of filtering out this message, would it make sense to allow GDB
to list all possible completions without size limit?
This can be done with:
cmd_output = gdb.execute("with max-completions unlimited -- complete " + text,
to_string=True)
I am not very familiar with the DAP protocol, but looking at it I did
not see a mechanism to limit the number of items returned, or a way for
GDB to let the client know that more options are available. Is there a
way to do this?
Best,
Lancelot.
> + result.append({"label": line, "type": "function", "length": len(text)})
> + return {"targets": result}
> +
> +
> +@request("completions")
> +@capability("supportsCompletionsRequest")
> +@capability("completionTriggerCharacters", [" ", "."])
> +def completions(
> + *,
> + text: str,
> + column: int,
> + line: Optional[int] = None,
> + frameId: Optional[int] = None,
> + **extra
> +):
> +
> + return send_gdb_with_response(lambda: _completions(text, column, line, frameId))
> --
> 2.41.0
>
More information about the Gdb-patches
mailing list