I want VSCode to be indented in the same way as Java when writing C language.

Asked 2 years ago, Updated 2 years ago, 90 views

I usually use cmd+k, cmd+f when aligning indents, and when writing Java, indent is

for(inti=0;i<10;i++){
    ~~~~~~~~~~~~
    }

However, if you use the same shortcut when writing C language,

 for (inti=0;i<10;i++)
    {
       ~~~~~~
    }

It will look like .

This indent is very difficult for me to see, so I want to do the same as when I was writing Java, but I didn't know how to set it up, so I'd like to ask you.

java c vscode

2022-09-29 21:26

1 Answers

The following settings resolved the issue.

  • Specify Google in C_Cpp.clang_format_style
  • editor.formatOnSave, editor.formatOnType is the true

Reference:
I want to change the shape of a new line in parentheses in VSCode
Setting Visual Studio Code (C/C++ Edition)

This post was edited based on @RugbyRugby's Comment and posted as Community Wiki.I edited this post based on @RugbyRugby's Comment and posted it as Community Wiki.


2022-09-29 21:26

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.