Exafunction / codeium.el

Free, ultrafast Copilot alternative for Emacs
https://www.codeium.com
MIT License
412 stars 13 forks source link

tab-width messes up python indentation #23

Closed dangom closed 1 year ago

dangom commented 1 year ago

Unless a user sets tab-width to 4, codeium autocomplete will mess up the indentation. Not sure what the optimal fix is, whether dynamically binding tab-width to 4 when on python mode, or using some other mechanism to get the indentation right.

fortenforge commented 1 year ago

If you want to set tab-width to 4 in python-mode you should be able to do so via

(add-hook 'python-mode-hook (lambda () (setq tab-width 4)))

however, I don't think codeium.el requires you to use 4 specifically, just that you do explicitly set tab-width to whatever you want to use. For example, I have the following in my init.el file:

(add-hook 'python-mode-hook (lambda () (setq tab-width 2)))
(add-hook 'python-mode-hook '(lambda () (setq python-indent 2)))

and this correctly gets both emacs and codeium to use 2 spaces for tabs everywhere. Changing both of these 2's to a 4 also behaves correctly.

dangom commented 1 year ago

I just changed it globally. Doesn't seem to be causing any issues. I had it set to the default value of 8, and had never changed it.