-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Type: LanguageService
Describe the bug
- OS and Version: Linux Ubuntu 20.10
- VS Code Version:1.51.1
- C/C++ Extension Version: 1.1.0
Steps
E.g. 1
if(1 == 1) <---- after hitting enter here,
printf("Yes\n"); <---- next line does not autoindent
E.g. 2
if(1 == 1)
printf("Yes\n"); <---- after manual indent, and hitting enter
printf("No\n"); <---- this line should not have an indent, but it does
E.g. 3
for(int i = 1; i < 10; i++){
}
for(int k = 1; k < 10; k++){
} <---- typing this brace, should automatically lead to the following
for(int i = 1; i < 10; i++){
}
for(int k = 1; k < 10; k++){
} Correct Indent!
All of these examples work and indent/format correctly automatically in Visual Studio IDE automatically.
I read through previous issue #883 but it is not clear to me whether that issue should have resolved the examples above or not.
In settings.json, I currently have
"C_Cpp.clang_format_fallbackStyle": "{BasedOnStyle: Google, IndentWidth: 4, ColumnLimit: 0}"
I like to add that on hitting <Ctrl+Shift+i>, all of these do get formatted accurately. So, this is not a bug for sure and with the above settings.json entry, formatting on hitting <Ctrl+Shift+i> works just fine. This is more a question of whether this formatting can happen automatically as the user types. If that leads to a much heavier VSCode, I can understand.
Edited to add: Vim as C++ IDE with YCM and VimSpector plugins are able to correctly and automatically handle E.g. 1 and E.g. 2 above. I have not been able to get Vim to automatically handle E.g. 3 though.