Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically configure formatting for IntelliJ #53812

Closed
pugnascotia opened this issue Mar 19, 2020 · 6 comments · Fixed by #84674
Closed

Automatically configure formatting for IntelliJ #53812

pugnascotia opened this issue Mar 19, 2020 · 6 comments · Fixed by #84674
Labels
:Delivery/Build Build or test infrastructure >enhancement >non-issue Team:Delivery Meta label for Delivery team

Comments

@pugnascotia
Copy link
Contributor

Forked from #53747.

We could automatically configure IntelliJ to use the Eclipse formatter and our bundled format config. The downside of this is that it relies on the "Eclipse Code Formatter" plugin, though I also noticed a thing in IntelliJ about "Required Plugins", under "Build, Execution, Deployment". I tried adding the Eclipse plugin, and it created the file .idea/externalDependencies.xml with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ExternalDependencies">
    <plugin id="EclipseCodeFormatter" />
  </component>
</project>

Configuring the plugin created: .idea/eclipseCodeFormatter.xml with contents:

<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="EclipseCodeFormatterProjectSettings">
    <option name="projectSpecificProfile">
      <ProjectSpecificProfile>
        <option name="formatter" value="ECLIPSE" />
        <option name="pathToConfigFileJava" value="$PROJECT_DIR$/.eclipseformat.xml" />
        <option name="selectedJavaProfile" value="Elasticsearch" />
      </ProjectSpecificProfile>
    </option>
  </component>
</project>

It's also referenced in .idea/workspace.xml:

<project>
  <component name="PropertiesComponent">
    <property name="settings.editor.selected.configurable" value="EclipseFormatter" />
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (:Core/Infra/Build)

@rjernst rjernst added the Team:Core/Infra Meta label for core/infra team label May 4, 2020
@mark-vieira mark-vieira added Team:Delivery Meta label for Delivery team and removed Team:Core/Infra Meta label for core/infra team labels Nov 11, 2020
@mark-vieira
Copy link
Contributor

@pugnascotia does the recent work for Checkstyle mostly address this?

@pugnascotia
Copy link
Contributor Author

No, this is a separate thing.

@mark-vieira
Copy link
Contributor

mark-vieira commented Mar 2, 2022

Where did we land with this? So far as I can tell the only missing bit is the "Required plugins" bit. I tested this locally by uninstalling the plugin and doing a fresh import and it worked fine.

image

I suggest we go ahead and do this so it's one less thing folks have to configure manually. In fact, I think that will mean folks don't have to configure anything manually on import which would be awesome. I know we've had some reports of folks fighting with spotless before realizing they weren't using the same format rules in the IDE.

@pugnascotia
Copy link
Contributor Author

I haven't looked at this again since I raised it, but if you can get it to work on project import then please do!

@mark-vieira
Copy link
Contributor

Should we add the checkstyle plugin to the list as well?

pugnascotia added a commit to pugnascotia/elasticsearch that referenced this issue Mar 4, 2022
Closes elastic#53812.

The CheckStyle-IDEA and EcliseCodeFormatter IDEA plugins are to all
intents and purposes required when using IntelliJ to work on
Elasticsearch, so add configuration that marks then as required.
pugnascotia added a commit that referenced this issue Mar 7, 2022
Closes #53812.

The CheckStyle-IDEA and EcliseCodeFormatter IDEA plugins are to all
intents and purposes required when using IntelliJ to work on
Elasticsearch, so add configuration that marks then as required.
pugnascotia added a commit that referenced this issue Mar 7, 2022
Closes #53812.

The CheckStyle-IDEA and EcliseCodeFormatter IDEA plugins are to all
intents and purposes required when using IntelliJ to work on
Elasticsearch, so add configuration that marks then as required.
pugnascotia added a commit that referenced this issue Mar 7, 2022
Closes #53812.

The CheckStyle-IDEA and EcliseCodeFormatter IDEA plugins are to all
intents and purposes required when using IntelliJ to work on
Elasticsearch, so add configuration that marks then as required.
pugnascotia added a commit that referenced this issue Mar 7, 2022
Closes #53812.

The CheckStyle-IDEA and EcliseCodeFormatter IDEA plugins are to all
intents and purposes required when using IntelliJ to work on
Elasticsearch, so add configuration that marks then as required.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >enhancement >non-issue Team:Delivery Meta label for Delivery team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants