How to prevent automatic indentation as you type on Eglot C?

What happened?

I’m using Eglot as LSP. On C code, it automatically indents the files as I type, like removing space between parenthesis, the function style etc.

Please see K Gopal Krishna's Nextcloud for a video.

This happens only in C. It didn’t happen in LSP Mode (the other Emacs LSP implementation). I tried disabling electric-indent but the issue is still there.

What did you expect to happen?

The code not to be indented at all as I type.

Steps to reproduce

  1. Use clangd as C LSP.
  2. Use Eglot for LSP implementation.
  3. Try typing the following C code:
int
add (int a, int b)
{
  return a + b;
}

System information


Loading data dump...

I resolved by adding a .clang-format to the project’s root directory with the following contents:

DisableFormat: true

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.