From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#66948: [PATCH] Add Completion Preview mode Date: Wed, 15 Nov 2023 15:27:34 +0200 Message-ID: <83wmujqh89.fsf@gnu.org> References: <87lebcqcof.fsf@posteo.net> <86a5rrcqd3.fsf@mail.linkov.net> <86zfzqeoix.fsf@mail.linkov.net> <86msvobtjm.fsf@mail.linkov.net> <86y1f7cs8l.fsf@mail.linkov.net> <83v8aaxdcy.fsf@gnu.org> <83msvlyczy.fsf@gnu.org> <83sf5cwu01.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="39177"; mail-complaints-to="usenet@ciao.gmane.io" Cc: philipk@posteo.net, juri@linkov.net, dmitry@gutov.dev, joaotavora@gmail.com, 66948@debbugs.gnu.org, stefankangas@gmail.com To: Eshel Yaron Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 15 17:08:52 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1r3IRf-0009yc-DP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 15 Nov 2023 17:08:51 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1r3IQu-0002xI-JW; Wed, 15 Nov 2023 11:08:04 -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 1r3IQt-0002wu-EG for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2023 11:08:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1r3IQt-00005k-6L for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2023 11:08:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1r3IQr-0001Vb-QH for bug-gnu-emacs@gnu.org; Wed, 15 Nov 2023 11:08:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 15 Nov 2023 16:08:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66948 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66948-submit@debbugs.gnu.org id=B66948.17000644645707 (code B ref 66948); Wed, 15 Nov 2023 16:08:01 +0000 Original-Received: (at 66948) by debbugs.gnu.org; 15 Nov 2023 16:07:44 +0000 Original-Received: from localhost ([127.0.0.1]:53017 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3IQa-0001Ts-5q for submit@debbugs.gnu.org; Wed, 15 Nov 2023 11:07:44 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58120) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1r3IQV-0001QS-Ox for 66948@debbugs.gnu.org; Wed, 15 Nov 2023 11:07:40 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1r3Fvl-0004yl-Rb; Wed, 15 Nov 2023 08:27:45 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=v1SWpq67D3XvVLMjMgpp/ofxd/IFzIChkL37KmhMNQo=; b=CRfq1Dqw950g +akWmC1zJG90bpZREUTGxgltOxQa0oDqF4Zq6z3bNRt6t2DmHkeJMGla00qn95urdzG5L2m3E8vVD WF0n+yMIVxZX9Usrc/T/88s0bUqCWNnZh7yz/3X1VgpzZZi55HjF+IzD2JZ46wBnfi8Fq9aSm6Rf3 ICWh7ddMZ7kTq0bVkE4NOpxq2GZAlTCZfo774ygbO+MZHrNLfiFegRJ2TvShloZDp4YBhTPe66wbl 1m10RyMfUr4zyFF3ZY9xrZmxXP6ONRaQEdpl32cMWF35EQi7Kukzg8K8rsJjs110mHwjqd11ikwT+ asZkvYkH72obtjxBiu7Uvw==; In-Reply-To: (message from Eshel Yaron on Sat, 11 Nov 2023 13:01:27 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:274362 Archived-At: > From: Eshel Yaron > Cc: philipk@posteo.net, juri@linkov.net, dmitry@gutov.dev, > stefankangas@gmail.com, 66948@debbugs.gnu.org, joaotavora@gmail.com > Date: Sat, 11 Nov 2023 13:01:27 +0100 > > >> Basically, a single character often has many completion candidates, and > >> most of them are not what you want. After three characters, the preview > >> is much more likely to show you a useful candidate. So you can think of > >> this option as an adjustable threshold for how much information we > >> require the completion backend to have before we consider its > >> suggestions any good. I'm open to changing the default value, but I > >> think that three characters is a very sane default. > > > > The advantage of 1 character is that we don't need this defcustom at > > all, and it is basically up to the user when to type TAB, or even look > > at the preview. > > One character is not the same as removing this `defcustom`. Without > this `defcustom`, i.e. without checking the length of the symbol at > point, we would try to show the preview even after the user types a > bunch of space and there is nothing useful to complete at point at all. > > > Alternatively, we could have a defcustom based on a different design: > > show preview only when there are fewer than N completion candidates, > > with N being customizable. That would make much more sense, IMO, > > since it replaces a largely "mechanical" limitation with one that is > > meaningful for users. > > That would indeed be a nice solution, but it has a fatal flaw, sadly. > Computing the set of completion candidates is a costly operation, > especially with backends such as LSP, so we don't want to do that after > each command. This seems to be an argument in favor of the timer-based design I suggested. But if you aren't inclined to do that, I guess we can install the feature as it is designed now. > >> > The underline face is not universally supported, so this defface > >> > should have fallbacks. > >> > >> The `underline` face in faces.el has `:underline t` in the fallback > >> clause too, so I figured that should be alright, no? > > > > If you are okay with seeing no effect at all when the terminal doesn't > > support the underline attribute, then yes. But I thought we want this > > face to stand out no matter what, don't we? > > That's okay IMO, the underline just differentiates between when you have > a single candidate and when you have multiple candidates. I don't think > that's that crucial, but if you can suggest a universally supported > fallback I'd be glad to add it, of course. How about some color (foreground or background)?