I want to make sure that I don't break the line by complementing the parentheses of vscode.

Asked 2 years ago, Updated 2 years ago, 100 views

I am currently using C++ in vscode.
The current state is as follows
OS:ubuntu 18.04 LTS
vscode: 1.44.2
C++: g++ 7.5.0
Yes.

in the extension of vscode C/C++,
C++ Intellisense
We are both installing the latest version.

If you complement it in this state,

 for (size_ti=0;i<count;i++)
{
    /* code*/
}

It looks like .
This complement

 for (size_ti=0;i<count;i++) {// I don't want a new line in front of { like this
    /* code*/
}

I'd like to set it up like this, but is it possible?

c++ vscode

2022-09-30 18:16

1 Answers

Create a file named .clang-format in the root directory of your workspace and configure ClangFormat settings.Leave two configuration examples:

Example 1: Configuring BasedOnStyleFor example, the following is an example of LLVM coding standards compliance:

BasedOnStyle:LLVM

Example 2: BreakBeforeBraces and BraceWrapping settings individually.Below is an example.

BreakBeforeBraces:Attach

C/C++ extensions default code shaping by following the VS Code C_Cpp.clang_format_fallbackStyle file in the workspace if present.Note: https://code.visualstudio.com/docs/cpp/cpp-ide#_code-formatting

.clang-format is the configuration file for ClangFormat.You can configure various settings like a linked document.


2022-09-30 18:16

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.