feat(completion): add support for GitHub Copilot via copilot.el

I opted for accepting copilot completions using C-<tab> /
<backtab> (shift+tab) instead of regular tab, as it was often getting in
the way of yasnippet and lsp completion suggestions. This allows a more
explicit acceptance of Copilot suggestions.
This commit is contained in:
2022-04-28 12:04:22 +01:00
parent 911bdb7182
commit 44c4cc93c1
3 changed files with 31 additions and 1 deletions

View File

@@ -19,8 +19,9 @@
(require 'siren-packages)
;; Completion
(require 'siren-company)
(require 'siren-cape)
(require 'siren-company)
(require 'siren-copilot)
;; Documentation
(require 'siren-dash-at-point)

View File

@@ -9,6 +9,7 @@
(require 'siren-company)
(use-package cape
:after company
:hook
(lsp-completion-mode . siren-cape-capf-lsp-mode-setup)

View File

@@ -0,0 +1,28 @@
;;; siren-copilot.el --- jimeh's Emacs Siren: copilot configuration.
;;; Commentary:
;; Basic configuration for copilot. Auto completion on steroids.
;;; Code:
(use-package copilot
:straight (:host github :repo "zerolfx/copilot.el"
:files ("dist" "copilot.el"))
:hook
(prog-mode . copilot-mode)
:general
("C-<tab>" 'copilot-accept-completion)
("<backtab>" 'copilot-accept-completion)
(:keymaps 'company-active-map
"C-<tab>" 'copilot-accept-completion
"C-TAB" 'copilot-accept-completion
"<backtab>" 'copilot-accept-completion)
:config
(with-eval-after-load 'company
(delq 'company-preview-if-just-one-frontend company-frontends)))
(provide 'siren-copilot)
;;; siren-copilot.el ends here