From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lndn.lancelotsix.com (vps-42846194.vps.ovh.net [IPv6:2001:41d0:801:2000::2400]) by sourceware.org (Postfix) with ESMTPS id 867CE385840A for ; Thu, 29 Jun 2023 08:33:21 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 867CE385840A Authentication-Results: sourceware.org; dmarc=pass (p=reject dis=none) header.from=lancelotsix.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=lancelotsix.com Received: from octopus (unknown [IPv6:2a02:390:9086:0:b939:4017:af1c:9f4]) by lndn.lancelotsix.com (Postfix) with ESMTPSA id F37B280E7A; Thu, 29 Jun 2023 08:33:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=lancelotsix.com; s=2021; t=1688027599; bh=rvp8BOJfhJw37p2JPiJQaS7EQt4MxHp6qeckF0LXc90=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=JlVNWBeOx1zkFIoIwpKXXP53nJ91A+jVyJ7DfHHh+mGYKQwWmxQIOvriQrebUpPgh GmSnd/3qSrSXJfF4jgTAWTtdmpRrvRFpPpBdz3YLu4zBGUDSKqV+C0K9zZbFZwLuCD 8Kce3/JxacEnx5tp68lP5IuUptsAJD1FWXnHjUU1JMonnvQXjlRn5RBlUvsRn3/ivV EV22gy8FDcAvJVTaZHnFy5q4qrR0W3lbzOs76R3yO7tERysf+w5OLpQJRCERMwDwnm o5woT52yWQm2FadWb7wXGcIvTKFV5AjSvFSk43iwUKPoh6a2ZQqxwlzCUVhM9LeUCp rPXeflNHhhrSg== Date: Thu, 29 Jun 2023 09:33:13 +0100 From: Lancelot SIX To: Simon Farre Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v1] gdb/DAP - Add completionsRequest Message-ID: <20230629083251.2aglieoblj2jw25l@octopus> References: <20230628162616.102268-1-simon.farre.cx@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230628162616.102268-1-simon.farre.cx@gmail.com> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.5.11 (lndn.lancelotsix.com [0.0.0.0]); Thu, 29 Jun 2023 08:33:19 +0000 (UTC) X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: > +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 >