Closed bpizzi closed 2 years ago
Try to add some new keybindings in your configurations:
:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
copilot-completion-map
was introduced in the last update, which is bound to the completion overlay. It somewhat doesn't work well with my configuration, but you can have a try.
Another choice is to use M-x describe-key
to find the command bound to TAB in the particular case you described. Then hack that command in a similar way as you did to company-indent-or-complete-common
.
It can be something like:
(define-key global-map [remap indent-for-tab-command] '(lambda ()
(interactive)
(or (copilot-accept-completion)
(indent-for-tab-command))))
You need to replace indent-for-tab-command
with the command you find and replace global-map
with the keymap containing that keybinding.
@zerolfx Thank you, 'copilot-accept-completion
works like a charm!
I don't see any regression, but I'll let you known if I find something down the line.
And thanks again for this plugin!
Had a similar problem when editing a .tsx file on Typescript-TSX mode.
Followed @zerolfx advice to find TAB and replace it. Here is the snippet if someone else happens to stumbles on this:
(define-key global-map [remap +web/indent-or-yas-or-emmet-expand] '(lambda ()
(interactive)
(or (copilot-accept-completion)
(+web/indent-or-yas-or-emmet-expand))))
Hi, I've got this weird behavior on Doom Emacs when editing a
.react.js
file withrjsx-mode
, other modes seems to work just fine:TAB
correctly complete the copilot suggestion, and selecting something in the dropdown and hittingenter
correctly use the code-completion from the dropdown,TAB
trigger another mechanism of code completion related tojsx
I'm using the exact same configuration for Doom Emacs from your readme, with
(javacript +lsp)
enabled inconfig.el
, thelsp
server being used isjsts-ls
. I'm on Archlinux (btw ;)), withemacs 28.1-7
, on the most recent commit from doom emacs right now, and the last commit for rjsx-mode. Looks likerjsx-mode
is based onjs2-mode
, and if I switch temporarily tojs2-mode
then I'm not able to reproduce the bug anymore: hittingTAB
correctly completes both copilot suggestions and lsp code completion, even if the other one is missing (however I loose some nice functionalities regarding code-completion fromrjsx-mode
, such as thisjsx
completion).One way to make sense of this would be that the
jsx
completion fromrjsx-mode
is not triggering completion candidates in a proper emacs dropdown, andcopilot.el
cannot handle this case.I've taken some screenshots to illustrate.
Here, the completion from Copilot is shown, which is expected, but there's no dropdown:
When I hit
TAB
expecting the copilot suggestion to be used, then it's thejsx
completion that is being used:However when there's both copilot suggestions and a dropdown then it's working fine:
If it's of any use, this is my Doom Emacs'
init.el
:Thanks!