pascalre / vscode-yaml-sort

This VS Code extension exposes the possibility to sort, format and validate yaml files.
https://marketplace.visualstudio.com/items?itemName=PascalReitermann93.vscode-yaml-sort
MIT License
41 stars 2 forks source link

Colon in multiline strings causes improper formatting #194

Open gustaff-weldon opened 4 months ago

gustaff-weldon commented 4 months ago

For the given config:

    "vscode-yaml-sort.emptyLinesUntilLevel": 2,
    "vscode-yaml-sort.useLeadingDashes": false,
    "vscode-yaml-sort.lineWidth": 10000,
    "vscode-yaml-sort.sortOnSave": 0,
    "vscode-yaml-sort.quotingType": "\"",

The following yaml snippet formats improperly, it looks like the : in url trips of the parser:

jobs:
  build:
    steps:
      - run: |
          ls -al
          wget http://example.com

Expected:

jobs:

  build:
    steps:
      - run: |
          ls -al 
          wget http://example.com

Actual:

jobs:

  build:
    steps:
      - run: |
          ls -al  wget http://example.com

While testing, I removed : in http: and it formats ok:

jobs:
  build:
    steps:
      - run: |
          ls -al
          wget http//example.com

gives:

jobs:

  build:
    steps:
      - run: |
          ls -al
          wget http//example.com
AGrabovajFitA commented 4 months ago

Same issue here when writing a description that has a ":" in any line other than the first one.

---
  description: >
    first line
    second line: fails due to the colon