C/C++: correct indentation for control statements (if/for/while) without braces #25105
wojdyr
started this conversation in
Language Support
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently, as discussed in #21161, having a statement such as
doesn't increase indentation in the next line.
It might have something to do with simplistic cpp/indents.scm.
This was partly fixed for C (for
if
andfor
only):9296159#diff-f8e4cb54de4d2596440eb20f78fec8bbf16f6ee540a5250b893075327240448d
For comparison, here are similar files for neovim:
https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/c/indents.scm
https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/cpp/indents.scm
My guess is that if you replace the content of cpp/indents.scm with:
it will bring C++ indentation on par with C indentation (
if
s andfor
s are most common).Beta Was this translation helpful? Give feedback.
All reactions