Go Down

Topic: [IDE] request: indentation for the if-else directives #if, #ifdef, #ifndef, ... (Read 2138 times) previous topic - next topic

compsystems

Hello

Please adhere to the indentation AutoFormat for the if-else directives #if, #ifdef, #ifndef, #else, #elif and #endif

Before  :(
Code: [Select]
#define STEPPER NEMA17
#if STEPPER == NEMA17
#define DEFTFULLSTEPS 200 // MM
#else
//...
#endif

#define BELT GT2
#if BELT == GT2
#define BELTPITCH 2 // MM
#define PULLEYNUMBERTEET 20
#else
//...
#endif

#define SCREW S5MM //  
#if SCREW == S8MM
#define THREADPITCH 1.25 // MM,
#else
#if SCREW == S8MM
#define THREADPITCH 1 //1 MM
#else
//...
#endif
#endif




Aafter  :o

Code: [Select]
#define STEPPER NEMA17
#if STEPPER == NEMA17
  #define DEFTFULLSTEPS 200 // MM
#else
  //...
#endif

#define BELT GT2
#if BELT == GT2
  #define BELTPITCH 2 // MM
  #define PULLEYNUMBERTEET 20  
#else
  //...
#endif

#define SCREW S5MM //  
#if SCREW == S8MM
  #define THREADPITCH 1.25 // MM,
#else
  #if SCREW == S8MM
    #define THREADPITCH 1 //1 MM
    #else
      //...
    #endif
#endif


Good idea?

pert

Just add indent-preproc-block to {Arduino IDE installation folder}/lib/formatter.conf.

compsystems

Thanks for your reply

I want the solution is for all people, of course that is configurable menu (File menu/Preferences),

How you can add this to the source code and that future versions of arduinoIDE

Thanks

Another example

Code: [Select]
#ifdef SDCC
    #if DEBUGGING == 1
        #if defined (uctrl)
            #define FLASH_MEMORY_END 0x3DC0
        #elif defined (uctrl)
            #define FLASH_MEMORY_END 0x7DC0
        #else
            #error "Can't set  up flash memory end!"
        #endif
    #else
        #if defined (uctrl0)
            #define FLASH_MEMORY_END 0x4000
        #elif defined (uctrl1)
            #define FLASH_MEMORY_END 0x8000
        #else
            #error "Can't set  up flash memory end!"
        #endif
    #endif
#else
    #if DEBUGGING == 1
        #define FLASH_MEMORY_END 0x7DC0
    #else
        #define FLASH_MEMORY_END 0x8000
    #endif
#endif

kewakl

Just add indent-preproc-block to {Arduino IDE installation folder}/lib/formatter.conf.
Thanks

Go Up