editorconfig-emacs
editorconfig-emacs copied to clipboard
The indent_size and indent_style property does not work
OS: Archlinux latest. Emacs version: 29 latest. (27 does not work too) Plugin version: latest.
When I insert Tab, I get tab indent and wrong indent size, But, an editorconfig file in the root of my project.
Please give me an answer! Thanks!
Thanks for reporting issue!
I want to know the result of M-x describe-editorconfig-properties
and the content of your .editorconifg
file.
Cloud you paste them?
Hi,
I think I have similar issue. Pressing Enter and TAB give me correct result. But running editorconfig-format-buffer, it went back to default setting
System:
- Emacs 27.2
-
- Fedora 34
-
- Latest editorconfig
-
- CSharp mode editorconfig file:
[*.cs]
indent_style = space
indent_size = 3
end_of_line = lf
insert_final_newline = true
Steps to reproduce:
- Create new project
- dotnet sln new
- dotnet new classlib -o alpha
-
- create .editorconfig file with above content
-
- Open alpha/Class1.cs
-
- Run editorconfig-format-buffer
Expected behavior:
-
- Buffer is formatted with correct indent width
Actual result:
- Indent is incorrect (width 4)
@serezlan Umm... I cannot reproduce your problem.
- What is the results of describe-editorconfig-properties before and after running editorconfig-format-buffer?
- What if you disable your init.el (emacs -q)? Does this problem still happen?
I forgot to mention I'm using lsp-mode. When I disable lsp, formatting buffer worked as expected and when it is turned on, it will override everything and use value from language server. I can get around this by setting lsp-enable-indentation to nil.
Thanks! I checked the lsp-mode code roughly.
It seems that when lsp-mode is enabled (and lsp-enable-indentation is set to t) lsp-mode configures buffers to use langauage servers' textDocument/rangeFormatting
request to format buffers. So Emacs buffers' indent configurations are ignored.
IMO each language server (not lsp-mode) needs to support .editorconfig
to fully solve your problem...
I'll document this to README.
My .editorconfig file:
root = true
[*]
indent_style = space
indent_size = 2