From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id DmafLepBnWRt/xAAWB0awg (envelope-from ) for ; Thu, 29 Jun 2023 04:33:46 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=xZIsdT75; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id B03CE1E0BB; Thu, 29 Jun 2023 04:33:46 -0400 (EDT) Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id A09861E00F for ; Thu, 29 Jun 2023 04:33:44 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 3BA213858CDA for ; Thu, 29 Jun 2023 08:33:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 3BA213858CDA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1688027623; bh=Ji9jJI6BZiCHNpKpQctGvQ7hmm1e6V/NYohmkUyLwPE=; h=Date:To:Cc:Subject:References:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=xZIsdT754NuG/VU1xRwUE2H8hRPzhaeauLjMP84EHM4zygG7cRrvZWeuP0Am0IuIZ mraldOM4cC7ll2WdrcOm0CM/hQ+OWlMF6vDnH0VBy85/G2McdEGzxmT3foiw99/ZbK 7aZ+7xk1MTfzithBHbt+YOUCaFsuYBwgJ3DkASrU= 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 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) Date: Thu, 29 Jun 2023 09:33:13 +0100 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 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Lancelot SIX via Gdb-patches Reply-To: Lancelot SIX Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" > +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 >