Skip to content

Auto-Format destroys multiline macros #1602

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

Closed
willie68 opened this issue Oct 1, 2013 · 5 comments
Closed

Auto-Format destroys multiline macros #1602

willie68 opened this issue Oct 1, 2013 · 5 comments
Assignees
Labels
Component: IDE The Arduino IDE
Milestone

Comments

@willie68
Copy link

willie68 commented Oct 1, 2013

From the Forum (http://forum.arduino.cc/index.php?topic=191048.0):

In my code I'm defining some macros.
e.g.
Code:

#define calcNP() \
if ((this->state & 0xF0) == 0) { \
    if (myStack.index == stackSize) { \
      this->msNullpoint = getMsValue(); \
      this->nullpoint = mMapMsValue(this->msNullpoint); \
      this->state = this->state | 0xF0; \
        } \
  }

If i try to format this file i get
Code:

#define calcNP() \
if ((this->state & 0xF0) == 0) { 
  \
    if (myStack.index == stackSize) { 
    \
      this->msNullpoint = getMsValue();  
    \
      this->nullpoint = mMapMsValue(this->msNullpoint); 
    \
      this->state = this->state | 0xF0; 
    \
        } 
  \
  }

which now throws compile errors.

The formatter should ignore the macro definition.
In addition it would be nice to have some markers in the source to prevent the formatter to format some portion of the source.
In Eclipse i can do this by adding:

// @formatter:off
...
// @formatter:on
@ffissore
Copy link
Contributor

@willie68 which OS do you have? I've a working fix for this but I need some real world test

@willie68
Copy link
Author

Windows 8, Windows 7

@ffissore
Copy link
Contributor

Can you give this a try? I've run it with windows 8 but it should work with windows 7 too. Can you run it with windows 7?
https://docs.google.com/file/d/0B25ol7x7AsJRNUhHUGZBeXZEc2c/edit?usp=sharing

@willie68
Copy link
Author

hi,
testet on my Windows 7 netbook. Working...! :-)

@ffissore
Copy link
Contributor

good to know! I'll try to make it part of 1.5.5 release (or 1.5.6 otherwise)

@ghost ghost assigned ffissore Oct 15, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: IDE The Arduino IDE
Projects
None yet
Development

No branches or pull requests

2 participants