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

Formatter ignores indent for if, for, while expressions #1221

Closed
rabits opened this issue Jan 24, 2021 · 9 comments
Closed

Formatter ignores indent for if, for, while expressions #1221

rabits opened this issue Jan 24, 2021 · 9 comments
Assignees
Milestone

Comments

@rabits
Copy link

rabits commented Jan 24, 2021

Hello folks,

I use groovy-eclipse through spotless and during scan found it don't like the multiline expression blocks:

  • Example-orig.groovy
    def   call() {
      if( true
          && true
          && false) {
        println('test')
      }
    }
    
  • Example-processed.groovy
    def   call() {
      if( true
      && true
      && false) {
        println('test')
      }
    }
    

So the expression for some reason gets the same indent as "if".

Also I noticed that by default it's not removing duplicated spaces (def call) and I found no params to control that.

@eric-milles eric-milles changed the title [BUG] Formatter ignores indent for if, for, while expressions & extra spaces Formatter ignores indent for if, for, while expressions & extra spaces Jan 30, 2021
@eric-milles eric-milles self-assigned this Feb 2, 2021
@eric-milles eric-milles added this to the v4.1.0 milestone Feb 2, 2021
@eric-milles eric-milles changed the title Formatter ignores indent for if, for, while expressions & extra spaces Formatter ignores indent for if, for, while expressions Feb 2, 2021
@eric-milles
Copy link
Member

fix building now; can you file a separate issue for the spaces concern

@rabits
Copy link
Author

rabits commented Feb 2, 2021

Oh sure, sorry about mixing this up. Created a separated one: #1225

Thank you for working on that)

@eric-milles
Copy link
Member

Can you give the changes a try?

@rabits
Copy link
Author

rabits commented Feb 3, 2021

Oh, so I'm using maven & spotless with 4.17.0 for greclipse and not quite sure how to run the changes... If you can give me a clue - I will be glad to test the changes)

@eric-milles
Copy link
Member

How is the groovy formatter included?

@rabits
Copy link
Author

rabits commented Feb 3, 2021

@eric-milles
Copy link
Member

It looks like you would create a local install of spotless-eclipse-groovy. The most recent targets Groovy-Eclipse 3.9.0. Snapshot builds are at 4.1.0 currently.

@rabits
Copy link
Author

rabits commented Feb 4, 2021

Ok, thank you - will check how to do that)

@rabits
Copy link
Author

rabits commented Feb 5, 2021

So, I actually started with spotless, found _ext/eclipse-groovy and probably the file that is links the groovy-eclipse version: https://github.com/diffplug/spotless/blob/main/_ext/eclipse-groovy/gradle.properties#L6 , so I tried to compile 4.1.0-SNAPSHOT as you recommended, but mvn clean package on the current groovy-eclipse master failed with error about "Could not find specification for custom execution environment profile 'JavaSE-15 in the target platform'"...

I tried to figure out what's happening in the repo and it's quite confusing, I did not found some build docs - so unfortunately I'm stuck here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants