How to disable template auto-format in Eclipse?

Posted by Matiaan on Super User See other posts from Super User or by Matiaan
Published on 2012-11-22T10:39:51Z Indexed on 2012/11/22 11:05 UTC
Read the original article Hit count: 140

Filed under:
|
|

I have a template (sleep) in Eclipse 4.2.1 that should expand to

try { Thread.sleep(1000); } catch (Exception e) {}

I want Eclipse to add it as one line, just as I put it in the template. However, Eclipse autoformats it after inserting to:

try {
    Thread.sleep(1000);
} catch (Exception e) {
}

I have tried @formatter:off, but that does not work. I have code cleanup switched off.

Is there any way to disable formatting for all templates, since the only templates I use are one-liners anyway?

© Super User or respective owner

Related posts about eclipse

Related posts about format