pedro-w / vscode-tmlanguage

Syntax highlighting for TextMate/SublimeText language definitions
MIT License
18 stars 4 forks source link

Repository is not illegal here. #13

Open SSlinky opened 1 year ago

SSlinky commented 1 year ago

image

  foo:
    name: some.scope.lang
    begin: "(?i)([a-z][a-z0-9_]*)\\s*\\("
    end: "\\)"
    patterns:
      - include: "#baz"
      - include: "#bar"
    repository:
      ...
SSlinky commented 1 year ago

Doesn't seem to like repository at any level below top.

image

SSlinky commented 1 year ago

image

  foo:
    name: some.scope.lang
    begin: "(?i)([a-z][a-z0-9_]*)\\s*\\("
    end: "\\)"
    patterns:
      - include: "#baz"
      - include: "#bar"
    repository:
      ...

Original is incorrect. For some reason, repository is not a supported key when the rule contains begin/end matches. The second comment stands. It is supported with no matches (just patterns, as above) and with a single match rule. e.g.

  foo:
    name: source.foo
    match: "If.*"
    captures:
      0:
        patterns:
          - include: "#bar"
    repository:
      bar:
        name: source.bar

image

pedro-w commented 1 year ago

I tried this on the current development version of vscode-tmlanguage (i.e. not the one on the marketplace) which contains the fix for #12, on a file foo.tmLanguage.yaml containing just this:

  foo:
    name: source.foo
    match: "If.*"
    captures:
      0:
        patterns:
          - include: "#bar"
    repository:
      bar:
        name: source.bar

The result is: image I think this is OK? Can you point me to another file where it's not working? Thanks!

SSlinky commented 1 year ago

Sure, this file shouldn't have any syntax issues.