From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Newsgroups: gmane.emacs.bugs Subject: bug#72705: 31.0.50; eglot--dumb-tryc Filters out too much Date: Sun, 25 Aug 2024 10:53:10 +0100 Message-ID: <874j79vshl.fsf@gmail.com> References: <54dacc71-4395-431f-abc4-c60dc070cb03@gutov.dev> <0ff5f767-be87-4d64-964c-0a20fa776acf@gutov.dev> <0632f40f-98fd-4388-aba0-629a32d415eb@gutov.dev> <87ed6hyg1o.fsf@gmail.com> <06cfce49-33ff-41a2-b999-469c4a0009c0@gutov.dev> <87o75kwl2i.fsf@gmail.com> <87h6bbwn9l.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34747"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 72705@debbugs.gnu.org To: Dmitry Gutov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 25 11:53:38 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 1si9wH-0008s9-V8 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Aug 2024 11:53:38 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1si9vv-0006ai-Fv; Sun, 25 Aug 2024 05:53:15 -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 1si9vt-0006aI-Ie for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2024 05:53:13 -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 1si9vt-00050T-9d for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2024 05:53:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=qZGQ7RADD/yKZzW1eCK+e9S/FZtvb3D4Y88M7kp3lSI=; b=DW+/pISIzf1+c6WTWOcN1npZZDqPgjcgYni7Vi2KWHDN7Rz2q8iWnp+DAF+pq44V+vk97PWwJEFfAjK8hCZmrIWbqJEemBD/DZ5o5hhJv43XKg2lk2HVjBhxuKKI6EygkdtICvBM2tDrjODz5RuLWe/LPNauNfRPdSAGapChNbKFkpT5XeeNDle9SvUTvWEhgUzep2Tjlhma+76eYZfF1+GEpAuIyv+J3L+zSzAHJvsXvAyWBjDqOXW1XmZEPetwHTLvFsF9rffXfCdrUHb3lTdShhGIl3qK8PeJBgTS1r5B0MSMXUW8pbbyooO8zBkn3CbOCtiwKvprrGIFxDgdOA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1si9wg-0008Vt-Gi for bug-gnu-emacs@gnu.org; Sun, 25 Aug 2024 05:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?Jo=C3=A3o_?= =?UTF-8?Q?T=C3=A1vora?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Aug 2024 09:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72705 X-GNU-PR-Package: emacs Original-Received: via spool by 72705-submit@debbugs.gnu.org id=B72705.172457962532688 (code B ref 72705); Sun, 25 Aug 2024 09:54:02 +0000 Original-Received: (at 72705) by debbugs.gnu.org; 25 Aug 2024 09:53:45 +0000 Original-Received: from localhost ([127.0.0.1]:42260 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1si9wO-0008VA-LM for submit@debbugs.gnu.org; Sun, 25 Aug 2024 05:53:45 -0400 Original-Received: from mail-wm1-f42.google.com ([209.85.128.42]:60600) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1si9wL-0008Uu-P1 for 72705@debbugs.gnu.org; Sun, 25 Aug 2024 05:53:43 -0400 Original-Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-42ab880b73eso29307705e9.0 for <72705@debbugs.gnu.org>; Sun, 25 Aug 2024 02:52:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1724579506; x=1725184306; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qZGQ7RADD/yKZzW1eCK+e9S/FZtvb3D4Y88M7kp3lSI=; b=V8jpXS87nis9PnSw9q+X6FfcutJNGpCSP0WMqNHP8WmV9xnWwuZ5h4Pl3U6jMO5OII AwJUcWNG66VtYLbd2+PjcAaeCI10hrwlPsorF5uo16sx1/gRd30P88OEu0T6j2e37WX4 vdnvnTe/UqHd3Bzh8/YLPmcn14BiSUVmhELXkGyBi6bHuojwVtd81W2olGwjIj7uxKTy bqcdhmHSBs4QotYiQR4e5Db3Yu8x8Jwwv8Dno+ehrzUrbYDZgNgxPHc+/g/PzldkIMTd ONcFiJwQ9wqh07PaetI9hLE82aJMOe2ZgIwYD4AxhE7y63rmiqHWYHgYGk9tm4g1/JBm zG9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724579506; x=1725184306; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=qZGQ7RADD/yKZzW1eCK+e9S/FZtvb3D4Y88M7kp3lSI=; b=XdyFgBcbi3f7W84a7Vq/u6dToIJiUNeDdToRXITTXNMAT0Y9UJsyo4VAm4WOTfwU7v uqr7C3ex/KYXuO+aP93v7+PGet+vsFyBXXMswVnuBN10r40fGRvxq26cd63uDKpP5ojH bwi6geNzlb0YSoMel+xGnXgIdrek/q5G4OA/IEi5ojAx677vsBQjcuKms3TEikb8n3Yk g6gDYI6JwbBj3DRaLyDROY7j3soiy2uE1jisf+1e8+b0f1/gS80sv47UgxKjjTOee7yp DDTvUHWrZqL6z0qoI0ODCgXmD4dv5lMK5V28iEFeTlpgS4HmdD/mk6a0rOSgIUEU+s+3 PKCQ== X-Gm-Message-State: AOJu0YwZqhlpbHidwfn874+GTf4wyOHd7zuW4b6y4fR32dJ5wUH1e/EN 3Rckqq3z8Jkcvw4TZHqJ3CbeteKUCm/inhpOYyxBKu4gYZkdXBsFJq2X4A== X-Google-Smtp-Source: AGHT+IF061D9k8zz9eBTPHZb59TZ4EmOWRg6plloMvwTPtvUHF+ztkE0aJ1rb0nqK6tiHYQ7Z7t2nQ== X-Received: by 2002:a05:600c:1c1d:b0:426:67dd:e9e9 with SMTP id 5b1f17b1804b1-42acc8d36edmr50271295e9.3.1724579505363; Sun, 25 Aug 2024 02:51:45 -0700 (PDT) Original-Received: from krug (87-196-102-145.net.novis.pt. [87.196.102.145]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42ac514e071sm119181585e9.4.2024.08.25.02.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Aug 2024 02:51:44 -0700 (PDT) In-Reply-To: (Dmitry Gutov's message of "Sun, 25 Aug 2024 05:49:59 +0300") 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:290733 Archived-At: Dmitry Gutov writes: > On 23/08/2024 13:23, Jo=C3=A3o T=C3=A1vora wrote: > > I see what you're saying, but insofar that current completion is > mostly working out well, adding the special logic for parens would > improve a lot of cases, and keep others the same degree of broken (the > email-sending ones, for sure). So it might be worth a try. No, it's not. It's the kind of complexity Eglot isn't after. It's a losing game with the growing number of servers who aren't bound by these rules in any way. > Anyway, stopping any partial completion (at first I didn't understand > that you meant a more general notion that the partial-completion > c-style) should be similarly easy to what the current patch does. You > would just drop the second clause in eglot--dumb-tryc, I think. Or > maybe both the first and the second. If it's easy, then we should definitely do it. >> The other "fix" is to lobby with the LSP spec people, but they're very >> VSCode-inclined. From what I've seen, even other editors which are more >> popular than Emacs have very little sway there. > > It seems we only have our hacks to help. They got pretty advanced, > though. Yes, but they always lose. >>> Yeah, it'd be great to have C-M-i stop before the paren. >> No, it wouldn't. It'd fix this particular case, but it could break >> in >> some other future version of LSP where the LSP label isn't a prefix of >> the thing that selecting that label would insert. > > Quite possibly, yes. Though reverting to the simpler behavior at that > point would just require a 3-4 lines diff, as discussed. That's more complexity. And you can't easily know _if_ the LSP label is or isn't a prefix of the thing selecting the completion would insert without effectively simulating the completion (which is frequently). > Alas, this check does not succeed: > > (should (get-buffer-window "*Completions")) Window management code, likely. > This works: > > (when (buffer-live-p "*Completions*") > (kill-buffer "*Completions*")) > (completion-at-point) > (should (looking-back "foo")) > (should (looking-at "123")) > (should (get-buffer "*Completions*")) > > Is that better? It's half-decent, I think. Please use that. >>> Okay, I am seeing a difference too: C-M-i does eat the suffix in the >>> Rust example (the "1234"). But completion with Company does not :-/ >> I can't even get Company to appear in those situations. > You might have an older version installed? Maybe. > 1) Completions are not filtered by suffix, ever. > 2) Completing count_ones() does not delete the suffix ("1234" > remains). Interesting, I thought deleting the 1234 was part of the edit, but the user of that bug report was after some Emacs specific behaviour. Anyway, I don't think the test is too brittle, and I think I'd like to know anyway if something about that breaks anyway. Maybe you can just add a comment saying ";; this test might be a bit too brittle, but interesting nonetheless". I think you can commit the patch then. Thanks. Jo=C3=A3o