[PATCH] D148467: [clang-format] Add a new AfterCSharpProperty to BraceWrapping
MyDeveloperDay via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 18 09:59:57 PDT 2023
MyDeveloperDay added a comment.
>> public Foo {
>> set;
>> get;
>> }
>
> At least from my experience, the getter is specified before the setter, though I'm unsure how important this is in your eyes.
Lets hold off the idea of swapping `set;get` around from this patch, but this is something that I think we could do.. (using the FormatTokenLexer.cpp to swap trivial `set;get` into `get;set` but lets leave that for another feature, as it would be code altering)
honeslty I think we need another option maybe
enum AllowShortCSharpProperties {
Leave,
Never,
Empty,
Always
}
**Leave **= Don't touch them
**Never **= always break (braces follow AfterCSharpProperty
set;
get;
set {
val = value;
}
get {
return = value;
}
**Empty** = only one the same line when empty
set; get
set {
val = value;
}
get {
return = value;
}
**Always **= always short form for trivial
set; get;
set { val = value; }
get { return = value; }
I'm trying to decide if I put that option in this change or in a seperate change (thoughts @HazardyKnusperkeks, @owenpan )
FYI, I've solved the indention issue in my branch which has been broken forever from what I can tell.
verifyFormat("class A\n"
"{\n"
" string Bar {\n"
" get;\n"
" set\n"
" {\n"
" val = value;\n"
" }\n"
" }\n"
"}",
Style);
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148467/new/
https://reviews.llvm.org/D148467
More information about the cfe-commits
mailing list