VSCode clang-format can contain only one blank line.

Asked 1 years ago, Updated 1 years ago, 325 views

Uses standard VSCode formatter. (C/C++ Extension?)
I want to put two blank line breaks, but I can only put one line.
I don't think it really matters, but the language is C.
It seems that MaxEmptyLinesToKeep can be set, but it doesn't work.
There are no errors in the settings.(There is nothing in the output field of vscode)

In the example below, the declaration of the variable is a two-line blank in the function, macro, and comment.

inti;


intj;

The current clang-format configuration is as follows:

BasedOnStyle:LLVM
UseTab: Never
IndentWidth—4
BreakBeforeBraces:Attach
IndentCaseLabels: false
ColumnLimit: 0
AllowShortCaseLabelsOnASingleLine—true
AllowShortIfStatementsOnASingleLine—AllIfsAndElse
AfterControlStatement: false
SortIncludes: Never
AlignConsecutiveMacros:
  Enabled—true
  AcrossEmptyLines: false
  AcrossComments: true

MaxEmptyLinesToKeep2

vscode

2023-02-02 05:53

1 Answers

I don't use VSCode, so I just looked it up with the keyword, but as far as I can read about MaxEmptyLinesToKeep in Clang-Format, it seems to be the "maximum number of consecutive empty lines to hold."

https://clang.llvm.org/docs/ClangFormatStyleOptions.html#maxemptylinestokeep

The maximum number of consecutive empty lines to keep.

For example, if 2 is used, empty lines with two or more lines will be shaped into two lines, but on the other hand, if it is less than 2, = nothing will be done for empty lines with only one line (not always empty lines).

There seems to be an option OverEmptyLines.


2023-02-02 06:52

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.