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

Autoformat should remove spaces after (if, while, switch) statement conditional #10326

Closed
Avamander opened this issue Jun 8, 2020 · 5 comments
Labels
feature request A request to make an enhancement (not a bug fix) Upstream notified Related to a software component maintained by someone else. They have been notified of it

Comments

@Avamander
Copy link
Contributor

Avamander commented Jun 8, 2020

For example when the code looks like this:

if (a != b)          {
  return;
}

it should be turned into:

if (a != b) {
  return;
}

Same applies to switches:

switch (character)          {

it should be turned into:

switch (character) {
@per1234
Copy link
Collaborator

per1234 commented Jun 10, 2020

Arduino uses Artistic Style for auto formatting:
https://sourceforge.net/projects/astyle/
From what I can see, it does not currently have this capability. So I think the best way to proceed would be for you to make the feature request to the AStyle developers. Once the Artistic Style developers have added the feature, you'd then need to petition Arduino to update the version of AStyle they are using.

@per1234 per1234 added the feature request A request to make an enhancement (not a bug fix) label Jun 10, 2020
@Avamander
Copy link
Contributor Author

I opened an Astyle feature request: https://sourceforge.net/p/astyle/tickets/123/

@per1234 per1234 added the Upstream notified Related to a software component maintained by someone else. They have been notified of it label Jun 12, 2020
@fabianoriccardi
Copy link

Do you know if Astyle is abandoned? I have looked at the repo but I don't see any activity in the past 2 years...

@fabianoriccardi
Copy link

Sadly, the answer.

@per1234
Copy link
Collaborator

per1234 commented May 25, 2021

Hi @Avamander thanks for your interest in improving the code formatting capabilities of the IDE!

There is some good news related to this feature request. #11543 will change the Arduino IDE from using the Artistic Style formatter to ClangFormat, which provides just the sort of behavior you requested here.

ClangFormat is very popular and actively developed, and even suggested by the Artistic Style developer at the post @fabiuz7 kindly shared.this statement where they state that they are no longer able to play as active a role in developing Artistic Style.

You can give the test build for the ClangFormat/Arduino IDE integration a try. The downloads are available here:
#11543 (comment)
If you do try it out, please let us know how it goes!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request A request to make an enhancement (not a bug fix) Upstream notified Related to a software component maintained by someone else. They have been notified of it
Projects
None yet
Development

No branches or pull requests

3 participants