vim-liquid icon indicating copy to clipboard operation
vim-liquid copied to clipboard

Add support for the schema tag

Open eloyesp opened this issue 4 years ago • 10 comments

Implement the changes from #16 to have syntax highlighting on section schema.

eloyesp avatar Nov 09 '21 21:11 eloyesp

Been on the fence about this proprietary extension but I guess it's been requested enough that I'll go for it. Let's rename the group to @liquidJson.

tpope avatar Nov 10 '21 18:11 tpope

May be we can add this conditionally, only when the file matches "sections/*.liquid" making something like a subtype, but I'm not sure how to implement that and not sure if it's worth the effort.

There are other two special tags for JavaScript and stylesheet that, while are not as important (rarely used), could also have special syntax highlighting.

Just mention to check your thoughts on those ideas...

eloyesp avatar Nov 10 '21 19:11 eloyesp

Wrap those in a if b:liquid_subtype ==# 'html' and it's probably fine, as CSS and JavaScript syntax highlighting already gets indirectly loaded in that case anyways. Are they also Shopify specific?

tpope avatar Nov 10 '21 19:11 tpope

Just wanted to note that I've not forgot about this, but have problems finding the time... will work on this ASAP :)

eloyesp avatar Nov 23 '21 13:11 eloyesp

Ok it is working.

I were trying to make matchit work, but it seems that I'm missing something, it does work with if, for, etc, but not with capture or style or schema.

Also, the indentation of JSON or CSS sections does not work and could not make it work as expected (using =).

eloyesp avatar Nov 27 '21 05:11 eloyesp

Is this what you're missing? https://github.com/tpope/vim-liquid/blob/dd5243a34e97c15e1a128b6ec440a0368e583900/ftplugin/liquid.vim#L56

tpope avatar Nov 28 '21 19:11 tpope

Yes, but I could not get it working... (Even the capture:endcapture is not working... )

eloyesp avatar Nov 28 '21 20:11 eloyesp

Looks like a \ was missing. I fixed it.

tpope avatar Nov 28 '21 21:11 tpope

I think keywords like schema should be highlighted. This can be implemented the same way as highlight, although untangling how that works might take a bit of doing thanks to the use of :execute.

(Notably, raw and comment are not currently highlighted. I believe my rationale was that these commands don't actually "do" anything, which is a dubious justification and was probably a mistake.)

tpope avatar Nov 30 '21 19:11 tpope

I could not make the schema, endschema, style and endstyle keywords to be highlighted as liquidKeywords, using matchgroup makes the highlight use a single color for the {%- and for the keyword itself, and I cannot make the region skip the start and end itself. Using offsets and crazy patterns should do the trick, but I could not make it work.

Any help is appreciated, I've been fighting with this a lot.

eloyesp avatar Dec 01 '21 05:12 eloyesp