all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
@ 2024-08-27  1:38 Dmitry Gutov
  2024-08-27 14:36 ` João Távora
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2024-08-27  1:38 UTC (permalink / raw)
  To: 72824; +Cc: joaotavora

X-Debbugs-Cc: joaotavora@gmail.com

1. Server gopls, for example.
2. completion-ignore-case=nil, its default value.
3. Input "clCe" and completions for it like

   clockCenterX
   clockCenterY

Completions are case-sensitive, but completions' highlighting works as 
if it's insensitive - highlights are on "cl", second "c" and "e", 
whereas the capital "C" is not highlighted.

This fixes it for me:

diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
index 844fc634be9..acc197754db 100644
--- a/lisp/progmodes/eglot.el
+++ b/lisp/progmodes/eglot.el
@@ -3260,7 +3260,7 @@ eglot-completion-at-point
             (try-completion pattern (funcall proxies)))
            ((eq action t)                                 ; all-completions
             (let ((comps (funcall proxies)))
-             (dolist (c comps) (eglot--dumb-flex pattern c t))
+             (dolist (c comps) (eglot--dumb-flex pattern c 
completion-ignore-case))
               (all-completions
                ""
                comps






^ permalink raw reply related	[flat|nested] 7+ messages in thread

* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
  2024-08-27  1:38 bug#72824: Eglot highlights matches incorrectly wrt case sensitivity Dmitry Gutov
@ 2024-08-27 14:36 ` João Távora
  2024-08-27 14:38   ` João Távora
  2024-08-27 23:23   ` Dmitry Gutov
  0 siblings, 2 replies; 7+ messages in thread
From: João Távora @ 2024-08-27 14:36 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 72824

I think the fix makes sense.  Please push it to Emacs 30, and thanks
in advance.

If you can please use this format for the commit message subject,
which is my more or less usual practice.

