GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — IDEA-180965: Add support for IntelliJ formatter · Issue #200 · diffplug/spotless

IDEA-180965: Add support for IntelliJ formatter #200

New issue
Copy link
New issue
Copy link
Closed
Closed
IDEA-180965: Add support for IntelliJ formatter#200
Copy link
Labels
enhancement

Description

@fabriziocucci
fabriziocucci
opened on Feb 8, 2018
Issue body actions

The line wrapping options that can be configured with IntelliJ seem to be a little bit more flexible than the one available in Eclipse (e.g. lambda-related preferences).

The closest thing I've found to format Java sources using an IntelliJ code style is its command line formatter. Although that still requires having the full binaries of IntelliJ (but I hope to be wrong!).

Reacted by Tomas R, Feng Yu, Ruth, mdbarr73, Arnaldo Trujillo Falcón, Eric Sirianni, Alex Stark, Mikołaj Kondratek, Andrei Sfat, Jonathan Bluett-Duncan and 42 more

Activity

Next
  1. nedtwigg commented on Feb 8, 2018

    @nedtwigg
    nedtwigg
    on Feb 8, 2018
    Member
    More actions

    Happy to merge a PR for this, but currently nobody is working on it.

    You can use a custom step do this, there's an example of how to do this (and a description of its shortcomings) in #119.

  2. nedtwigg
    added
    question
    on Feb 8, 2018
  3. nedtwigg
    changed the title [-][QUESTION] Is there any plan to support IntelliJ generated code style for Java?[/-] [+]Add support for IntelliJ formatter[/+] on Feb 8, 2018
  4. nedtwigg
    added
    enhancement
    and removed
    question
    on Feb 8, 2018
  5. fabriziocucci commented on Feb 12, 2018

    @fabriziocucci
    fabriziocucci
    on Feb 12, 2018
    Author
    More actions

    Commented interesting issue on the IntelliJ issue tracker related to this enhancement:

    https://youtrack.jetbrains.com/issue/IDEA-180965

    Reacted by Jonathan Bluett-Duncan, Matthias Balke, bootstraponline, LQiang79, Ajibola Aiyedogbon, Volodymyr Mykhailov, Valerij Dobler, c0nstexpr and t-chab
  6. JLLeitschuh
    changed the title [-]Add support for IntelliJ formatter[/-] [+]IDEA-180965: Add support for IntelliJ formatter[/+] on Feb 13, 2018
  7. diffplug
    deleted a comment from fabriziocucci on Jul 24, 2018
  8. diffplug
    deleted a comment from fabriziocucci on Jul 24, 2018
  9. leonard84 commented on Sep 14, 2018

    @leonard84
    leonard84
    on Sep 14, 2018
    More actions

    Also: Provide standalone formatter or API https://youtrack.jetbrains.com/issue/IDEABKL-7685

    Reacted by Brice Dutheil, Volodymyr Mykhailov and Ivan Luzyanin
  10. nedtwigg commented on Jun 3, 2020

    @nedtwigg
    nedtwigg
    on Jun 3, 2020
    Member
    More actions

    If you don't care about using the IntelliJ formatter specifically, but rather just the IntelliJ IDE to autoformat in a way that agrees with Spotless, another path forward would be to make a plugin for IntelliJ that calls out to the spotless IDE hook. For example, here's a plugin for VSCode.

    Reacted by Vishal Nehra, Michael Leonhard and DanielPinoGL
  11. anandbhaskaran commented on Jun 8, 2020

    @anandbhaskaran
    anandbhaskaran
    on Jun 8, 2020
    More actions

    It would be awesome if this come into reality!

    Reacted by Alexandre Guidin, geosmart, Yevhen Sukhomud, Peter Abeles, DimiT, iury souza, Henrik Nårstad, Angelo Rosenfelder, borram, Cemal and 3 more
  12. lfgcampos commented on Jan 6, 2021

    @lfgcampos
    lfgcampos
    on Jan 6, 2021
    More actions

    Long shot but, any news about it?

    Reacted by Yonatan Karp-Rudin, Santiago Ferrer Deheza, Pavel Efros, milowedo, SiwyDym, Hakanai and Andrew Dey
  13. sbilello commented on Sep 30, 2021

    @sbilello
    sbilello
    on Sep 30, 2021
    More actions

    If we want to use the intellij java code style with spotless. What's the recommended approach? https://github.com/google/styleguide/blob/gh-pages/intellij-java-google-style.xml

  14. jbduncan commented on Oct 2, 2021

    @jbduncan
    jbduncan
    on Oct 2, 2021
    Member
    More actions

    @sbilello Spotless doesn't support the IntelliJ formatter yet. The way to get Google-style Java formatting is to use this instruction:

    spotless {
      java {
        googleJavaFormat().reflowLongStrings()
      }
    }

    It uses google-java-format, which is a successor to the IntelliJ XML file you linked, so I recommend google-java-format over it. :)

  15. 11 remaining items

  16. nedtwigg commented on Jun 8, 2023

    @nedtwigg
    nedtwigg
    on Jun 8, 2023
    Member
    More actions

    Is there any particular reason that Spotless Maven lacks parity with Spotless Gradle

    Nope, we just got PR's from Gradle users, that's all.

  17. lipiridi commented on Aug 12, 2023

    @lipiridi
    lipiridi
    on Aug 12, 2023
    More actions

    @ragurney @lutovich @tonjohn @nedtwigg
    Hi! I've been developed a plugin that supports maven based on @ragurney's plugin (for which special thanks to him) and added some new features.
    https://plugins.jetbrains.com/plugin/22455-spotless-applier
    https://github.com/lipiridi/spotless-applier

    Reacted by Ryan Gurney
  18. IlyasYOY commented on Nov 2, 2023

    @IlyasYOY
    IlyasYOY
    on Nov 2, 2023
    Contributor
    More actions

    Hello! Any updates on the issue?

    I found docs: Format files from the command line | IntelliJ IDEA Documentation.

    I use this API myself to format code using neovim:

    vim.keymap.set("n", "<leader>oC", ":!idea format -s ~/idea.xml -r %<CR>edit<CR>")

    I'd be glad to try to implement the feature if maintainers think it's possible.

    PS. I tested this on Linux & MacOS. There some caveats:

    • Some IDEA builds have this formatter builtin AFAIU. The version from Jetbrains Tools Box didn't seem to work.
    • MacOS version did formatting asynchronously. This is a problem. Version installed in Manjaro works synchronously with concise logs .

    Anyway considering all above, I'd gave a try to the feature. I'd add this as experimental due to unstable API of the IDE.

  19. nedtwigg commented on Nov 9, 2023

    @nedtwigg
    nedtwigg
    on Nov 9, 2023
    Member
    More actions

    A PR for this would be very welcome. ForeignExe might be the easiest way to implement it. It's okay if it only works on some platforms, so long as it works for the platform you use. Future PR's can always add support for missing platforms.

    Reacted by Daniel Kraus and Ilya Ilyinykh
  20. IlyasYOY commented on Jan 16, 2024

    @IlyasYOY
    IlyasYOY
    on Jan 16, 2024
    Contributor
    More actions

    Thanks for your hint @nedtwigg

    I created the *Step class a few days ago. It works fine on my macos machine. I faced a problem testing it on CI, there is no IDEA binary & simple installation from brew might require tweaking.

    I saw your PR #672. Maybe I'm missing something but I don't have any good ideas on running IDEA in test on every machine (CI at least). I can come up with a solution but maybe the team has an appropriate solution for the problem.

    Contribution guide helped a lot, thanks!

  21. nedtwigg commented on Jan 23, 2024

    @nedtwigg
    nedtwigg
    on Jan 23, 2024
    Member
    More actions

    Amazing! IdeaStep has been implemented, after half a decade in the desert!

    Note the following:

    • in PR Add support for gofmt #2001
    • gradle/special-tests.gradle
    • testlib/src/main/java/com/diffplug/spotless/tag/GofmtTest.java
    • note that all tests have @GofmtTest from the tag above

    In this way, the tests are always compiled, even though they aren't run.

    Of all these "special" tests, the only ones which get run on CI right now are the npm tests. It would be better if they all ran, but it would be worse if the steps didn't exist at all.

    The important thing is that if someone wants to develop the step further, they aren't starting from scratch - they have tests, they just need to setup their local machine to have foreign exe in question.

    Reacted by Daniel Kraus, Ilya Ilyinykh and Clif Reeder
    Reacted by Ilya Ilyinykh
  22. IlyasYOY
    added a commit that references this issue on Jan 23, 2024

    Make IDEA tests special

    8e30175
  23. IlyasYOY commented on Jan 23, 2024

    @IlyasYOY
    IlyasYOY
    on Jan 23, 2024
    Contributor
    More actions

    Thanks for the advice! Really appreciate it!

    I've just opened a Draft PR.
    #2020

    Reacted by Daniel Kraus
  24. CC007 commented on Dec 6, 2024

    @CC007
    CC007
    on Dec 6, 2024
    More actions

    Any info on getting this to work with maven? Spotless applier is a nice first attempt, but is too slow for my use-case.

  25. zlsmith86 commented on Feb 10, 2025

    @zlsmith86
    zlsmith86
    on Feb 10, 2025
    More actions

    I am excited about this feature!! I hope it makes it to main sometime! On a new project i ended up using the eclipse formatter because of the customizability, but most of us use IntelliJ so this would be a huge win!!

  26. simschla commented on Feb 21, 2025

    @simschla
    simschla
    on Feb 21, 2025
    Contributor
    More actions

    I'm working on this (based on #2020) because I would love to have it too. Can't make any promises on the timeline, though.

    Reacted by CC007, Lucas Campos, Daniel Kraus and Nicolas Kosinski
  27. jimmyzzxhlh commented on Feb 28, 2025

    @jimmyzzxhlh
    jimmyzzxhlh
    on Feb 28, 2025
    More actions

    @simschla Thank you! Our team is looking into creating a pre-commit hook using Intellij style, so far only Spotless with Intellij formatter seems to be a promising solution.

  28. simschla commented on Jul 2, 2025

    @simschla
    simschla
    on Jul 2, 2025
    Contributor
    More actions

    Resolved in #2535

    Reacted by Andrii Lomakin and Suresh
    Reacted by Andrii Lomakin, Daniel Kraus and Ilya Ilyinykh
  29. simschla
    closed this as completedon Jul 2, 2025
  30. nedtwigg commented on Jul 7, 2025

    @nedtwigg
    nedtwigg
    on Jul 7, 2025
    Member
    More actions

    Released in plugin-gradle 7.1.0 and plugin-maven 2.45.0.

    Reacted by Ilya Ilyinykh, Suresh, Lucas Campos and Ronald Dehuysser
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.