xurei xurei - 1 year ago 126
Javascript Question

IntelliJ - Tab indentation in Javascript does not work

I want to use tabs for indentation in my Javascript files. I changed the configuration as usual, but the preview doesn't seem to take my modification in account. Neither in the acutal files.

What is surprising is that the "Spaces" subtab is formatting the code the right way, but it's is the only place where it works. (See screenshots below)

Did anyone have the same issue ?

I am using IntelliJ Ultimate 2016.1

Config page (borken preview)

Spaces subtab (working preview)

Answer Source

Take a look a editorconfig.org . You will need a .editorconfig file at the root of your project. It's a markup file that works accros multiple IDE's to set some common configuration like indentation and trailing spaces. Here is an example.

root = true

indent_style = space
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true

indent_size = 2
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download