Skip to content

Add support for the schema tag #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ftdetect/liquid.vim
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ au BufNewFile,BufRead *.markdown,*.mkd,*.mkdn,*.md
\ endif

" Set subtype for Shopify alternate templates
au BufNewFile,BufRead */templates/**.liquid,*/layout/**.liquid,*/snippets/**.liquid
au BufNewFile,BufRead */{templates,layout,snippets,sections}/**.liquid
\ let b:liquid_subtype = 'html' |
\ set ft=liquid |
2 changes: 1 addition & 1 deletion ftplugin/liquid.vim
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ if has('gui_win32')
endif

if exists('loaded_matchit')
let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,\<\(capture\|comment\|highlight\)\>:\<end\1\>'
let b:match_words .= '\<\%(if\w*\|unless\|case\)\>:\<\%(elsif\|else\|when\)\>:\<end\%(if\w*\|unless\|case\)\>,\<\%(for\|tablerow\)\>:\%({%\s*\)\@<=empty\>:\<end\%(for\|tablerow\)\>,\<\(capture\|comment\|highlight\|schema\|style\)\>:\<end\1\>'
endif

setlocal commentstring={%\ comment\ %}%s{%\ endcomment\ %}
Expand Down
9 changes: 9 additions & 0 deletions syntax/liquid.vim
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ syn region liquidExpression matchgroup=liquidDelimiter start="{{-\=" end="-\=}}
syn region liquidComment matchgroup=liquidDelimiter start="{%-\=\s*comment\s*-\=%}" end="{%-\=\s*endcomment\s*-\=%}" contains=liquidTodo,@Spell containedin=ALLBUT,@liquidExempt keepend
syn region liquidRaw matchgroup=liquidDelimiter start="{%-\=\s*raw\s*-\=%}" end="{%-\=\s*endraw\s*-\=%}" contains=TOP,@liquidExempt containedin=ALLBUT,@liquidExempt keepend

if exists('b:liquid_subtype') && b:liquid_subtype ==# 'html'
syn include @JSON syntax/json.vim
unlet! b:current_syntax
syn include @CSS syntax/css.vim
unlet! b:current_syntax
syn region liquidJson matchgroup=liquidDelimiter start="{%\s*schema\s*%}" end="{%\s*endschema\s*%}" contains=@JSON keepend
syn region liquidCss matchgroup=liquidDelimiter start="{%\s*style\s*%}" end="{%\s*endstyle\s*%}" contains=@CSS keepend
end

syn cluster liquidExempt contains=liquidStatement,liquidExpression,liquidComment,liquidRaw,@liquidStatement,liquidYamlHead
syn cluster liquidStatement contains=liquidConditional,liquidRepeat,liquidKeyword,@liquidExpression
syn cluster liquidExpression contains=liquidOperator,liquidString,liquidNumber,liquidFloat,liquidBoolean,liquidNull,liquidEmpty,liquidPipe,liquidForloop
Expand Down