de-jcup / eclipse-yaml-editor

Eclipse YAML editor
https://marketplace.eclipse.org/content/yaml-editor
Apache License 2.0
34 stars 10 forks source link

formatter #86

Open daltinn opened 4 years ago

daltinn commented 4 years ago

Please improve formatter for better _____ with default settings yamllint

current errors:

de-jcup commented 4 years ago

Sorry, but I do not exactly understand what is meant by the description.

What I (hopefully) understand:

What I not understand:

Please add some example yaml snippets and describe your wanted behaviour: I would like to have

daltinn commented 4 years ago

I'm sorry for my mistakes

file suitable for yamllint (no errors or warnings) WANTED format:

---
some_key:
  - sequence_1
  - sequence_2  # inline comment, "#" indented by two spaces
  # - sequence_commented
another_key:

after auto-format previous file (Shift-CRTL-F in Eclipse):

some_key:
- sequence_1
- sequence_2 # inline comment
another_key: null
# ----------------
# Orphan comments:
# ----------------
# Was at begin of line:5 :# - sequence_commented

result of yamllint after auto-formatting

test.yml
  1:1       warning  missing document start "---"  (document-start)
  2:1       error    wrong indentation: expected 2 but found 0  (indentation)
  3:14      warning  too few spaces before comment  (comments)
  5:1       warning  comment not indented like content  (comments-indentation)
  8:49      error    no new line character at the end of file  (new-line-at-end-of-file)

about errors: 1:1 - example in documentation 2:1 - in example in documentation sequence indented as expect yamllint 3:14 - example in documentation 8:49 - file must ending with new-line-at-end-of-file for better compatibility with Linux & git

thank you

de-jcup commented 4 years ago

Is there an external formatter tool which could do the job? Inside bash editor we got an external formatter option, see https://github.com/de-jcup/eclipse-bash-editor/issues/117 which can call any external formatter - per default beautysh.

Would this be an option?