copilot.el icon indicating copy to clipboard operation
copilot.el copied to clipboard

Out-of-order characters with typescript-mode when electric-indent-mode is activated and an active suggestion is shown

Open timcharper opened this issue 1 year ago • 6 comments

I've managed to reproduce this on a minimal setup, loading only typescript-mode (which activates electric-indent-mode, copilot.el (latest HEAD, 2c1c425).

https://asciinema.org/a/7j1X1KGr85Nl6Vm3VmlZnOS0o

Given the following (bold is typed, non-bold is suggestion, | is cursor):

add|(1, 2)

If I type a '(', and then type a ')', I end up with

add)|(

That is to say, the characters come out-of-order.

Disabling electric-indent-mode in typescript-mode resolves it.

For some reason, the out-of-order behavior doesn't happen with js-mode, even though electric-indent-mode is configured for those modes too. Further investigation required.

timcharper avatar Feb 02 '24 07:02 timcharper

Can you confirm the version of copilot.el you are running?

emil-vdw avatar Feb 02 '24 08:02 emil-vdw

@emil-vdw I'm running commit 2c1c425. According to the package header... "0.0.1" (probably not useful)

Emacs version is 29.1

timcharper avatar Feb 02 '24 08:02 timcharper

I have a functioning work-around.

https://gist.github.com/timcharper/faf25e59fcf1aee876f25a754395e40c

At least this will alleviate suffering to my fellow Emacs wielding typescript devs.

It's a bit horrible since the modification of copilot-completion-map is not buffer-local, so it bleeds to all modes. That could be improved. But, best would be the root issue can be solved.

timcharper avatar Feb 02 '24 08:02 timcharper

Thank you very much @timcharper !!

johnnywalker avatar Feb 09 '24 04:02 johnnywalker

Thank you @timcharper

davidhaley avatar Mar 14 '24 18:03 davidhaley

Thank you @timcharper

aaronyo avatar Apr 25 '24 01:04 aaronyo