-
-
Notifications
You must be signed in to change notification settings - Fork 40.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
What should the setting of IndentPPDirectives be? #6316
Comments
Personally, I don't have a preference one way or the other. I just want consistency :) |
I lean towards None or Before Hash. After Hash is confusting to look at if you don't have a good c syntax highlighting. |
For none, I do usually expect a comment on the #endif line stating which #if it was for: |
100% this. |
I have a slight preference for |
Just incase anyone wants a more real world example of My order of preference would be |
I really don't like Another thing worth discussing is whether preprocessor directive indentation should affect the indentation of regular code. In my opinion the answer is no, and I believe |
In summary, I think we should go with |
Agree with @vomindoraan - |
I believe |
My preference is |
@vomindoraan I’m with you on that preprocessir directives should not affect the indentation of regular code. |
I am for BeforeHash as well. Some people like to add a comment at the endif in those cases as well, I dont mind that TBH |
It's clear that long term BeforeHash is the preferred setting. We will need to monitor clang-format's propagation to determine when we can use that. In the meantime it seems like we can choose AfterHash or None. If we choose None clang-format is not able to enforce #end comments. Given that, which setting makes sense until we can use BeforeHash? |
My vote goes to |
also vote |
Thanks for your comments everyone. For now we will use AfterHash, and we will revisit switching to BeforeHash at each breaking change window until clang-format 9 has enough adoption. |
Co-Authored-By: Konstantin Đorđević <[email protected]>
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per #6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
* Add PS2_MOUSE_ROTATE to compensate for device orientation * fixup! Add PS2_MOUSE_ROTATE to compensate for device orientation * Reformat with IndentPPDirectives: AfterHash as per qmk#6316
Pre-processor formatting
Currently our preprocessor directives don't follow a consistent style. Sometimes the indent level matches the code's indent level, sometimes no intenting is used at all, and sometimes PPD's are indented to their own indent level.
Since we are switching to clang-format we have to choose one of the 2 pre-defined options, neither of which are a good fit for all the ways PPD's are used in QMK. We are looking for feedback from people who work on core code to make this decision.
Possible PPDIS values:
None
PPDIS_None (in configuration: None) Does not indent any directives. You can see this in the
future_ppdis_none
branch.After Hash
PPDIS_AfterHash (in configuration: AfterHash) Indents directives after the hash. You can see this in the
future
branch.Before Hash (Later, after clang-format 9.0.0 propagates)
PPDIS_BeforeHash (in configuration: BeforeHash) Indents directives before the hash. This option is only available in clang-format 9.0.0 and later. The latest version shipped by homebrew (and perhaps other systems) is 8.0.0.
The text was updated successfully, but these errors were encountered: