GRECLIPSE
  1. GRECLIPSE
  2. GRECLIPSE-1355

Formatter splitting single list element into multiple lines

    Details

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

      Description

      Related to: GRECLIPSE-827

      Groovy formatter is splitting list with a single (long) element onto multiple lines. I would think that (although the element contained is large) there isn't much benefit to trying to split this when it only results in new lines with only [ or ]

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

      becomes

                                      '/js/**': [
      					'IS_AUTHENTICATED_ANONYMOUSLY'
      				],
      				'/css/**': [
      					'IS_AUTHENTICATED_ANONYMOUSLY'
      				],
      

        Issue Links

          Activity

          Hide
          Marc Paquette added a comment -

          Reading GRECLIPSE-827, I see there is a criteria for the "long-ness" of a list : frankly, I expected the code formating setting for "maximum line width" in the "Line Wrapping" section to be the one having the last word on this.

          Either that or it should have a separate setting user-modifiable controlling that limit.

          It is terribly annoying to have a list being broken up in lines when it is not expected. For example, if you are designing a DSL where tabular data is natural, you will probably end up having somewhat long lists that you will want aligned accross lines; actual behavior breaks this big time.

          Show
          Marc Paquette added a comment - Reading GRECLIPSE-827 , I see there is a criteria for the "long-ness" of a list : frankly, I expected the code formating setting for "maximum line width" in the "Line Wrapping" section to be the one having the last word on this. Either that or it should have a separate setting user-modifiable controlling that limit. It is terribly annoying to have a list being broken up in lines when it is not expected. For example, if you are designing a DSL where tabular data is natural, you will probably end up having somewhat long lists that you will want aligned accross lines; actual behavior breaks this big time.
          Hide
          Andrew Eisenberg added a comment -

          I will be adding a new user controlled setting called 'Long list length'. This will just be a way to expose the constant that was used internally to determine how/when to wrap lists. The default is what it has been before, 30. And you can bump that up (or down) if you like.

          Would this be sufficient for you?

          Show
          Andrew Eisenberg added a comment - I will be adding a new user controlled setting called 'Long list length'. This will just be a way to expose the constant that was used internally to determine how/when to wrap lists. The default is what it has been before, 30. And you can bump that up (or down) if you like. Would this be sufficient for you?
          Hide
          Andrew Eisenberg added a comment -

          I am committing a fix that will go into the next snapshot build that adds this new Long list length setting to the Preferences -> Groovy -> Formatter page. Please try this out and get back to me if this works for you or if there's something different you'd like to see.

          Show
          Andrew Eisenberg added a comment - I am committing a fix that will go into the next snapshot build that adds this new Long list length setting to the Preferences -> Groovy -> Formatter page. Please try this out and get back to me if this works for you or if there's something different you'd like to see.
          Hide
          Marc Paquette added a comment -

          Thanks Andrew, looks very good to me.

          As the actual value of the limit goes, I'm not sure I understand fully how to interpret "30" versus "200". It is not the column number (I would guess) but with 30, my list was re-formated while with the upper-limit, 200, it was left alone (as wanted).

          So my list was considered as having more than 30 "things" but I can't count anything other that characters that goes over this; at the same time, if these are chars, each line has more than 200 characters but they are not re-formatted !

          Show
          Marc Paquette added a comment - Thanks Andrew, looks very good to me. As the actual value of the limit goes, I'm not sure I understand fully how to interpret "30" versus "200". It is not the column number (I would guess) but with 30, my list was re-formated while with the upper-limit, 200, it was left alone (as wanted). So my list was considered as having more than 30 "things" but I can't count anything other that characters that goes over this; at the same time, if these are chars, each line has more than 200 characters but they are not re-formatted !
          Hide
          Andrew Eisenberg added a comment -

          The value is the number of characters inside of the [ ] excluding leading/trailing whitespace. I guess that's not entirely clear from the description. I'll can make that more explicit. Thanks for the feedback.

          Show
          Andrew Eisenberg added a comment - The value is the number of characters inside of the [ ] excluding leading/trailing whitespace. I guess that's not entirely clear from the description. I'll can make that more explicit. Thanks for the feedback.

            People

            • Assignee:
              Andrew Eisenberg
              Reporter:
              Peter Larson
            • Votes:
              2 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: