How to automatically allow the execution of code action from HLS in emacs?

31 Views Asked by At

When I try to execute any kind of code actions from eglot connected to hls within emacs, I have to accept by hand the execution of the code action in the following popup:

Emacs pops this up for each code action

I find this behaviour to be particularly annoying.

Is there any way to configure emacs so that code actions are accepted and applied by default?

I am using haskell-language-server version 2.2.0.0 and emacs version 29.1.

1

There are 1 best solutions below

0
Y. E. On BEST ANSWER

Disable eglot-confirm-server-initiated-edits. For instance, using the following:

(setopt eglot-confirm-server-initiated-edits nil)

Alternatively, you may find this user option in the Customize UI, by entering M-x customize-group RET <eglot> RET. It is named (naturally) Eglot Confirm Server Initiated Edits.

This user option is mentioned in the Eglot documentation. Namely, see (info "(eglot) Eglot Variables").