MrMelankoli · 2022-12-02 13:26
Is it possible to have Eglot use the major mode `indent-level` variable when formatting the buffer. Instead of inserting a `<tab>`?
Example, `js-indent-level` value is 4. Eglot overwrite those 4 spaces with 1 `<tab>` making the indentation 8 spaces wide, which is Emacs default size.
An option would be to set the default tab-size to 4. But I would rather having Eglot just using the indentation step defined in major-mode.
Is there an option for this? I can't seem to find it.
JohnDoe365 · 2022-12-02 15:02
This could be - at least - partly done as long as the language server itself is configurable in that manner. You have to understand that formatting is delegated to an external process which has no idea about your editing preferences.
Concerning eglot - Changing an existing configuration is as I understand it, not encouraged. However, nothing prevents you to add your own LSP configuration, assign it to the preferred major mode (will then take precedence over an existing configuration) and set the value for indentation based to emacs indent settings.
How this could be done is over my head.
MrMelankoli · 2022-12-02 18:58
True, I had completely forgotten about the workspace configuration. That is an option I might consider. Thanks