unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Platon Pronko <platon7pronko@gmail.com>
To: Ash <ext0l@catgirl.ai>, help-gnu-emacs@gnu.org
Subject: Re: Moving point around empty overlays with 'after-text
Date: Sun, 9 Apr 2023 20:15:31 +0800	[thread overview]
Message-ID: <22b315db-39eb-80b6-1a7c-127f5e703dc1@gmail.com> (raw)
In-Reply-To: <3a1bb709-d00f-49b8-a2c5-d0ac5b6a82c4@app.fastmail.com>

On 2023-04-09 07:06, Ash wrote:
> Yeah, that's my message, hence why I was asking if I was missing something :)
> 
> In some cases it makes sense to put the cursor after the overlay; for example, when invoking a function, the overlay can look like
> 
> some_function({argument_name: }some_value)
> 
> in which case you'd expect to be able to put the cursor after the overlay (to edit the value) and before (to add another argument to the list). Both cursor positions would correspond to the same location, but you're doing something different semantically. So I would expect to be able to type 'another_value, ' before the overlay and 'foo' after and get
> 
> some_function(another_value, {argument_name: }foosome_value)
> 
> and not
> 
> some_function({argument_name: }another_value, foosome_value)
> 
> In practice, I think for the existing overlays in rust-analyzer's inlay hints there's a 'preferred' cursor position (start for type annotations, end for param name annotations) where the user will want it 80% of the time, so it could set things up based on that. Might also investigate the nasty solution and see how clean I can get it and see if it's expensive CPU-wise.
> 

I looked at what other IDE is doing (IDEA in my case). They indeed allow the cursor to be positioned both before and after the inlay, with added text appearing exactly as you described.

I still think that doing this hack with "detect if the cursor moved exactly one position forward, tweak overlay, move it back" is horrible. It feels like it might be much better if this was handled at much lower level, not at the level of lsp-mode.

-- 
Best regards,
Platon Pronko
PGP 2A62D77A7A2CB94E




  reply	other threads:[~2023-04-09 12:15 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-08  5:46 Moving point around empty overlays with 'after-text Ash
2023-04-08 10:06 ` Eli Zaretskii
2023-04-08 10:14   ` Platon Pronko
2023-04-08 10:10 ` Platon Pronko
2023-04-08 23:06   ` Ash
2023-04-09 12:15     ` Platon Pronko [this message]
2023-04-09 14:49       ` tomas
2023-04-10  1:52         ` Platon Pronko
2023-04-10  4:56           ` Eli Zaretskii
2023-04-10  5:22             ` Platon Pronko
2023-04-10  9:56               ` Yuri Khan
2023-04-11  8:49                 ` Platon Pronko
2023-04-11  9:41                   ` Yuri Khan
2023-04-10  5:35           ` tomas
2023-04-10  5:48             ` Platon Pronko
2023-04-09 20:44       ` Ash
2023-04-10  2:00         ` Platon Pronko
2023-04-10  3:21           ` Ash
2023-04-10  3:31             ` Platon Pronko
2023-04-11  0:22               ` Ash
2023-04-10  5:09             ` Eli Zaretskii
2023-04-10  5:37               ` Platon Pronko
2023-04-10  8:03                 ` Eli Zaretskii
2023-04-10  9:05                   ` Platon Pronko
2023-04-10  5:01           ` Eli Zaretskii
2023-04-10  5:26             ` Platon Pronko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=22b315db-39eb-80b6-1a7c-127f5e703dc1@gmail.com \
    --to=platon7pronko@gmail.com \
    --cc=ext0l@catgirl.ai \
    --cc=help-gnu-emacs@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).