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

Auto-Format: Wrap string scalars to line width #35

Open
tedepstein opened this issue Feb 14, 2016 · 1 comment
Open

Auto-Format: Wrap string scalars to line width #35

tedepstein opened this issue Feb 14, 2016 · 1 comment

Comments

@tedepstein
Copy link

YEdit has a line width setting in auto-format, but it does not seem to be using this to break strings across lines.

At a minimum, I would like this to break strings that use the > folded string indicator:

   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.<br><br>The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier.

This should become:

   /estimates/price:
      get:
         summary: Price Estimates
         description: >
            The Price Estimates endpoint returns an estimated price range for 
            each product offered at a given location. The price estimate is 
            provided as a formatted string with the full price range and the 
            localized currency symbol.<br><br>The response also includes low 
            and high estimates, and the
            [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code 
            for situations requiring currency conversion. When surge is active
             for a particular product, its surge_multiplier will be greater 
             than 1, but the price estimate already factors in this multiplier.

It would also be helpful to have the option to convert inline strings to block-style wrapped strings, where the inline string exceeds the line length. So the example below would be auto-formatted the same as in the example above:

   /estimates/price:
      get:
         summary: Price Estimates
         description: The Price Estimates endpoint returns an estimated price range for each product offered at a given location. The price estimate is provided as a formatted string with the full price range and the localized currency symbol.<br><br>The response also includes low and high estimates, and the [ISO 4217](http://en.wikipedia.org/wiki/ISO_4217) currency code for situations requiring currency conversion. When surge is active for a particular product, its surge_multiplier will be greater than 1, but the price estimate already factors in this multiplier.

NOTE: My knowledge of YAML is somewhat incomplete, so it's possible that I'm misunderstanding some of the rules. If someone thinks this looks incomplete or off-target, please chime in.

@oyse
Copy link
Owner

oyse commented Mar 18, 2016

The auto-formatting implementation in YEdit is quite broken actually. It is built upon the pretty-print serialisation feature in SnakeYAML and not really suited for good source formatting since it among other things strips away all comments.

The best way to fix this issue would be for someone to make a independent formatter for YAML but as far as I know no such project exists.

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

No branches or pull requests

2 participants