Skip to content
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

Clang-format: Have an option to add a comment at the closing brace of a loop, switch, case etc #124741

Open
MrMfromK opened this issue Jan 28, 2025 · 3 comments
Labels
clang-format enhancement Improving things as opposed to bug fixing, e.g. new or missing feature

Comments

@MrMfromK
Copy link

There is an option to add a comment giving the name of a namespace at the closing brace of a namespace (FixNamespaceComments).
My wish is to have something similiar at the closing brace of loops, switch, case, if, else showing the respective instrution at the opening brace.
Maybe with a minimal number of lines between opening and closing brace and a seperate option for each of the mentioned instructions.
Would be great help!

@llvmbot
Copy link
Member

llvmbot commented Jan 28, 2025

@llvm/issue-subscribers-clang-format

Author: None (MrMfromK)

There is an option to add a comment giving the name of a namespace at the closing brace of a namespace (FixNamespaceComments). My wish is to have something similiar at the closing brace of loops, switch, case, if, else showing the respective instrution at the opening brace. Maybe with a minimal number of lines between opening and closing brace and a seperate option for each of the mentioned instructions. Would be great help!

@ldrumm
Copy link
Contributor

ldrumm commented Jan 28, 2025

What would it say? The namespace comment makes sense, since the namespace has an identifier, and therefore carries more semantic information with it, but the utility of a comment that says "endfor or similar" is less obvious

for (...) {
  for (...) {
    for (...) {

    } // endfor?
  } // endfor?
} //endfor?

@MrMfromK
Copy link
Author

MrMfromK commented Jan 28, 2025 via email

@EugeneZelenko EugeneZelenko added the enhancement Improving things as opposed to bug fixing, e.g. new or missing feature label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang-format enhancement Improving things as opposed to bug fixing, e.g. new or missing feature
Projects
None yet
Development

No branches or pull requests

4 participants