forked from OSchip/llvm-project
[clang-format] No space inserted between commas in C#
Reviewers: krasimir Reviewed By: krasimir Subscribers: cfe-commits, MyDeveloperDay Tags: #clang-format, #clang Differential Revision: https://reviews.llvm.org/D76621
This commit is contained in:
parent
63828a35da
commit
04336ada17
|
@ -3015,6 +3015,10 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line,
|
|||
if (Right.is(TT_CSharpNullConditionalLSquare))
|
||||
return false;
|
||||
|
||||
// No space between consecutive commas '[,,]'.
|
||||
if (Left.is(tok::comma) && Right.is(tok::comma))
|
||||
return false;
|
||||
|
||||
// Possible space inside `?[ 0 ]`.
|
||||
if (Left.is(TT_CSharpNullConditionalLSquare))
|
||||
return Style.SpacesInSquareBrackets;
|
||||
|
|
|
@ -640,9 +640,12 @@ TEST_F(FormatTestCSharp, CSharpSpaces) {
|
|||
verifyFormat(R"(private float[,] Values;)", Style);
|
||||
verifyFormat(R"(Result this[Index x] => Foo(x);)", Style);
|
||||
|
||||
verifyFormat(R"(char[,,] rawCharArray = MakeCharacterGrid();)", Style);
|
||||
|
||||
Style.SpacesInSquareBrackets = true;
|
||||
verifyFormat(R"(private float[ , ] Values;)", Style);
|
||||
verifyFormat(R"(string dirPath = args?[ 0 ];)", Style);
|
||||
verifyFormat(R"(char[ ,, ] rawCharArray = MakeCharacterGrid();)", Style);
|
||||
}
|
||||
|
||||
TEST_F(FormatTestCSharp, CSharpNullableTypes) {
|
||||
|
|
Loading…
Reference in New Issue