DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • The First Annual Recap From JPA Buddy
  • 7 Continuous Code Quality and Automated Code Review Tools
  • Detailed Guide: Setup Apache Spark Development Environment on Windows 10
  • Managing AWS Managed Microsoft Active Directory Objects With AWS Lambda Functions

Trending

  • Unlocking the Potential of Apache Iceberg: A Comprehensive Analysis
  • 5 Subtle Indicators Your Development Environment Is Under Siege
  • A Developer's Guide to Mastering Agentic AI: From Theory to Practice
  • Measuring the Impact of AI on Software Engineering Productivity
  1. DZone
  2. Coding
  3. Tools
  4. Managing Code Style on a Directory Level With EditorConfig

Managing Code Style on a Directory Level With EditorConfig

Learn more about the newest addition to IntelliJ IDEA — EditorConfig support.

By 
Anna Gasparyan user avatar
Anna Gasparyan
·
Jul. 05, 19 · Analysis
Likes (1)
Comment
Save
Tweet
Share
14.6K Views

Join the DZone community and get the full member experience.

Join For Free

As JetBrains announced a short while ago, in the upcoming version 2019.2, IntelliJ IDEA and other IntelliJ-based IDEs are extending EditorConfig support, thus allowing you to manage all code style settings for each set of files individually. All you need to do is place an .editorconfig file in the root directory containing the files whose code style you want to define. You can have as many .editorconfig files within a project as needed, so you can specify different code styles for different modules. All options from the .editorconfig file are applied to the directory where it resides as well as all of its sub-directories on top of the current project code style defined in Settings/Preferences|Editor|Code Style. If anything is not defined in .editorconfig, it’s taken from the project settings.

In v2019.2, in addition to the standard EditorConfig options, we are adding a bunch of custom IntelliJ IDEA options, so now you can conveniently manage all your code style settings on the directory level.

The options are divided into the following categories:

  • Standard options such as indent_size, indent_style, and so on. These options do not have any domain-specific prefixes.
  • Generic IntelliJ IDEA options that have the ij_ prefix and are applicable to all languages:
    • ij_visual_guides
    • ij_formatter_off_tag
    • ij_formatter_on_tag
    • ij_formatter_tags_enabled
    • ij_wrap_on_typing
    • ij_continuation_indent_size
    • ij_smart_tabs
  • Common IntelliJ IDEA language options supported by many (but not all) languages. They start with the ij_any prefix, for example, ij_any_brace_style.
  • IntelliJ IDEA language-specific options starting with the ij_<lang>_ prefix where <lang> is the language domain ID (normally a lower-case language name). For example, ij_java_blank_lines_after_imports.

Note: The same options may be defined as a common option and a language-specific option, for example, ij_<...>_brace_style. Language-specific options have higher priority over common or generic options.

Try it Out

Let’s give this feature a try using the ij_visual_guides option.

  1. In the Project view, select a source directory and select New|EditorConfig File from the context menu:create_new_editorconfig
  2. To create an empty file, do not select any properties in the dialog that opens: editorconfig_properties
  3. Add the following line: ij_visual_guides = 40,60 (once you start typing, code completion will suggest the available properties). You will immediately see visual guides painted at columns 40 and 60:editorconfig_visual_guides

Preview Code Style Settings

You can now easily preview how changes to your code style settings will impact the actual source files. To do this, click the eye icon in the left gutter of the EditorConfig file and select a source file affected by it. The preview of this file will open on the right:

editorconfig_preview_changes

You can make changes in the Preview pane to try and test how your configuration changes are reflected without worrying about making unwanted changes to the source code — all these changes are discarded when the EditorConfig file is closed.

If you’re excited to try this feature right now without having to wait for the release, download a new IntelliJ IDEA 2019.2 EAP build right now from their website or update using the ToolBox App.

Please share your thoughts and feedback in the comments section below, in our issue tracker, or on Twitter.

Happy Developing!

code style intellij Directory

Published at DZone with permission of Anna Gasparyan. See the original article here.

Opinions expressed by DZone contributors are their own.

Related

  • The First Annual Recap From JPA Buddy
  • 7 Continuous Code Quality and Automated Code Review Tools
  • Detailed Guide: Setup Apache Spark Development Environment on Windows 10
  • Managing AWS Managed Microsoft Active Directory Objects With AWS Lambda Functions

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!