kachick / anylang-template

A template that is not exclusive to one programming language
MIT License
0 stars 0 forks source link

Consider WebAssembly-based dprint plugin that formats YAML #129

Closed g-plane closed 3 months ago

g-plane commented 3 months ago

I made a WebAssembly-based dprint plugin that can format YAML: https://github.com/g-plane/pretty_yaml , so we can drop process-based yamlfmt.

dprint playground

kachick commented 3 months ago

Thank you for the great work!

For my use, the indent of last items in list and hashmap will be removed unexpectedly, but others looks good to me 馃檹

g-plane commented 3 months ago

Can you give me example?

kachick commented 3 months ago

From this repository

https://github.com/kachick/anylang-template/blob/21ac5aafbd6436a8e05ff488943f032cc47905b9/.github/workflows/ci-nix.yml#L27-L30 https://github.com/kachick/anylang-template/blob/21ac5aafbd6436a8e05ff488943f032cc47905b9/.github/workflows/ci-nix.yml#L33-L41 https://github.com/kachick/anylang-template/blob/21ac5aafbd6436a8e05ff488943f032cc47905b9/.github/workflows/merge-bot-pr.yml#L4-L8

=> https://github.com/kachick/anylang-template/actions/runs/9791270168/job/27034667182?pr=130

27 27| 路路路路路路matrix:
28 28| 路路路路路路路路os:
29 29| 路路路路路路路路路路-路ubuntu-24.04
   30|-路路路路路路路路路路#路-路macos-14
30   |+路路路路#路-路macos-14
31 31| 路路路路runs-on:路${{路matrix.os路}}
32 32| 路路路路timeout-minutes:路30
33 33| 路路路路steps:
...
38 38| 路路路路路路-路run:路nix路flake路show
39 39| 路路路路路路-路run:路nix路develop路--command路task路deps
40 40| 路路路路路路-路run:路nix路develop路--command路task路check
   41|-路路路路#路-路run:路nix路run路.路--路--version
41   |+#路-路run:路nix路run路.路--路--version
--
from /home/runner/work/anylang-template/anylang-template/.github/workflows/merge-bot-pr.yml:
 4  4| permissions:
 5  5| 路路contents:路write
 6  6| 路路pull-requests:路write
    7|-路路#路checks:路read路#路For路private路repositories
    8|-路路#路actions:路read路#路For路private路repositories
 7   |+#路checks:路read路#路For路private路repositories
 8   |+#路actions:路read路#路For路private路repositories
 9  9| 
10 10| jobs:
11 11| 路路judge-dependabot:
g-plane commented 3 months ago

I think it makes sense at some points. For example:

map1:
  - 1
  - 2
# below is map2
map2:

We can't simply move such # below is map2 comment into map1, but I may try to solve this in the future.

g-plane commented 3 months ago

v0.2.0 has been released, and this problem is fixed.

kachick commented 3 months ago

Thank you! 馃帀

I'll use this much useful plugin. 馃檹


Issued another problem for literal content as https://github.com/g-plane/pretty_yaml/issues/1