From: Lancelot SIX <lsix@lancelotsix.com>
To: Simon Farre <simon.farre.cx@gmail.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v1] gdb/DAP - Add completionsRequest
Date: Thu, 29 Jun 2023 09:33:13 +0100 [thread overview]
Message-ID: <20230629083251.2aglieoblj2jw25l@octopus> (raw)
In-Reply-To: <20230628162616.102268-1-simon.farre.cx@gmail.com>
> +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
>
next prev parent reply other threads:[~2023-06-29 8:33 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-28 16:26 Simon Farre
2023-06-29 8:33 ` Lancelot SIX [this message]
2023-06-29 12:01 ` Simon Farre
2023-07-03 19:11 ` Tom Tromey
2023-07-05 14:02 ` Simon Farre
2023-07-06 15:16 ` Tom Tromey
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=20230629083251.2aglieoblj2jw25l@octopus \
--to=lsix@lancelotsix.com \
--cc=gdb-patches@sourceware.org \
--cc=simon.farre.cx@gmail.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).