Warning (copilot): copilot--infer-indentation-offset found no mode-specific indentation offset.
This warning is always reported in go-mode recently. How to set the indentation-offset or ignore the warning? I'm using doom emacs
You want something like this:
(use-package! copilot
:hook (prog-mode . copilot-mode)
:bind (:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)
("C-n" . 'copilot-next-completion)
("C-p" . 'copilot-previous-completion))
:config
(add-to-list 'copilot-indentation-alist '(prog-mode . 2))
(add-to-list 'copilot-indentation-alist '(org-mode . 2))
(add-to-list 'copilot-indentation-alist '(text-mode . 2))
(add-to-list 'copilot-indentation-alist '(closure-mode . 2))
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode . 2)))
Just tune your indentation settings so they are not 2 spaces. I wish copilot could use tab-width by default if it cannot found mode specific indentation offset.
But actually, what you want is not dots before the indentation size:
(use-package! copilot
:hook (prog-mode . copilot-mode)
:bind (:map copilot-completion-map
("<tab>" . 'copilot-accept-completion)
("TAB" . 'copilot-accept-completion)
("C-TAB" . 'copilot-accept-completion-by-word)
("C-<tab>" . 'copilot-accept-completion-by-word)
("C-n" . 'copilot-next-completion)
("C-p" . 'copilot-previous-completion))
:config
(add-to-list 'copilot-indentation-alist '(prog-mode 2))
(add-to-list 'copilot-indentation-alist '(org-mode 2))
(add-to-list 'copilot-indentation-alist '(text-mode 2))
(add-to-list 'copilot-indentation-alist '(closure-mode 2))
(add-to-list 'copilot-indentation-alist '(emacs-lisp-mode 2)))
I just noticed this works, while with dots - doesn't
Is there a way to somehow inherit the indentation by default without having to specify it for every mode?
How to config this for spacemacs? I encounter the same issue in orgmode.
@bebound In case you still have that issue, in spacemacs you can configure it like this
;; config example from README.md
(with-eval-after-load 'copilot
(define-key copilot-completion-map (kbd "<tab>") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "TAB") 'copilot-accept-completion)
(define-key copilot-completion-map (kbd "C-TAB") 'copilot-accept-completion-by-word)
(define-key copilot-completion-map (kbd "C-<tab>") 'copilot-accept-completion-by-word)
;; add it here
(add-to-list 'copilot-indentation-alist '(org-mode 2)))
I just decided to ignore it
(use-package copilot
:vc (:url "https://github.com/copilot-emacs/copilot.el"
:rev :newest
:branch "main")
:init
(setq copilot-indent-offset-warning-disable t)
:bind (:map copilot-completion-map
("<tab>" . copilot-accept-completion))
:hook (prog-mode . copilot-mode))