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.bugs Subject: bug#72705: 31.0.50; eglot--dumb-tryc Filters out too much Date: Mon, 19 Aug 2024 04:51:15 +0300 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------Ne087yXGQwAA5wHdhm38xk7i" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6653"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird Cc: joaotavora@gmail.com To: 72705@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Aug 19 03:53:05 2024 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 1sfrZw-0001XB-OU for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 19 Aug 2024 03:53:05 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sfrZL-0002BG-LL; Sun, 18 Aug 2024 21:52:27 -0400 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 1sfrZI-0002B0-2C for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 21:52:24 -0400 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 1sfrZG-00013g-MK for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 21:52:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=From:MIME-Version:Date:To:Subject; bh=9CjpP5YwIhKVaPmxIDWwezBF1BqQnzvdcIhEJIDuO38=; b=Tu1kcnSZ00dMiCfIMnUEb+7UHLf8m4hU3q4wtZFcFUdXoPizHCDPfYIsI26IpwqwerPE+epBTyai7k8EBEL4DyTbeS8Ie7NNW56pbBEIk2CiFx1WFO4dk2hgAixAc80jl5S0wKAYln7yUR/bDoRskut+9PzZ/hok95kHRd2dYy6OtkOTpvCjfS2QnXoB/bUOWsJQlzvv9q7y6Zk+Ma2/6Fhy7HPy8FlTGWoZBtFfCrZOsaZhYvyhVlSf0iFBPe/9Whrle8a+OvZ6RUvlS/bsCSD27SwmHNT02Y0Cq9tSZQLonCvstBS8LyiteJdHbwGrpY77ooZ4w+ISCifBXUn5JA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sfrZu-00022M-N0; Sun, 18 Aug 2024 21:53:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: joaotavora@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Mon, 19 Aug 2024 01:53:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 72705 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: joaotavora@gmail.com Original-Received: via spool by submit@debbugs.gnu.org id=B.17240323277747 (code B ref -1); Mon, 19 Aug 2024 01:53:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 19 Aug 2024 01:52:07 +0000 Original-Received: from localhost ([127.0.0.1]:57146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfrZ0-00020s-Lb for submit@debbugs.gnu.org; Sun, 18 Aug 2024 21:52:07 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:35486) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sfrYx-00020j-UZ for submit@debbugs.gnu.org; Sun, 18 Aug 2024 21:52:04 -0400 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 1sfrYI-00025y-FJ for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 21:51:22 -0400 Original-Received: from fout7-smtp.messagingengine.com ([103.168.172.150]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sfrYG-0000ss-EW for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 21:51:22 -0400 Original-Received: from phl-compute-06.internal (phl-compute-06.nyi.internal [10.202.2.46]) by mailfout.nyi.internal (Postfix) with ESMTP id 6D0AD138D5D4 for ; Sun, 18 Aug 2024 21:51:19 -0400 (EDT) Original-Received: from phl-mailfrontend-01 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Sun, 18 Aug 2024 21:51:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gutov.dev; h=cc :content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm2; t=1724032279; x=1724118679; bh=9CjpP5YwIhKVaPmxIDWwezBF1BqQnzvd cIhEJIDuO38=; b=mPGlcpzLPXqRaIkDS74khEUOifXmyS+SH+tvFVcEOOxrlA0P zUqJi4wNd5Bo9a9KHSxmvz6gjwzthS1qkLYyguIlFMOvcvOldm2yQenzxQU0vRvy zlTfTGO8iyekQUW/CY9FXRJVLuIq63vFVmGqmgDm1B/NerDIaPpgiWHipdmetn// WcgJsIS7G3ckDhp7k9PuE4j4gmnhShGKol+Vk6E9QStAtuBsFNtrAYpVvp02aYaw 2sW1p4RYVC66yj2CqbUzTTtBoPWaP5wIHDkEGwwmNcddEHNrjGOlqZEOVyFf0ZPp s6fVdPchQbNKWsvCANM60nxga6iArgWXdB7yIA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t= 1724032279; x=1724118679; bh=9CjpP5YwIhKVaPmxIDWwezBF1BqQnzvdcIh EJIDuO38=; b=Q6DTAkxgTXouKuh6HPpgJKvD9MZJC2Qa28KdNMNIiUZ3vlcoHiz 1myiUBbRk9hYRmbDmBlaYMkyp2oeMbqJLskiclAHq6BXlC1uM2Y4OYLuGHNxXVG1 8rHn/f6Qr37CQQJgaiZBKtiRoVE+zng/xJX+nF6WUqpmaMdyz1Qfdh54gmG0FAOy lQnK2UI00pLWgBzEm5a1+g9e0THMqvXDSHMxLEw3hr2hL8JZCUQ/FCZ5NApD6+UD qFubJYaZwmGm3/PXY1acrdaHIiE/X6WuS56Fq+Wra+wGbrjSwZ8ZBohyvWZ+vH6k fE8cv/FCLcAQdCz0rJZ0aoINjx23bx7dX6Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeeftddruddufedgheduucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdggtfgfnhhsuhgsshgtrhhisggvpdfu rfetoffkrfgpnffqhgenuceurghilhhouhhtmecufedttdenucenucfjughrpegtkfffgg gfvffuhfesmhdtreertddvjeenucfhrhhomhepffhmihhtrhihucfiuhhtohhvuceoughm ihhtrhihsehguhhtohhvrdguvghvqeenucggtffrrghtthgvrhhnpeefkeevleeuieegte elheefieeggfffgedtleelhfdvuddtkefgveelieeutdffheenucffohhmrghinhepghhi thhhuhgsrdgtohhmnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilh hfrhhomhepughmihhtrhihsehguhhtohhvrdguvghvpdhnsggprhgtphhtthhopedupdhm ohguvgepshhmthhpohhuthdprhgtphhtthhopegsuhhgqdhgnhhuqdgvmhgrtghssehgnh hurdhorhhg X-ME-Proxy: Feedback-ID: i0e71465a:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Sun, 18 Aug 2024 21:51:18 -0400 (EDT) Content-Language: en-US Received-SPF: pass client-ip=103.168.172.150; envelope-from=dmitry@gutov.dev; helo=fout7-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=-0.01, RCVD_IN_MSPIKE_WL=-0.01, 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: 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:290365 Archived-At: This is a multi-part message in MIME format. --------------Ne087yXGQwAA5wHdhm38xk7i Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Debbugs-Cc: joaotavora@gmail.com 1. Have a project with just one file, test.go (attached). 2. Visit it, enable go-ts-mode, call 'M-x eglot'. 3. Move point right after "math.As", press C-M-i. 4. Code will get completed to "math.Asin" This is a problem because "math.As" has more completions (one can look at them by pressing TAB after "math.A") - such as "Acos", "Acosh" and "Abs" - in other words, "fuzzy" matches. Expected behavior: 1. When input is "math.As" - keep the string as-is. 2. When input is "math.Asi" - complete to "math.Asin". This problem seems older than 65ea742ed5ec (the change that introduced eglot--dumb-tryc itself, bug#68699), but it doesn't reproduce with Eglot from Emacs 29. Branches emacs-30 and master are affected. There is also another issue there: when there are no completions at all, this style still has completion-try-completion return a non-nil value (the last line of the implementation). Both of these issues is something I came across when working on closer 'try-completion' integration for company-mode (https://github.com/company-mode/company-mode/pull/1488) and testing out the new code with Eglot. Not sure what's the best fix, but the patch below seems to address both problems in my limited testing. WDYT? diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el index 353877f60c2..e8823a9d2f0 100644 --- a/lisp/progmodes/eglot.el +++ b/lisp/progmodes/eglot.el @@ -3142,8 +3142,14 @@ eglot--dumb-allc (defun eglot--dumb-tryc (pat table pred point) (let ((probe (funcall table pat pred nil))) (cond ((eq probe t) t) - (probe (cons probe (length probe))) - (t (cons pat point))))) + ((and probe + (cl-every + (lambda (s) (string-prefix-p probe s completion-ignore-case)) + (funcall table pat pred t))) + (cons probe (length probe))) + (t + (and (funcall table pat pred t) + (cons pat point)))))) (add-to-list 'completion-category-defaults '(eglot-capf (styles eglot--dumb-flex))) (add-to-list 'completion-styles-alist '(eglot--dumb-flex eglot--dumb-tryc eglot--dumb-allc)) --------------Ne087yXGQwAA5wHdhm38xk7i Content-Type: text/x-go; charset=UTF-8; name="test.go" Content-Disposition: attachment; filename="test.go" Content-Transfer-Encoding: base64 cGFja2FnZSB0ZXN0CgppbXBvcnQgIm1hdGgiCgpmdW5jIG1haW4oKSB7CgltYXRoLkFzCn0K --------------Ne087yXGQwAA5wHdhm38xk7i--