From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: sbaugh@catern.com Newsgroups: gmane.emacs.devel Subject: Re: Allowing completion sources to customize completion display Date: Sat, 25 Nov 2023 17:36:07 +0000 Message-ID: <87jzq5ivlk.fsf@catern.com> References: <831qcghn52.fsf@gnu.org> <08c7660f-ee16-7159-581c-c8b2526a6035@gmail.com> <83il5rfwps.fsf@gnu.org> <7ac85e70-74cb-6a75-3188-9873ecd6b6ee@gutov.dev> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="31536"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) To: emacs-devel@gnu.org Cancel-Lock: sha1:F+yaF/y+2WGRUSfBTWOez6V3rDc= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Nov 25 19:22:45 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 1r6xIj-0007vv-O6 for ged-emacs-devel@m.gmane-mx.org; Sat, 25 Nov 2023 19:22:45 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r6xI0-00059S-3d; Sat, 25 Nov 2023 13:22:00 -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 1r6waI-0003Yr-FC for emacs-devel@gnu.org; Sat, 25 Nov 2023 12:36:50 -0500 Original-Received: from ciao.gmane.io ([116.202.254.214]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r6waG-00062y-Tm for emacs-devel@gnu.org; Sat, 25 Nov 2023 12:36:50 -0500 Original-Received: from list by ciao.gmane.io with local (Exim 4.92) (envelope-from ) id 1r6waE-0003jA-9N for emacs-devel@gnu.org; Sat, 25 Nov 2023 18:36:46 +0100 X-Injected-Via-Gmane: http://gmane.org/ Received-SPF: pass client-ip=116.202.254.214; envelope-from=ged-emacs-devel@m.gmane-mx.org; helo=ciao.gmane.io X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, HEADER_FROM_DIFFERENT_DOMAINS=0.249, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 25 Nov 2023 13:21:58 -0500 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:313216 Archived-At: 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)". > 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.