IntelliJ IDEA 14 Will Detect Code Styles on the Fly

If you’ve already tried the latest IntellIJ IDEA 14 EAP build, you might’ve noticed that the Code Style settings offers a new option: Detect and use existing file indents for editing (enabled by default.)

This new option lets IntelliJ IDEA detect certain Code Style settings (such as Use Tab character and Indent size) in the currently edited file on the fly. It means that even if a file has a code style different from your current settings, they will still be preserved.

So now you don’t need to worry about losing the formatting in files that are specific to certain files in your project that differ from the others.

We hope you’ll find these improvements useful. Your feedback as always is welcome, so don’t hesitate to share it in our discussion forum as well as report any bugs directly to the issue tracker.

Develop with Pleasure!

About Andrey Cheptsov

Part-time dreamer. JVM/JavaScript geek. IntelliJIDEA Marketing Manager at JetBrains.
This entry was posted in New Features and tagged , , . Bookmark the permalink.

14 Responses to IntelliJ IDEA 14 Will Detect Code Styles on the Fly

  1. Andriy Bazanov says:

    Works bad for me in PHP file (PhpStorm v8.0.2 EAP build 139.14 on Windows 7).

    It ALWAYS uses spaces.

    Extremely likely because it sees spaces (as first whitespace character) in PHPDoc comments:

    And since at least one PHPDoc comment will always be (if user follows common practice) before any other real code/indent …

  2. andre says:

    Woah! That’s an awesome feature!

  3. Adron Hall says:

    Oh man, I’m very stoked about this feature and the possibilities that come along with it. I use the code style features frequently under the current version in WebStorm, and I hope that this feature gets put into that IDE soon too! Are there any plans for that?

  4. Marc Stock says:

    This is cool but the formatting feature that I really want is where files can be viewed in one style and saved in another. Some places have styles I really don’t like and it would be fantastic if I could pick a style for viewing only.

  5. Bohuslav Burghardt says:

    I like this feature! But I noticed one thing which seems odd:

    Let’s say I have a file indented by 4 spaces. Then I do search and replace to make it 8 spaces. But when I hit Enter for example, the IDE still thinks that the file has 4 space indentation and indents accordingly. After I close and reopen the file, correct indentation of 8 spaces is detected and used.

    Is this deliberate? Or should IntelliJ detect such changes on the fly without reopening the file?

  6. Anton says:

    I wait for this to be in AppCode & CLion

  7. aga says:

    cool feature!
    Anyhow, since I am still using 13.1 and do not want to switch now, could you tell me if there is any plugin with that functionality?

  8. zivl says:

    A step to the right direction, but don’t stop.
    I would appreciate if editor/refactoring respects style of already writen code/text near (surrounding) the edited statement/line. Not one indentation for whole file. Mixed indentation is the reality I have to live with. That makes me no problem than editing in an editor enforcing one formal style without respecting style of a closest context.
    I’m looking forward for the next step that way.
    Thank you for doing work joyful!

Leave a Reply

Your email address will not be published. Required fields are marked *