Eglot: fix the frobnication (bug#12345)

* lisp/progmodes/eglot.el (eglot-foo): pass foo to eglot-bar.

On Tue, Aug 27, 2024 at 2:41 AM Dmitry Gutov <dmitry@gutov.dev> wrote:
>
> X-Debbugs-Cc: joaotavora@gmail.com
>
> 1. Server gopls, for example.
> 2. completion-ignore-case=nil, its default value.
> 3. Input "clCe" and completions for it like
>
>    clockCenterX
>    clockCenterY
>
> Completions are case-sensitive, but completions' highlighting works as
> if it's insensitive - highlights are on "cl", second "c" and "e",
> whereas the capital "C" is not highlighted.
>
> This fixes it for me:
>
> diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> index 844fc634be9..acc197754db 100644
> --- a/lisp/progmodes/eglot.el
> +++ b/lisp/progmodes/eglot.el
> @@ -3260,7 +3260,7 @@ eglot-completion-at-point
>              (try-completion pattern (funcall proxies)))
>             ((eq action t)                                 ; all-completions
>              (let ((comps (funcall proxies)))
> -             (dolist (c comps) (eglot--dumb-flex pattern c t))
> +             (dolist (c comps) (eglot--dumb-flex pattern c
> completion-ignore-case))
>                (all-completions
>                 ""
>                 comps
>
>
>


-- 
João Távora





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
  2024-08-27 14:36 ` João Távora
@ 2024-08-27 14:38   ` João Távora
  2024-08-27 22:57     ` Dmitry Gutov
  2024-08-27 23:23   ` Dmitry Gutov
  1 sibling, 1 reply; 7+ messages in thread
From: João Távora @ 2024-08-27 14:38 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 72824

Also, btw, completion highlighting is naturally borked too.  There is
no guarantee that that naive flex algorithm is what the server used
to select those completions.

On Tue, Aug 27, 2024 at 3:36 PM João Távora <joaotavora@gmail.com> wrote:
>
> I think the fix makes sense.  Please push it to Emacs 30, and thanks
> in advance.
>
> If you can please use this format for the commit message subject,
> which is my more or less usual practice.
>
> Eglot: fix the frobnication (bug#12345)
>
> * lisp/progmodes/eglot.el (eglot-foo): pass foo to eglot-bar.
>
> On Tue, Aug 27, 2024 at 2:41 AM Dmitry Gutov <dmitry@gutov.dev> wrote:
> >
> > X-Debbugs-Cc: joaotavora@gmail.com
> >
> > 1. Server gopls, for example.
> > 2. completion-ignore-case=nil, its default value.
> > 3. Input "clCe" and completions for it like
> >
> >    clockCenterX
> >    clockCenterY
> >
> > Completions are case-sensitive, but completions' highlighting works as
> > if it's insensitive - highlights are on "cl", second "c" and "e",
> > whereas the capital "C" is not highlighted.
> >
> > This fixes it for me:
> >
> > diff --git a/lisp/progmodes/eglot.el b/lisp/progmodes/eglot.el
> > index 844fc634be9..acc197754db 100644
> > --- a/lisp/progmodes/eglot.el
> > +++ b/lisp/progmodes/eglot.el
> > @@ -3260,7 +3260,7 @@ eglot-completion-at-point
> >              (try-completion pattern (funcall proxies)))
> >             ((eq action t)                                 ; all-completions
> >              (let ((comps (funcall proxies)))
> > -             (dolist (c comps) (eglot--dumb-flex pattern c t))
> > +             (dolist (c comps) (eglot--dumb-flex pattern c
> > completion-ignore-case))
> >                (all-completions
> >                 ""
> >                 comps
> >
> >
> >
>
>
> --
> João Távora



-- 
João Távora





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
  2024-08-27 14:38   ` João Távora
@ 2024-08-27 22:57     ` Dmitry Gutov
  2024-08-28  9:03       ` João Távora
  0 siblings, 1 reply; 7+ messages in thread
From: Dmitry Gutov @ 2024-08-27 22:57 UTC (permalink / raw)
  To: João Távora; +Cc: 72824

On 27/08/2024 17:38, João Távora wrote:
> Also, btw, completion highlighting is naturally borked too.  There is
> no guarantee that that naive flex algorithm is what the server used
> to select those completions.

True. For example, tn this scenario the server uses case-insensitive 
matching, whereas we (by default) match case-sensitively in the 
completion style.

This change should help eliminate the inconsistency between parts of the 
current completion style, but for the next release we might migrate to a 
more "passthrough" one.

Or not, you know. I've seen users request prefix-only matching instead 
of the fuzzy one provided by the language servers, and I'm sure there 
will be ones who prefer to match case-sensitively only too.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
  2024-08-27 14:36 ` João Távora
  2024-08-27 14:38   ` João Távora
@ 2024-08-27 23:23   ` Dmitry Gutov
  1 sibling, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2024-08-27 23:23 UTC (permalink / raw)
  To: João Távora; +Cc: 72824-done

Version: 30.1

On 27/08/2024 17:36, João Távora wrote:
> I think the fix makes sense.  Please push it to Emacs 30, and thanks
> in advance.
> 
> If you can please use this format for the commit message subject,
> which is my more or less usual practice.
> 
> Eglot: fix the frobnication (bug#12345)
> 
> * lisp/progmodes/eglot.el (eglot-foo): pass foo to eglot-bar.

No problem. Pushed as

https://git.savannah.gnu.org/cgit/emacs.git/commit/?h=emacs-30&id=9ffa38d3925d70dea704988f68e9e3eca6c7d19c

Thanks, and closing.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
  2024-08-27 22:57     ` Dmitry Gutov
@ 2024-08-28  9:03       ` João Távora
  2024-08-28 21:20         ` Dmitry Gutov
  0 siblings, 1 reply; 7+ messages in thread
From: João Távora @ 2024-08-28  9:03 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: 72824

On Tue, Aug 27, 2024 at 11:57 PM Dmitry Gutov <dmitry@gutov.dev> wrote:

> This change should help eliminate the inconsistency between parts of the
> current completion style, but for the next release we might migrate to a
> more "passthrough" one.

What's that?  Modulo bugs (one of which you've fixed recently) the "dumb"
is the most passthrough one, except for the completion-ignore-case.
Do you want to remove that?  I added it at some user request... seemed
reasonable.  Maybe it's not.

> Or not, you know. I've seen users request prefix-only matching instead
> of the fuzzy one provided by the language servers, and I'm sure there
> will be ones who prefer to match case-sensitively only too.

There is no way to do that.  We don't have a say in what the server
gives us.  If the user types foo and the server ignores "foobar" and
prefers "farfromsober" or std::foobar for whatever scoring reason, then
there's nothing we can do about it.  These users are continuously
misinformed  about LSP inability to follow Emacs's completion styles,
despite my frequent admonishing.

João Távora





^ permalink raw reply	[flat|nested] 7+ messages in thread

* bug#72824: Eglot highlights matches incorrectly wrt case sensitivity
  2024-08-28  9:03       ` João Távora
@ 2024-08-28 21:20         ` Dmitry Gutov
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Gutov @ 2024-08-28 21:20 UTC (permalink / raw)
  To: João Távora; +Cc: 72824

On 28/08/2024 12:03, João Távora wrote:
> On Tue, Aug 27, 2024 at 11:57 PM Dmitry Gutov <dmitry@gutov.dev> wrote:
> 
>> This change should help eliminate the inconsistency between parts of the
>> current completion style, but for the next release we might migrate to a
>> more "passthrough" one.
> 
> What's that?  Modulo bugs (one of which you've fixed recently) the "dumb"
> is the most passthrough one, except for the completion-ignore-case.
> Do you want to remove that?  I added it at some user request... seemed
> reasonable.  Maybe it's not.

"dumb" does some filtering in its all-completion call (the predicate arg 
is used for its return value, AFAICT).

A "passthrough" style would only add highlighting but not filter.

>> Or not, you know. I've seen users request prefix-only matching instead
>> of the fuzzy one provided by the language servers, and I'm sure there
>> will be ones who prefer to match case-sensitively only too.
> 
> There is no way to do that.  We don't have a say in what the server
> gives us.  If the user types foo and the server ignores "foobar" and
> prefers "farfromsober" or std::foobar for whatever scoring reason, then
> there's nothing we can do about it.

I suppose that can happen if total completions exceed the cutoff number.

> These users are continuously
> misinformed  about LSP inability to follow Emacs's completion styles,
> despite my frequent admonishing.
My observation from the sidelines is that people are still happier to 
have such half-measures available, rather than not: 
https://github.com/emacs-lsp/lsp-mode/issues/1653#issuecomment-1125055989

It might be a matter of expectations.





^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2024-08-28 21:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27  1:38 bug#72824: Eglot highlights matches incorrectly wrt case sensitivity Dmitry Gutov
2024-08-27 14:36 ` João Távora
2024-08-27 14:38   ` João Távora
2024-08-27 22:57     ` Dmitry Gutov
2024-08-28  9:03       ` João Távora
2024-08-28 21:20         ` Dmitry Gutov
2024-08-27 23:23   ` Dmitry Gutov

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.