GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1354

Groovy formatter ignoring @formatter:off directive

    Details

    • Type: Bug Bug
    • Status: Open Open
    • Priority: Minor Minor
    • Resolution: Unresolved
    • Affects Version/s: 2.6.1.M1
    • Fix Version/s: None
    • Component/s: Formatting
    • Labels:
    • Environment:
      STS 2.8.1
    • Number of attachments :
      0

      Description

      I have lists that are being broken onto separate lines that I wish to keep on the same line.

      I tried to simply turn off formatting for this section of code, to no avail.

      It appears that the groovy formatter does not respond to this directive: @formatter:off that is part of the base eclipse formatter

      grails.plugins.springsecurity.interceptUrlMap = [
      '/js/**': ['IS_AUTHENTICATED_ANONYMOUSLY'],
      '/css/**': ['IS_AUTHENTICATED_ANONYMOUSLY'],
      '/images/**': ['IS_AUTHENTICATED_ANONYMOUSLY']]

      is being turned into

      grails.plugins.springsecurity.interceptUrlMap = [
      '/js/**': [
      'IS_AUTHENTICATED_ANONYMOUSLY'
      ],
      '/css/**': [
      'IS_AUTHENTICATED_ANONYMOUSLY'
      ],
      '/images/**': [
      'IS_AUTHENTICATED_ANONYMOUSLY'
      ]

        Activity

        Hide
        Andrew Eisenberg added a comment -

        Yes, this is not something we have implemented yet. It would be a good thing to have.

        Show
        Andrew Eisenberg added a comment - Yes, this is not something we have implemented yet. It would be a good thing to have.
        Hide
        Hidetoshi Ayabe added a comment -

        Hi.I tried to write this feature.
        It may be ignored by adding a simple code to GroovyBeautifier class.

        exsample:
        https://github.com/aya-eiya/groovy-eclipse/commit/bff36f3ed58f84cb576c989a5097421e2c1cc7ee

        The plugin has some formatting features,and this code cannot ignore the lines all cases.
        But,In most cases, it should be all right.

        Show
        Hidetoshi Ayabe added a comment - Hi.I tried to write this feature. It may be ignored by adding a simple code to GroovyBeautifier class. exsample: https://github.com/aya-eiya/groovy-eclipse/commit/bff36f3ed58f84cb576c989a5097421e2c1cc7ee The plugin has some formatting features,and this code cannot ignore the lines all cases. But,In most cases, it should be all right.
        Hide
        Davide Cavestro added a comment -

        This is really annoying, especially when you have per-project auto-save reformat actions enabled for java sources, but getting in the way even for groovy ones (see GRECLIPSE-1533).
        So the developer ends up having no way to keep its groovy code formatted as he wants, cause java reformatting logic always applies.
        In this scenario even a partial fix would be welcome (I've seen there's a patch proposal, but I had no way to test it).

        Show
        Davide Cavestro added a comment - This is really annoying, especially when you have per-project auto-save reformat actions enabled for java sources, but getting in the way even for groovy ones (see GRECLIPSE-1533 ). So the developer ends up having no way to keep its groovy code formatted as he wants, cause java reformatting logic always applies. In this scenario even a partial fix would be welcome (I've seen there's a patch proposal, but I had no way to test it).
        Hide
        Hidetoshi Ayabe added a comment -

        I send a pull request for this.

        https://github.com/groovy/groovy-eclipse/pull/109

        Show
        Hidetoshi Ayabe added a comment - I send a pull request for this. https://github.com/groovy/groovy-eclipse/pull/109

          People

          • Assignee:
            Unassigned
            Reporter:
            Peter Larson
          • Votes:
            4 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated: