haskell / haskell-mode

Emacs mode for Haskell
http://haskell.github.io/haskell-mode/
GNU General Public License v3.0
1.33k stars 344 forks source link

haskell mode doesn't use completion-at-point for tab #1843

Closed Esnos33 closed 6 months ago

Esnos33 commented 6 months ago

Hi, I want to use <tab> for auto completion. I have set (tab-always-indent 'complete) and in python-mode or elisp-mode <tab> is set to

completion-at-point is an interactive native-compiled Lisp function in
‘minibuffer.el’.

It is bound to C-M-i and <tab>.

But when I use <tab> in haskell-mode, its set to

TAB (translated from <tab>) runs the command indent-for-tab-command
(found in global-map), which is an interactive native-compiled Lisp
function in ‘indent.el’.

It is bound to TAB.

Do you know why haskell-mode doesn't use completion-at-point ?

purcell commented 6 months ago

When tab-always-indent is 'complete, then completion is only triggered if the indentation did not change.

Multiple indentation points are possible with Haskell — its syntax is indentation-defined, like that of Python. So in both major modes, TAB always changes the indentation, and never triggers completion. In other words, you can't have TAB magically do two things in such language modes.

The solution is to directly trigger completion, e.g. with C-M-i, or use something like corfu and enable auto-triggering of completion.