[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#61726: [PATCH] Eglot: Support positionEncoding capability
From: |
João Távora |
Subject: |
bug#61726: [PATCH] Eglot: Support positionEncoding capability |
Date: |
Sun, 26 Feb 2023 10:38:40 +0000 |
On Sun, Feb 26, 2023 at 5:31 AM Eli Zaretskii <eliz@gnu.org> wrote:
>
> > From: João Távora <joaotavora@gmail.com>
> > Cc: Augusto Stoffel <arstoffel@gmail.com>, 61726@debbugs.gnu.org
> > Date: Sat, 25 Feb 2023 22:13:29 +0000
> >
> > Eli Zaretskii <eliz@gnu.org> writes:
> >
> > >> From: Augusto Stoffel <arstoffel@gmail.com>
> > >> Cc: joaotavora@gmail.com, 61726@debbugs.gnu.org
> > >> Date: Sat, 25 Feb 2023 15:14:06 +0100
> > >>
> > >> On Sat, 25 Feb 2023 at 15:47, Eli Zaretskii wrote:
> > >>
> > >> >> > Can you please humor me and implement eglot-bytewise-column like
> > >> >> > that?
> > >> >>
> > >> >> I would be glad to do that, but unfortunately I'd have to ask your
> > >> >> advice as to how to make the corresponding adaptation of
> > >> >> eglot-move-to-bytewise-column.
> > >> ^^^^^^^
> > >
> > > Sorry. Here:
> > >
> > > (defun eglot-move-to-bytewise-column (column)
> > > "Move to COLUMN as computed using the LSP `utf-8' criterion."
> > > (let* ((bol (line-beginning-position))
> > > (goal-byte (+ (position-bytes bol) column))
> > > (eol (line-end-position)))
> > > (goto-char bol)
> > > (while (and (< (position-bytes (point)) goal-byte)
> > > (< (point) eol))
> > > (if (>= (char-after) #x3fff80) ; raw bytes take 2 bytes in the buffer
> > > (setq goal-byte (1+ goal-byte)))
> > > (forward-char 1))))
> >
> > In eglot-move-to-lsp-abiding-column (the utf-16 sibling of this
> > function) we use a binary search instead of a linear search. I remember
> > measuring a visible improvement. I'm not sure the conditions are
> > exactly the same with this one. Could/should we do the same here?
>
> Fine by me, but optimizing a method that is not yet used sounds a bit
> premature, no? I won't object, though.
There's nothing to optimize there, there's no benefit to binary search.
I think this type of function, which has some utf-8/16 knowledge
directly in them, is the fastest option, much faster than using
encode-coding-region like I was doing before.
João
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, (continued)
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/25
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/26
- bug#61726: [PATCH] Eglot: Support positionEncoding capability,
João Távora <=
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/24
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/24
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Augusto Stoffel, 2023/02/24
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/24
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/24
- bug#61726: [PATCH] Eglot: Support positionEncoding capability, Eli Zaretskii, 2023/02/24
bug#61726: [PATCH] Eglot: Support positionEncoding capability, João Távora, 2023/02/23
bug#61726: [PATCH] Eglot: Support positionEncoding capability, Felician Nemeth, 2023/02/23