C auto-indent do not respect tab width. #8426
-
SummaryMinimal reproducable example for #4556 since the issue is not fixed. Indentation is fixed to 2 spaces even though it is specified as 4. Reproduction Stepslanguages.toml [[language]]
name = "cpp"
# config = { "clangd.fallbackFlags" = ["-std=c++20"] }
language-server = { command = "clangd", args = [
"--compile-commands-dir=./build",
] }
auto-format = true
indent = { tab-width = 4, unit = " " } main.cpp: #include <iostream>
int main(int argc, char *argv[]) {
std::cout << "test";
return 0;
} clang version 16.0.6 Helix logNo response PlatformArch Linux Terminal Emulatorkitty 0.29.2 Helix Versionhelix 23.05 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
that is not a bug but intended behaviour. Helix auto detects the existing indenation in a file and will use that. The config option is only used for new files or if auto detection fails. You example is already indented with two spaces so that is what helix detects. |
Beta Was this translation helpful? Give feedback.
-
Auto detection is broken then. Here is a zero indentation example. As soon as file is saved it is indented to two spaces, not four. #include <iostream>
int main(int argc, char *argv[]) {
std::cout << "test";
return 0;
} |
Beta Was this translation helpful? Give feedback.
If it only happens when it's saved, then it's the auto formatter. I think 2 spaces is the default for clangd.