Search code examples
eclipsecontent-assist

How can I get Eclipse to insert tabs instead of spaces for Java content assist?


Is there any way to persuade Eclipse to use tabs instead of spaces for indenting its built-in Java content assist proposals (such as when creating an empty method which overrides a method in the parent class)?

The only setting I could find that looked relevant is in Windows/Preferences/General/Editors/Text Editors/Insert spaces for tabs, and this setting is unchecked.

(EDIT: Several posters have pointed out Java / Code Style / Formatter / Indentation / Tab policy, which is set to "Tabs only")

At the moment I have to remember to select them and re-format with <Ctrl>+<Shift>+<F>.


Solution

  • It seems to be currently a bug (not fixed in the 3.5 train):

    bug 44755 (for comments, but also valid for other refactoring JDT operations)

    Also linked to bug 231832, involving a bug in the AST rewrite...

    I believe this is a problem with ASTRewrite, not with the client of ASTRewrite. We have to make sure that code formatter settings are available for the rewrite part.
    Moving to JDT/Core for investigation.

    Detected in late 3.4, still not fixed in 3.5