From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: Allowing completion sources to customize completion display Date: Sat, 25 Nov 2023 20:27:51 +0200 Message-ID: <2e9b4c54-b81b-d04a-3c24-9c33545f8458@gutov.dev> References: <831qcghn52.fsf@gnu.org> <08c7660f-ee16-7159-581c-c8b2526a6035@gmail.com> <83il5rfwps.fsf@gnu.org> <7ac85e70-74cb-6a75-3188-9873ecd6b6ee@gutov.dev> <87jzq5ivlk.fsf@catern.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19702"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 To: sbaugh@catern.com, emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 25 19:28:29 2023 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1r6xOG-0004vk-PV for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Nov 2023 19:28:29 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6xNp-0007ap-CC; Sat, 25 Nov 2023 13:28:01 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6xNn-0007ab-W0 for emacs-devel@gnu.org; Sat, 25 Nov 2023 13:28:00 -0500 Original-Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6xNl-00069w-Pl for emacs-devel@gnu.org; Sat, 25 Nov 2023 13:27:59 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.47]) by mailout.nyi.internal (Postfix) with ESMTP id 0C91C5C00AD; Sat, 25 Nov 2023 13:27:55 -0500 (EST) Original-Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Sat, 25 Nov 2023 13:27:55 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:sender:subject:subject:to:to; s=fm3; t= 1700936875; x=1701023275; bh=RGarMueh4jHTTf0TrmJkgI/4MVoTcT82OOZ E/gmE9ps=; b=N/VydHopBai8FQTgNa3IeqgYxZFOdvR3ug2gasfA4bk63opgCX+ rNNbOpJi56SdWiQGaM6l2xQGKCRdsZqi8tyipIUHy1IFaLnTVmEEGNbT4BGbzKWz nyzgRp+tfidwraWy0Ffgvoj47MnUB9FSa/3hnyU0OINu3KWwmbyZQQT39N3QWn1n pbQ0rfF1CTqhpLN/yPumkdpW+ZtQ3hPiaijLtCD8IFHelJhNXHa0LIM8RxrM4EkQ gMguPU0Tm5TMBE8gl2JMq5sHxgW6xv53NIlXwwmzjAEFYvzNiPDaGv1XZ6ug6BAs wNtyegAb4eyhlWNj+Ozpbs/C5RKLtPLFSYg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1700936875; x= 1701023275; bh=RGarMueh4jHTTf0TrmJkgI/4MVoTcT82OOZE/gmE9ps=; b=F xqwg6Nxnb6MGyuOIaGBotbHlT5QJBuAmzJaoL6PWXBaXuyI86yPajYvPQz1U2X55 AM11GTls2emsKLEIIhNv/Hjx/PEW9w0Mj5iO+MPNpwhHXBIsg/RUhL7TCdwvcy5+ CcvVrms6FkvIc2KCMOiqeT8LpiUIz0MXYO/vJ1QkGpNU97D2cBQHvz2xfa5ZboT3 dS0tNNV87R+CB+ZDM/WFGH8exUbWitQyNVLq5ReFBqtJu5fGwwE4a2qLkRSyLm2m lHWmQfvdii7zrtiTPuNf9sVBbrXXIfxAA+ZI78mApDvi3bBbw/p4l9a09UAQBwHi dsnPSNfA01ukoCSyuvaaw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrudehjedgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecunecujfgurhepkfffgggfuffvfhfhjggtgfesth ejredttdefjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughmihhtrhihsehg uhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpeeghedthedujeeiteeutddtjeekhe ejteeukeehffdutdejuedvfeevueevieduudenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegumhhithhrhiesghhuthhovhdruggvvh X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 25 Nov 2023 13:27:53 -0500 (EST) Content-Language: en-US In-Reply-To: <87jzq5ivlk.fsf@catern.com> Received-SPF: pass client-ip=66.111.4.29; envelope-from=dmitry@gutov.dev; helo=out5-smtp.messagingengine.com X-Spam_score_int: -53 X-Spam_score: -5.4 X-Spam_bar: ----- X-Spam_report: (-5.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, NICE_REPLY_A=-2.63, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:313218 Archived-At: On 25/11/2023 19:36, sbaugh@catern.com wrote: > Dmitry Gutov writes: >> On 24/11/2023 19:28, Spencer Baugh wrote: >>> But basing this on the source is totally wrong. Instead if I, as a >>> user, think inline preview is better for multi-line completion >>> candidates, then inline preview should be used for multi-line completion >>> candidates regardless of where those candidates come from. >> >> Are multi-line completions better shown inline? If I had to choose, I >> might actually choose the opposite: show the shorter ones inline, and >> the long ones in a separate buffer -- so that the current buffer's >> text doesn't jump up and down as I'm typing something. > > The idea is that multi-line completions are big, so you can only really > afford to show one large completion candidate on-screen at a time. > Whereas for shorter completions you can usefully fit multiple on screen > at a time. > > To be clear, I haven't mentioned any in-buffer menus like company-mode > has. If it was done with company certainly there would be in-buffer > menus, and I think what I would want is "always show a preview frontend, > and show a tooltip frontend only if the completion candidates are > small. (not multi-line)". I hadn't considered company-mode in that context, but the preview frontend in there should look more or less like the "Completion Preview" feature proposed (or recently added?) to the core. >> But that strongly depends on how those long completions are going to >> be presented, whether they should replace the current text or just add >> new one (multiple lines of it), whether they are allowed to vary a >> lot, etc. > > The long completions in my case are ones which can both modify or add > text, both before or after point. > > But that's an interesting point. An in-buffer menu (like company-mode > has) is a lot less suitable for completions which modify the text in > complex ways. With such completions, an in-buffer preview is nicer. > > So perhaps that's another way a completion UI (such as company) could > alter its behavior based on the completions: only show completion > candidates in an in-buffer menu (a tooltip frontend) if they are > "simple" (e.g. just symbol completion which leaves point after the newly > inserted symbol). If they are complex, do an in-buffer preview. The menu can still be shown if the long candidates are "smartly" truncated in some way. And yeah, for that usage the preview frontend should probably be always-on, not just when there is just one completion.