eclipseindentationauto-indent

How to make eclipse not auto-indent a block of code


I like Eclipse's auto-indent function, but sometimes I've got some indentation I don't want it to correct, like

audioBuffer1[j] = (short) (VOLUME_REDUCER * ( inputBuffer[i] 
                  + ALPHA *   inputBuffer[i - echo1a] 
                  + ALPHA *   inputBuffer[i + echo1a]
                  - ALPHA *   inputBuffer[i - echo1b] 
                  - ALPHA *   inputBuffer[i + echo1b] 
                           ));

which gets corrected to something horrible. Is there a way of making the auto-indent function skip over some bits of code, using an @annotation or something?


Solution

  • You can put // at the end of the lines you don't want it to wrap.

    audioBuffer1[j] = (short) (VOLUME_REDUCER * ( inputBuffer[i] // 
                      + ALPHA *   inputBuffer[i - echo1a] //
                      + ALPHA *   inputBuffer[i + echo1a] //
                      - ALPHA *   inputBuffer[i - echo1b] //
                      - ALPHA *   inputBuffer[i + echo1b] //
                               ));