
- Make visual studio code format files like intellij how to#
- Make visual studio code format files like intellij install#
- Make visual studio code format files like intellij code#
In the snippet above, we have defined two major sections: the root section and the Java style section. # Character set to be used in java files. # many characters you want your indentation to be # You can play with this value and set it to how # The other allowed value you can use is space
Make visual studio code format files like intellij code#
Since I would like my Java code to use tab indentation with a tab size of 4, the UTF-8 character set, and trim any trailing whitespaces in my code, I will define the following properties in the. editorconfig in the root folder of our project and define the coding styles we need. To get started, we need to create a file named.
Make visual studio code format files like intellij install#
IntelliJ comes with native support for EditorConfig, which means that we do not have to install a plugin to make it work.


This problem is exactly what EditorConfig solves.ĮditorConfig allows us to define commonly used coding styles in a file that can easily be used across several IDEs to enforce consistent coding styles among several developers working on the same codebase, thus leading to less friction in your team. This amounts to unnecessary extra work and when you add up the time spent doing this per PR that has indentation issues, you would realize it’s a lot of time that could have been spent doing more productive tasks. It wasn’t too much of an issue for me while working locally in my IDE but since I work in a team where other Engineers would need to review my code, having consistent coding styles across files became very important.Īs a short-term fix, I would always confirm the indentation style being used by each file I made changes to and then tweak my IDE indentation style to be the same. But after checking out the code with my IDE whose default setting is tabs, all of my changes in any file used that same tab indentation and that was where the problem started.

The issue here was that some files in the repository I worked with use space indentation while the newer files use tab indentation. I was always having PR comments on spacing/indentation and it became a headache when in one of my PRs, I had several such comments. My initial pull request had a few bugs which I fixed but the ones that seemed distracting were comments around spacing and tabs. I was using IntelliJ IDEA since most of the codebases I’m working on revolve around Java. I joined a new team almost a year ago and after my onboarding with other engineers across several of their codebases, it was time to start making code contributions.
Make visual studio code format files like intellij how to#
Are you working on a project with other developers where reading code is not as fun as you would want because of inconsistent coding styles? In this article, we’ll have a look at how to achieve painless code formatting with EditorConfig.
