Ticket T567021
Visible to All Users

Formatting - Improve wrapping for chained method calls

created 7 years ago

Next, wrapping for Chained Method Calls really needs to have a tolerance setting. If I have a tolerance setting set that doesn't get matched, I don't want the formatting system to unformat whatever I have done manually for a given situation (which is what the tolerance settings do now if the tolerance level isn't met, and I've reported this item previously, although I think that's just falling through to the standard VS formatting engine which isn't up to the task.)

Comments (3)
AE AE
Alex Eg (DevExpress) 7 years ago

    Hi Jason,
    Please clarify if the tolerance setting should rely on the method call's nesting level and, e.g., 1-2 level method calls should not be wrapped even if they exceed the maximum line length?

      Max Line Length should trump tolerance levels, in my opinion.

      In my example, my ToString got wrapped, and I really don't want it to be. I know that MyObject.GetSomething().ToString() is technically a chained method, but that's a scenario that I don't need or what to have wrap. So if there was Tolerance setting, I'd set it to 2. If the tolerance settings have not been met but I have manually added a line wrap, I still want all the chained methods that follow to align by by indent settings.

      The problem I've run into with the tolerance settings on other things when I've messed with it is that if the Tolerance threshold hasn't been met, the formatting engine (either CRR or VS, I'm not sure which) is ignoring or removing the formatting that follows, even if I've manually done it. (Such as removing line wraps and putting them back on the same line when I've explicitly added line wraps). For the line wraps, maybe a master Line Wrap setting for "don't remove existing line wraps" would be a good idea? (The "Right margin column size" option on General is looking rather lonely.) For other situations, though, I don't really want the formatting engine to UNDO something under the threshold that's been manually formatted to match the same result as if the threshold had been met.

      I typically use the formatter to line everything up and chop long lines (or format after the refactoring stuff runs, since the refactoring tool doesn't appear to look to the formatting engine for advice). I don't use it for adding line wraps on chains because I have typically already added the line wraps when I want them. It'd be nice, however, if I could share the formatting settings with my team members so they wouldn't need to think about it.

      AE AE
      Alex Eg (DevExpress) 7 years ago

        Jason,
        Thank you for sharing your idea with us. I added your request to our TODO list. We will update this ticket when it is implemented. However, I cannot give you any estimate as it may be misleading.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.