Skip to content

Fenced JSON in schemas #16

Closed
Closed
@shelldandy

Description

@shelldandy

So shopify has a new {% schema %} tag inside of which you have to place json it'd be nice to have json highlighting and indentation rules in there I'm trying to solve it myself but my vim skills are not that sharp here's my solution so far:

after/syntax/liquid.vim

if exists("b:current_syntax")
  unlet b:current_syntax
endif

syn include @JSON syntax/json.vim

syn region nestedJSON
  \ matchgroup=liquidDelimiter
  \ start="{% schema %}"
  \ keepend
  \ end="\n{% endschema %}"me=s-2
  \ contains=@JSON

Which results in this:

screen shot 2017-08-18 at 12 03 51 pm

So that gives me the inner parts of the schema with JSON highlighting but the {% schema %} word itself if colored all in liquidDelimiter colors instead of liquidDelimiter liquidStatement liquidDelimiter like the {% endschema %} keyword.

Also still no indentation rules applied so far.

Do you have any suggestions on how to improve this? 😄

Thanks a lot for your awesome work for the vim world

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions