Menu

#1271 YAML improvements

Completed
open
nobody
5
2020-01-19
2019-03-20
No

YAML parsing and highlighting is lacking compared to other editors. When paired with Geany I get a very basic view of YAML code. My primary usage of YAML is with Ansible.

  • No syntax checking.
    • Wrong amount of indentation? No idea until you run it and it fails.
    • Wrong number of curly brackets?
    • Missing quote?
  • Little to know highlighting contrast. Booleans and some integers get highlighted differently but no coloring is done in variable files. Can we get coloring for variables or jinja arguments, etc. so things are easier to see?

Discussion

  • Neil Hodgson

    Neil Hodgson - 2019-03-21
    • labels: --> lexer, yaml
     
  • Neil Hodgson

    Neil Hodgson - 2019-03-21

    These seem reasonable. It'd help to include examples or links to show just what is meant by each case.

    Improving lexers is normally done by people interested in that language. I don't currently use YAML so will not be working on this myself.

     
  • Zufu Liu

    Zufu Liu - 2020-01-19

    I have a improved YAML lexer for YAML 1.2 at https://github.com/zufuliu/notepad2/blob/master/scintilla/lexers/LexYAML.cxx
    you can test Notepad2 v4.19.12.r2604 or later. If you are interesting, I can port the lexer to official Scintilla's lexlib after the Spring Festival.

    new styles in the lexer: directive, tag, verbatim tag, single quoted string, double quoted string, escape sequence, block scalar, indented text, datetime;
    explicit flow styles (i.e. JSON like '{}[]') is limited to 127 levels.
    the SCE_YAML_ERROR is not implemented: Tab in indentation is non-content whitespace.
    other bugs for YAML is also fixed [bugs:#1847], [bugs:#2081], [bugs:#2134].

     

    Related

    Bugs: #1847
    Bugs: #2081
    Bugs: #2134

  • Neil Hodgson

    Neil Hodgson - 2020-01-19

    That adds many new states so is significantly different from the current YAML lexer. To avoid problems in downstream projects, it might be a choice rather than a replacement.

    It would be worthwhile producing test examples: one that lexes identically in both YAML lexers, and another example to show the new features.

     

Log in to post a comment.