Skip to content

indent is ignored by palantirJavaFormat #2204

Closed

Description

@PaulNgo-BlueOC
  • Summary of problem: As the title
  • Maven version: 3.8
  • Spotless version: 2.43.0
  • Operating system and version: windows 11
            <plugin>
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>2.43.0</version>
                <configuration>
                    <!-- define a language-specific format -->
                    <java>
                        <!-- no need to specify files, inferred automatically, but you can if you want -->

                        <!-- apply a specific flavor of google-java-format and reflow long strings -->
<!--                        <googleJavaFormat>-->
<!--                            <version>1.20.0</version>-->
<!--                            <style>GOOGLE</style>-->
<!--                            <reflowLongStrings>true</reflowLongStrings>-->
<!--                            <formatJavadoc>false</formatJavadoc>-->
<!--                        </googleJavaFormat>-->
                        <palantirJavaFormat>
                            <version>2.39.0</version>                     <!-- optional -->
                            <style>PALANTIR</style>                       <!-- or AOSP/GOOGLE (optional) -->
                            <formatJavadoc>false</formatJavadoc>          <!-- defaults to false (optional, requires at least Palantir 2.39.0) -->
                        </palantirJavaFormat>
                        <indent>
                            <spaces>true</spaces>
                            <spacesPerTab>2</spacesPerTab>
                        </indent>
                        <importOrder/>
                        <removeUnusedImports/>
                        <formatAnnotations/>
                    </java>
                    <formats>
                        <!-- you can define as many formats as you want, each is independent -->
                        <format>
                            <!-- define the files to apply to -->
                            <includes>
                                <include>src/main/java/**/*.java</include>
                                <include>src/test/java/**/*.java</include>
                            </includes>
                            <!-- define the steps to apply to those files -->
                            <trimTrailingWhitespace/>
                            <endWithNewline/>
                            <indent>
                                <spaces>true</spaces>
                                <spacesPerTab>2</spacesPerTab>
                            </indent>
                        </format>
                    </formats>
                </configuration>
            </plugin>

Activity

  1. changed the title [-]indent does not work with palantirJavaFormat[/-] [+]indent is ignored with palantirJavaFormat[/+] on Jul 12, 2024
  2. changed the title [-]indent is ignored with palantirJavaFormat[/-] [+]indent is ignored by palantirJavaFormat[/+] on Jul 12, 2024
  3. PaulNgo-BlueOC commented on Jul 29, 2024

    @PaulNgo-BlueOC
    Author
  4. nedtwigg commented on Aug 12, 2024

    @nedtwigg
    Member

    I'm guessing that palantir is formatting these as "4 spaces"? The fix is:

    • convert spaces to tab, 4
    • convert tabs to spaces, 2

    Dupe of #794

  5. PaulNgo-BlueOC commented on Aug 12, 2024

    @PaulNgo-BlueOC
    Author

    I'm guessing that palantir is formatting these as "4 spaces"? The fix is:

    * convert spaces to tab, 4
    
    * convert tabs to spaces, 2
    

    Dupe of #794

    Could you help to point out the exact config that i need to put to my pom.xml?

  6. nedtwigg commented on Aug 12, 2024

    @nedtwigg
    Member

    It's not polite to @ a bunch of people, if they want to be involved then they'll subscribe to the issue.

    Try this:

    <indent>
      <tabs>true</tabs>
      <spacesPerTab>4</spacesPerTab>
    </indent>
    <indent>
      <spaces>true</spaces>
      <spacesPerTab>2</spacesPerTab>
    </indent>
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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions