dubreuia / intellij-plugin-save-actions

Supports configurable, Eclipse like, save actions, including "organize imports", "reformat code" and "rearrange code".
MIT License
531 stars 101 forks source link

Support for groovy #371

Open fhx opened 3 years ago

fhx commented 3 years ago

Describe the bug I wonder if support for groovy (files) is support in Save Actions - when I invoke Save Actions using CTRL-SHIFT-S it executes rules defined but does not seem to work fully with groovy files. IT does invoke some formatting rules, like whitepace between if() but rules for adding final for variables wont kick in.

Here is an example

def loginErrorNemLogin3() {
    log.debug('AuthController.loginErrorNemLogin3()')
    invalidateSession()

    boolean nemLogin3Active = AuthenticationService.isNemLogin3Active();
    boolean nemLogin2Active = AuthenticationService.isNemLogin2Active();

    return [requestedUrl   : params.j_requested_url,
            mocesClient    : MocesCertificateManager.getMocesClient(),
            nemLogin3Active: nemLogin3Active,
            nemLogin2Active: nemLogin2Active]
}

With the Save Actions rules defined i would expect it to add final for boolean nemLogin3Active = AuthenticationService.isNemLogin3Active(); and remove semicolons (since groovy dont need them)

What triggered the plugin CTRL+SHIFT+S, CTRL+S

Versions IntelliJ IDEA 2021.1.1 (Ultimate Edition) Build #IU-211.7142.45, built on April 30, 2021 Licensed to Systematic A/S

Runtime version: 11.0.10+9-b1341.41 amd64 VM: Dynamic Code Evolution 64-Bit Server VM by JetBrains s.r.o. Windows 10 10.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 8 Non-Bundled Plugins: com.dubreuia (2.2.0), org.jetbrains.plugins.spotbugs (1.2.4), org.sonarlint.idea (4.16.0.31683), org.jetbrains.kotlin (211-1.5.0-release-759-IJ6693.72) Kotlin: 211-1.5.0-release-759-IJ6693.72

Save Actions configuration attached: image2021-5-10_11-12-37