copilot-emacs / copilot.el

An unofficial Copilot plugin for Emacs.
MIT License
1.71k stars 122 forks source link

Warning (copilot): copilot--infer-indentation-offset found no mode-specific indentation offset. #312

Open tiny911 opened 1 month ago

tiny911 commented 1 month ago

This warning is always reported in go-mode recently. How to set the indentation-offset or ignore the warning? I'm using doom emacs

iamkarlson commented 3 weeks ago

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.