IntelliJ Code Style for VS Code
Use your IntelliJ IDEA code style XML in VS Code. Import one or more schemes, pick the active one, and the extension applies it to every file you open.

Features
- Import IntelliJ code style schemes. Exported scheme files (
<code_scheme>) are copied into the extension, so the original file may move or be deleted later. Import as many as you like and switch between them.
- Indentation per language. Indent size, tab size and tabs/spaces are set for every editor, based on the matching IntelliJ language section. Languages without a section use IntelliJ's "Other file types" settings.
- Line separator.
LINE_SEPARATOR is enforced on save.
- Formatter settings. IntelliJ rules with a clear counterpart are translated into the settings of VS Code's formatters:
- TypeScript/JavaScript: spaces within braces and template string braces, space before function parenthesis, semicolons, brace placement, quote style
- HTML: wrap line length from the right margin
- Java: an Eclipse formatter profile (indentation, continuation indent, line length, blank lines to keep) for the Language Support for Java extension
- Editor ruler at the right margin
- Default formatter. The extension registers itself as the formatter for documents and selections. It skips files matching
DO_NOT_FORMAT and hands everything else to the language's own formatter, with the IntelliJ indentation.
- Exact IntelliJ formatting on demand. The command Format with IntelliJ runs IntelliJ's command-line formatter (
idea format) on the current file. It applies every rule of the scheme, exactly as IntelliJ does.
- Overview of active rules. The status bar shows the active scheme and its effect on the current file. Click it to see every rule that applies, and every setting the extension has written.
Getting started
- Export your scheme in IntelliJ: Settings → Editor → Code Style → ⚙ → Export → IntelliJ IDEA code style XML.
- In VS Code, open the settings and search for IntelliJ Code Style.
- Click Import XML… and select one or more files. The first imported scheme becomes active.
- To switch schemes, click Select active…. You can also type a scheme name into
ijCodeStyle.active in the workspace settings to use a different scheme per project.
All actions are also available in the Command Palette.
Commands
| Command |
Description |
| IntelliJ Code Style: Import XML |
Import one or more IntelliJ code style XML files. A scheme with the same name is replaced. |
| IntelliJ Code Style: Select Active |
Pick the active scheme, or (none) to turn the extension off. |
| IntelliJ Code Style: Remove |
Delete an imported scheme. |
| IntelliJ Code Style: Show Active Rules |
Show the rules for the current file and the settings written by the extension. |
| IntelliJ Code Style: Format with IntelliJ |
Format the current file with IntelliJ. Requires a local IntelliJ installation. |
Settings
| Setting |
Description |
ijCodeStyle.active |
Name of the active scheme. Empty: none. Can be set per workspace. |
ijCodeStyle.ideaPath |
IntelliJ launcher for Format with IntelliJ, for example /opt/idea/bin/idea.sh or C:\Program Files\JetBrains\IntelliJ IDEA\bin\idea64.exe. Empty: search PATH for idea, idea.sh, intellij-idea-ultimate, intellij-idea-community. |
Changes to your user settings
While a scheme is active, the extension writes these keys into your global user settings:
editor.defaultFormatter, and every language-specific editor.defaultFormatter you had set (for example in "[typescript]")
- the translated formatter settings (
typescript.format.*, javascript.format.*, typescript.preferences.quoteStyle, html.format.wrapLineLength, editor.rulers)
java.format.settings.url and java.format.settings.profile, if the Java extension is installed
Your previous values are saved first. When you select (none) or another scheme, the extension restores them. Select (none) before you uninstall the extension, otherwise the written values stay in your settings.
Workspace settings (.vscode/settings.json) are never changed, and take precedence over the values above.
The command copies the current file and the active scheme into a temporary folder, runs idea format -s <scheme> -allowDefaults <file>, and replaces the editor content with the result. The temporary folder is deleted afterwards. If you edit the file while IntelliJ runs, the result is discarded.
Each run starts a JVM and takes a few seconds. Depending on the IntelliJ version, idea format may refuse to run while the IntelliJ IDE itself is open.
Limitations
- VS Code's formatters support only a small part of IntelliJ's rules. Wrapping, brace forcing, blank line rules and most spacing options are applied only by Format with IntelliJ. Show Active Rules lists them per language.
- The extension cannot choose which formatter it hands a file to. VS Code picks the next registered formatter for the language.
- Prettier ignores the indentation passed by the extension and uses its own configuration.
- A setting field in VS Code cannot show a dynamic dropdown, so
ijCodeStyle.active is a text field. Use Select active… to pick from the list.
- Language-specific formatter settings that you add while a scheme is active are overridden only after the next restart or scheme change. Combined language blocks such as
"[typescript][javascript]" are not overridden.
DO_NOT_FORMAT supports glob patterns only, not named scopes.
Privacy
The extension makes no network requests. Imported schemes are stored in VS Code's extension storage on your machine.
License
MIT
| |