From IntelliJ, export the eclipse formatter file (XML) from settings > editor > Code style > Java

In Vscode you can download the extension - Language Support for Java™ by Red Hat which can import setting from XML files.
In Vscode > user - settings.json add the following
"java.format.enabled": true,
"java.format.settings.url": "https://raw.githubusercontent.com/google/styleguide/gh-pages/eclipse-java-google-style.xml",
"[java]": {
"editor.defaultFormatter": "redhat.java"
}
you can replace the URL with the local file path or a GitHub XML raw file link (of the previously exported IntelliJ XML file)
for more information on the Vscode extension, you can refer following links
- https://code.visualstudio.com/docs/java/java-linting
- https://github.com/redhat-developer/vscode-java/wiki/Formatter-settings
However, do note that there still might be differences in formatting between both IDEs (I think it's due to IntelliJ having a separate IntelliJ code style XML along with Eclipse XML which overrides some rules).
I prefer to use the eclipse-java-google-style.xml on both IDEs as it seems more consistent while formatting.
Provide formatter for IntelliJ default format setting
Need to import Eclipse Java Formatter profile in Visual Studio Code - Stack Overflow
How to make VS Code organize Java imports like IntelliJ - Stack Overflow
VScode default formatter for Intellij
We were able to get it the almost identical with the following config tweaks.
VS Code:
{
"java.completion.importOrder": [
"",
"javax",
"java",
"#"
]
}
IntelliJ

The only difference from the IntelliJ default is a new line between import javax... and import java....
It's possible to get VS Code and IntelliJ to agree on a standard format, as long as that standard format:
Puts static imports at the top*- Separates all specific sections with empty lines
Puts everything not in its own specific section in a catch-all section at the end*Never uses wildcard imports
- Not actually true; static imports can be positioned in VS Code with
'#', and everything else can be position in VS Code with''.
- Not actually true; static imports can be positioned in VS Code with
IntelliJ's default settings don't work for this, but it is flexible enough to be reconfigured. Here are the files to add to a project to make just that project set up consistent rules for both IDEs (make sure they are not excluded in .gitignore).
Rule: The following groups separated by empty lines: Static imports, java.*, javax.*, everything else.
.vscode/settings.json:
{
"java.completion.importOrder": ["java", "javax"],
}
.idea/codeStyles/codeStyleConfig.xml:
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
</state>
</component>
.idea/codeStyles/Project.xml
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<JavaCodeStyleSettings>
<option name="CLASS_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="NAMES_COUNT_TO_USE_IMPORT_ON_DEMAND" value="99" />
<option name="IMPORT_LAYOUT_TABLE">
<value>
<package name="" withSubpackages="true" static="true" />
<emptyLine />
<package name="java" withSubpackages="true" static="false" />
<emptyLine />
<package name="javax" withSubpackages="true" static="false" />
<emptyLine />
<package name="" withSubpackages="true" static="false" />
</value>
</option>
</JavaCodeStyleSettings>
</code_scheme>
</component>
Hello. I'm starting on new project where everyone is using VSCode. They are using default formatter instead of prettier and they don't want to change it. Exist some way to export and import these settings from VScode to Intelij? I try find something but I'm lost. Thank you.
I know this is way too late but it can help others. In VSCode, press "ctrl + shift + x" ("cmd + shift + x" on mac). Then: If you want it for C++, search for "Intellij Theme C++" and install IF you want it for Java, search for "Familiar Java Themes", install and then select "Intellij Dark Theme".
There is a font called Voyager which is similar to Jetbrains IDEA theme you can install the extension from Visual Studio
Go to Extensions click Manage Extensions type "Voyager" in the search panel and install it
That’s my question. I’ve tried making them similar in the past but there are minor things that turn out different. So is there a way of making rules line up exactly?