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

[Bug] Auto formatting does not work if there is an 'R "===== (' in the sketch? #10946

Open
rtek1000 opened this issue Nov 11, 2020 · 5 comments
Labels
Component: IDE The Arduino IDE Type: Bug Upstream notified Related to a software component maintained by someone else. They have been notified of it

Comments

@rtek1000
Copy link

rtek1000 commented Nov 11, 2020

Hi,

Auto formatting (Ctrl+T) does not work if there are:

const char webSite1[] PROGMEM = R"=====(
"abc"
)=====";

But Auto formatting works if there is no line break:

const char webSite1[] PROGMEM = R"=====("abc")=====";

In both cases the compilation is successful.

Arduino IDE 1.8.13 (Linux)

@per1234
Copy link
Collaborator

per1234 commented Nov 11, 2020

There is a bug report about it here in the repository of the Artistic Style tool used by the Arduino IDE's Auto Format feature: https://sourceforge.net/p/astyle/bugs/519/
It is claimed to be fixed (though there hasn't been a release of Artistic Style since that time).

@rtek1000
Copy link
Author

Interestingly, it may be better for the user to leave this type of variable in an additional file, such as index.h,

#include "index.h"

And thus can also use an online formatter to improve the reading of the code:

https://www.freeformatter.com/html-formatter.html

<html>
<body>
</body>
</html>
<html>
   <body></body>
</html>

@rtek1000
Copy link
Author

There is a bug report about it here in the repository of the Artistic Style tool used by the Arduino IDE's Auto Format feature: https://sourceforge.net/p/astyle/bugs/519/
It is claimed to be fixed (though there hasn't been a release of Artistic Style since that time).

I asked in the post when a new version of this software will be released, thanks!

@per1234 per1234 added the Upstream notified Related to a software component maintained by someone else. They have been notified of it label Mar 29, 2021
@roblatour
Copy link

I add that in other parts of the code, when this bug appears it puts extra spaces before / after the slash character "/" if they are surrounded by quotes. For example "one/two" gets transformed to "one / two" even if is in a statement 50 lines away.

@per1234
Copy link
Collaborator

per1234 commented May 25, 2021

Hi @rtek1000. There is some good news related to this bug. #11543 will change the Arduino IDE from using the Artistic Style formatter to ClangFormat, which is able to handle raw string literals correctly.

ClangFormat is very popular and actively developed, and even suggested by the Artistic Style developer in 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
Component: IDE The Arduino IDE Type: Bug 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