wiki:PadrePluginYAML

Version 18 (modified by bowtie, 2 years ago) (diff)

--

Padre::Plugin::YAML

YAML plug-in that provides background syntax checking

To-Do

  • tidy up code
  • syntax panel dose not show a green square when clean
    • food for thought, was fun, still looking

Limitations

By using YAML::XS

  • directives are supported only for the %YAML 1.1 or none
%YAML 1.1
# --- document separator
---
plack_middlewares:
  -
    - Expires
    - Deflater
    - StackTrace
    - Debug
    - panels
    -
      - Parameters
      - Dancer::Version
      - Dancer::Settings
      - Memory
      - PerlConfig
      - DBITrace 
      - ModuleVersions
...
# comments like so
---
rootproperty: blah
section:
  one: two
  three: four
  Foo: Bar
  empty: ~
# ... indicate the end of a document
...

what no validation!

Debugging

  • Use the following to track down "Unknown YAML error" displayed in Syntax Panel.
    perl dev -a -t Padre::Plugin::YAML::Syntax
    

Food for Thought

Printing in line 383 of /usr/src/Padre/Padre/lib/Padre/Wx/Syntax.pm:
Padre::Plugin::YAML::Syntax  {
    Parents       Padre::Task::Syntax
    Linear @ISA   Padre::Plugin::YAML::Syntax, Padre::Task::Syntax, Padre::Task
    public methods (4) : DEBUG, new, run, syntax
    private methods (1) : _parse_error
    internals: {
        filename   "/home/kevin/workspace/Lama/stuff/test.yml",
        model   {
            issues   [
                [0] {
                    file   "/home/kevin/workspace/Lama/stuff/test.yml",
                    line   22,
                    message   "could not find expected ':'",
                    type   "F"
                }
            ],
            stderr   "YAML::XS::Load Error: The problem:

    could not find expected ':'

was found at document: 2, line: 23, column: 6
while scanning a simple key at line: 22, column: 1
"
        },
        owner   38,
        project   "/home/kevin/workspace/Lama"
    }
}
Printing in line 383 of /usr/src/Padre/Padre/lib/Padre/Wx/Syntax.pm:
Padre::Plugin::YAML::Syntax  {
    Parents       Padre::Task::Syntax
    Linear @ISA   Padre::Plugin::YAML::Syntax, Padre::Task::Syntax, Padre::Task
    public methods (4) : DEBUG, new, run, syntax
    private methods (1) : _parse_error
    internals: {
        filename   "/home/kevin/workspace/Lama/stuff/test.yml",
        model   {
            rootproperty   "blah",
            section   {
                empty   undef,
                Foo   "Bar",
                one   "two",
                three   "four"
            }
        },
        owner   42,
        project   "/home/kevin/workspace/Lama"
    }
}