Closed bersace closed 5 months ago
First, often, a warning about infer-indentation pops. Even in file already indented. Actually, Go indentation is pretty standard to 4 spaces.
Indentation is not inferred based on what's in the file but based on the major mode. Disable the warning (copilot-indent-offset-warning-disable
) or add a value for the major mode you are using (copilot-indentation-alist
).
Second, some times, the TAB completion stops working. I didn't found any relevant message in Messages. copilot shows a suggestion, but typing TAB just write a plain TAB char instead of accepting the suggestion. Do you have a clue ?
Could you try the solution for Doom emacs as described in the readme?
Hello @emil-vdw , thanks for your quick answer !
Indentation is not inferred based on what's in the file but based on the major mode. Disable the warning (
copilot-indent-offset-warning-disable
) or add a value for the major mode you are using (copilot-indentation-alist
).
I don't master enought ELisp. (add-to-list 'copilot-indentation-alist '(go-mode 4))
triggers Error running timer ‘copilot--post-command-debounce’: (wrong-type-argument sequencep 4) [5 times]. I disabled warning for now.
Second, some times, the TAB completion stops working. I didn't found any relevant message in Messages. copilot shows a suggestion, but typing TAB just write a plain TAB char instead of accepting the suggestion. Do you have a clue ?
Could you try the solution for Doom emacs as described in the readme?
I missed this, thanks !
Also, C-TAB did workaround this conflict. It's seems to work properly with this workaround.
I'm closing. Feel free to suggest how to customize copilot-indentation-alist or point me a doc I mised.
You're awesome.
You are welcome!
When in doubt you can always use M-x customize-group RET copilot RET
but this should work:
(add-to-list
'copilot-indentation-alist
'(go-mode 4))
You are welcome! When in doubt you can always use
M-x customize-group RET copilot RET
but this should work:(add-to-list 'copilot-indentation-alist '(go-mode 4))
Ok, the invocation was right, but not at the right place. Thanks for the confirmation.
After setting this for org-mode
, I get:
Error running timer ‘copilot--post-command-debounce’: (wrong-type-argument symbolp '2) [2 times]
And also basically all Go code actually uses tabs, and not 4 spaces, that's what gofmt
will do to your code btw.
First, often, a warning about infer-indentation pops. Even in file already indented. Actually, Go indentation is pretty standard to 4 spaces.
Indentation is not inferred based on what's in the file but based on the major mode. Disable the warning (
copilot-indent-offset-warning-disable
) or add a value for the major mode you are using (copilot-indentation-alist
).Second, some times, the TAB completion stops working. I didn't found any relevant message in Messages. copilot shows a suggestion, but typing TAB just write a plain TAB char instead of accepting the suggestion. Do you have a clue ?
Could you try the solution for Doom emacs as described in the readme?
The issue with this workaround, is that it break TAB or any other feature like indentation on any buffer with copilot enabled. How to determine whether a copilot suggestion is proposed ?
Something like:
(after! (evil copilot)
;; Define the custom function that either accepts the completion or does the default behavior
(defun my/copilot-tab-or-default ()
(interactive)
(if (and (bound-and-true-p copilot-mode)
(copilot-has-suggestion-on-screen) ; HERE !!
;; Add any other conditions to check for active copilot suggestions if necessary
)
(copilot-accept-completion)
(evil-insert 1))) ; Default action to insert a tab. Adjust as needed.
;; Bind the custom function to <tab> in Evil's insert state
(evil-define-key 'insert 'global (kbd "<tab>") 'my/copilot-tab-or-default))
Hi,
Thanks for maintaining copilot.el, it's very useful.
I'm using copilot for Golang within Doom Emacs. I have two issues:
First, often, a warning about infer-indentation pops. Even in file already indented. Actually, Go indentation is pretty standard to 4 spaces.
How to handle this ?
Second, some times, the TAB completion stops working. I didn't found any relevant message in Messages. copilot shows a suggestion, but typing TAB just write a plain TAB char instead of accepting the suggestion. Do you have a clue ?
Here is my configuration:
Running as daemon, with pure-GTK on Wayland, Linux.
Regards, Étienne