Auto-import converts indent spaces to tabs...Killing me...

When auto-importing, Idea will convert all existing indent spaces to tabs on the fly. It won't do it if there's a single automatic import, but when there's multiple options (Alt-Enter, select one), it fires.

I've sniffed all over the settings and I can't figure out how to turn this off. It's not trailing the spaces checkbox, it's not the Optimize Imports on the Fly checkbox...Anyone know how to stop it?

9 comments
Comment actions Permalink

I think it has to do with block reformatting after autocomplete (Ctrl-Enter). I can't figure out how to turn this off...Hopefully it's just a dumb setting I missed...

0
Comment actions Permalink

Will wrote:

When auto-importing, Idea will convert all existing indent spaces to tabs on the fly. It won't do it if there's a single automatic import, but when there's multiple options (Alt-Enter, select one), it fires.

I've sniffed all over the settings and I can't figure out how to turn this off. It's not trailing the spaces checkbox, it's not the Optimize Imports on the Fly checkbox...Anyone know how to stop it?


In the code style turn off General->Use Tab Character. All your
indentation should use spaces now.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0
Comment actions Permalink

It's not whether indentations are spaces or tabs, it's the fact that they're automatically reformatted. It marks every line as modified. I currently have to auto-import, copy the import statement, rollback the file, then past the import in. It's a hassle.

Is there any way to turn off auto-reformatting after an auto-complete (Ctrl-Shift-Enter)?

0
Comment actions Permalink

Will wrote:

It's not whether indentations are spaces or tabs, it's the fact that they're automatically reformatted. It marks every line as modified. I currently have to auto-import, copy the import statement, rollback the file, then past the import in. It's a hassle.

Is there any way to turn off auto-reformatting after an auto-complete (Ctrl-Shift-Enter)?


Ah, I see what you mean. It reformats other parts of the code
surrounding where you've just used Ctrl-Shift-Enter, right? That annoys
me as well from time to time. I don't know how to prevent it from doing
that. Don't use Ctrl-Shift-Enter, I guess. You don't have to use it to
get auto-import. Wait for the import popup and then press Alt-Enter.
That should add the import statements without reformatting other parts
of the code.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0
Comment actions Permalink

Unfortunately, the import popup requires me to hit Ctrl-Alt-Enter...Also, whenever I paste something in, it does the same thing, despite the fact that I have the Reformat on Paste setting off...

It's really only whitespace, but not all of use Idea and whitespace changes in CVS are still recorded changes...

0
Comment actions Permalink

Will wrote:

Unfortunately, the import popup requires me to hit Ctrl-Alt-Enter...Also, whenever I paste something in, it does the same thing, despite the fact that I have the Reformat on Paste setting off...


It does? That's exceedingly odd. Perhaps I'm misunderstanding your
situation: You have typed some code which includes a class name for
which there is no import. Correct? You should get a popup offering to
import the class which you can accept using the default keymapping of
Alt-Enter. As far as I know, this doesn't reformat the code around the
unknown class name.

It's really only whitespace, but not all of use Idea and whitespace changes in CVS are still recorded changes...


Perhaps if you can get your team to decide on a single standard of
indentation, the problem wouldn't be so bad. Once decided, you could go
through your sourcecode and reformat the indentation in one (big?) commit.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0
Comment actions Permalink

It is just Alt-Enter for import, but it reformats all indents in the class...Standardizing would be a huge project...

This is new since 4.5.3, and it's real annoying.

0
Comment actions Permalink

Will wrote:

It is just Alt-Enter for import, but it reformats all indents in the class...Standardizing would be a huge project...

This is new since 4.5.3, and it's real annoying.


Basically, IDEA works under the assumption of a uniform indentation
style. Maybe in 5.0 they enforce that assumption more consistently.

Perhaps you should try filing a feature request in IDEA's JIRA system
that describes your situation clearly and how you would like it to be
handled.

Nevertheless, I really do think it's bad to mix indentation styles in
the same file.

Ciao,
Gordon

--
Gordon Tyler (Software Developer)
Quest Software <http://www.quest.com/>
260 King Street East, Toronto, Ontario M5A 4L5, Canada
Voice: (416) 933-5046 | Fax: (416) 933-5001

0

Please sign in to leave a comment.