Closed xqliu closed 2 years ago
Is it ok to disable Copilot completion temporarily if there are any candidates from pyim
(or any incomplete input)?
If so, I recommend you customize copilot-disable-predicates
to solve the problem.
Please let me know if the work-around works, and share your configuration if possible.
I am not a pyim
user, but I took a look at pyim
source code.
A possible solution (untested):
(customize-set-variable 'copilot-disable-predicates
'((lambda ()
(and (boundp 'pyim-preview-overlay)
pyim-preview-overlay))))
Actually, it is not a bug. The reason behind the problem is that both pyim
and copilot.el
use overlays to provide inline previews, so they may overwrite each other. And I believe temporarily disabling Copilot when pyim
is using overlay is the best solution.
Thanks dude, have applied the setting and is testing on that, will offer feedback when confirm the issue has been fixed (or not) 👍
Hi, Zerolfx,
Seems the copilot-disable-predicates
is not been applied as per follow screenshot
The current overlay of pyim should be 好的,but seems the predict of copilot is display instead of pyim's candidate
Here are my settings regarding copilot.el
(use-package! editorconfig
:config
(editorconfig-mode 1))
(use-package! copilot
:config
; provide completion when typing
(global-set-key (kbd "TAB") 'copilot-accept-completion)
(global-set-key (kbd "C-c c") 'copilot-accept-completion)
(global-set-key (kbd "C-c n") 'copilot-next-completion)
(global-set-key (kbd "C-c p") 'copilot-previous-completion)
(global-set-key (kbd "C-c w") 'copilot-accept-completion-by-word)
(customize-set-variable 'copilot-enable-predicates '(evil-insert-state-p))
(customize-set-variable 'copilot-disable-predicates
'((lambda ()
(and (boundp 'pyim-preview-overlay)
pyim-preview-overlay))))
(add-hook 'post-command-hook (lambda ()
(copilot-clear-overlay)
(when (evil-insert-state-p)
(copilot-complete))))
)
(provide 'copilot-config)
copilot-disable-predicates
only works in copilot-mode
. See readme for more information.
After trying with pyim
, I found another problem: post-command-hook
is not called when inputting with pyim
, so the copilot overlay can't be cleared timely.
After trying with
pyim
, I found another problem:post-command-hook
is not called when inputting withpyim
, so the copilot overlay can't be cleared timely.
So I use advice to clear copilot overlay when typing in pyim
.
(advice-add 'pyim-self-insert-command :after 'copilot-clear-overlay)
Another possible solution is to disable copilot whenever pyim is enabled:
(customize-set-variable 'copilot-disable-predicates '(pyim-process-input-chinese-p))
Thanks :) I have applied this fix and is testing the behaviour
After trying with
pyim
, I found another problem:post-command-hook
is not called when inputting withpyim
, so the copilot overlay can't be cleared timely.So I use advice to clear copilot overlay when typing in
pyim
.(advice-add 'pyim-self-insert-command :after 'copilot-clear-overlay)
Can treat this bug as fixed.
Thanks for your work :)
As per above image, there should be the first candidate of pyim "删除" displayed on the buffer, but current it displays the copilot suggestion and it hides pyim's candidate, this is not an issue when the candidate is only one or two Chinese character, but if we are inputing a very long sentence, then hide the whole candidate will be an issue.