Skip to content

[clang-format]: no space before trailing comment #55487

Open
@igagis

Description

to reproduce

.clang-format

---
AlignAfterOpenBracket: BlockIndent
AlignArrayOfStructures: Right
BinPackArguments: 'false'
ColumnLimit: '120'
ContinuationIndentWidth: '1'
IndentWidth: '1'
Language: Cpp
SpacesBeforeTrailingComments: '1'
SpacesInLineCommentPrefix:
  Minimum: 1
  Maximum: -1
Standard: Latest
TabWidth: '1'
UseCRLF: 'false'
UseTab: ForContinuationAndIndentation

...

main.cpp:

type tree( //
	2,
	{ // comment
		tree(3, {78, 89, 96}),
		tree(4, {32, 64, 128}),
		tree(42, {98, 99, 100})
	}
);

expected result

formatting is not changed

actual result

type tree( //
	2,
	{// comment
		tree(3, {78, 89, 96}),
		tree(4, {32, 64, 128}),
		tree(42, {98, 99, 100})}
);

The space before // comment is removed

version

$ clang-format --version
Debian clang-format version 15.0.0-++20220513071846+693758b28295-1~exp1~20220513071937.249

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions