From 8825869f5f14a10d20145606c4dc5326e728119b Mon Sep 17 00:00:00 2001 From: humancopy Date: Thu, 16 Nov 2017 19:33:20 +0100 Subject: [PATCH 1/5] Add support for the new schema tag (and JSON syntax highlight it's contents) --- Snippets/scehma.sublime-snippet | 7 +++++++ Syntaxes/HTML (Liquid).YAML-tmLanguage | 7 ++++--- Syntaxes/HTML (Liquid).tmLanguage | 10 +++++++--- 3 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 Snippets/scehma.sublime-snippet diff --git a/Snippets/scehma.sublime-snippet b/Snippets/scehma.sublime-snippet new file mode 100644 index 0000000..6ef6226 --- /dev/null +++ b/Snippets/scehma.sublime-snippet @@ -0,0 +1,7 @@ + + + + schema + text.html.liquid + schema + \ No newline at end of file diff --git a/Syntaxes/HTML (Liquid).YAML-tmLanguage b/Syntaxes/HTML (Liquid).YAML-tmLanguage index 81a4750..26958aa 100644 --- a/Syntaxes/HTML (Liquid).YAML-tmLanguage +++ b/Syntaxes/HTML (Liquid).YAML-tmLanguage @@ -23,6 +23,7 @@ patterns: - include: '#template_var' - include: text.html.basic +- include: source.json repository: assign_op: @@ -83,7 +84,7 @@ repository: - name: constant.numeric.liquid match: (-|\+)?\s*[0-9]+(\.[0-9]+)? - name: support.class.liquid - match: \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings)\b + match: \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema)\b - name: support.class.liquid match: \b(assets|author|body|body_raw|current|date|excerpt_raw|meta|next|pages|parent|posts|previous|site|tags|taxonomy|title|url)\b - name: variable.parameter.liquid @@ -92,5 +93,5 @@ repository: match: (?<=\.)\w+\b - name: variable.other.liquid match: \w+ -foldingStartMarker: (?x){%\s*(if|unless|for|paginate|capture|form|case|tablerow|raw|comment)[^(%})]+%} -foldingStopMarker: (?x){%\s*(endif|endunless|endfor|endpaginate|endcapture|endform|endcase|endtablerow|endraw|endcomment)[^(%})]+%} +foldingStartMarker: (?x){%\s*(if|unless|for|paginate|capture|form|case|tablerow|raw|comment|schema)[^(%})]+%} +foldingStopMarker: (?x){%\s*(endif|endunless|endfor|endpaginate|endcapture|endform|endcase|endtablerow|endraw|endcomment|endschema)[^(%})]+%} diff --git a/Syntaxes/HTML (Liquid).tmLanguage b/Syntaxes/HTML (Liquid).tmLanguage index 8acd1a6..9c216ed 100644 --- a/Syntaxes/HTML (Liquid).tmLanguage +++ b/Syntaxes/HTML (Liquid).tmLanguage @@ -7,9 +7,9 @@ liquid foldingStartMarker - (?x){%\s*(if|unless|for|paginate|capture|form|case|tablerow|raw|comment)[^(%})]+%} + (?x){%\s*(if|unless|for|paginate|capture|form|case|tablerow|raw|comment|schema)[^(%})]+%} foldingStopMarker - (?x){%\s*(endif|endunless|endfor|endpaginate|endcapture|endform|endcase|endtablerow|endraw|endcomment)[^(%})]+%} + (?x){%\s*(endif|endunless|endfor|endpaginate|endcapture|endform|endcase|endtablerow|endraw|endcomment|endschema)[^(%})]+%} name HTML (Liquid) patterns @@ -60,6 +60,10 @@ include text.html.basic + + include + source.json + repository @@ -240,7 +244,7 @@ match - \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings)\b + \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema)\b name support.class.liquid From 13a482294d9d5a68e8a3033856fbaa598d972473 Mon Sep 17 00:00:00 2001 From: humancopy Date: Fri, 6 Apr 2018 13:21:44 +0200 Subject: [PATCH 2/5] Typo in filename --- Snippets/{scehma.sublime-snippet => schema.sublime-snippet} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Snippets/{scehma.sublime-snippet => schema.sublime-snippet} (100%) diff --git a/Snippets/scehma.sublime-snippet b/Snippets/schema.sublime-snippet similarity index 100% rename from Snippets/scehma.sublime-snippet rename to Snippets/schema.sublime-snippet From d2b635fa6b029a9d05461b0babb49246b58daf68 Mon Sep 17 00:00:00 2001 From: humancopy Date: Fri, 6 Apr 2018 13:23:01 +0200 Subject: [PATCH 3/5] Add endschema --- Snippets/endschema.sublime-snippet | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 Snippets/endschema.sublime-snippet diff --git a/Snippets/endschema.sublime-snippet b/Snippets/endschema.sublime-snippet new file mode 100644 index 0000000..fb0c4ea --- /dev/null +++ b/Snippets/endschema.sublime-snippet @@ -0,0 +1,7 @@ + + + + endschema + text.html.liquid + endschema + \ No newline at end of file From f3ce7b5e8621736a7904f6900c5a73d459b1a69e Mon Sep 17 00:00:00 2001 From: humancopy Date: Fri, 6 Apr 2018 13:56:20 +0200 Subject: [PATCH 4/5] Convert to sublime-syntax --- HTML (Liquid).sublime-syntax | 93 ++++++++ Syntaxes/HTML (Liquid).YAML-tmLanguage | 97 --------- Syntaxes/HTML (Liquid).tmLanguage | 283 ------------------------- 3 files changed, 93 insertions(+), 380 deletions(-) create mode 100644 HTML (Liquid).sublime-syntax delete mode 100644 Syntaxes/HTML (Liquid).YAML-tmLanguage delete mode 100644 Syntaxes/HTML (Liquid).tmLanguage diff --git a/HTML (Liquid).sublime-syntax b/HTML (Liquid).sublime-syntax new file mode 100644 index 0000000..6a9948a --- /dev/null +++ b/HTML (Liquid).sublime-syntax @@ -0,0 +1,93 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +name: HTML (Liquid) +file_extensions: + - liquid +scope: text.html.liquid +contexts: + main: + - match: '{%-?\s*comment\s*-?%}' + push: + - meta_scope: comment.block.liquid + - match: '{%-?\s*endcomment\s*-?%}' + pop: true + - match: "{{-?" + push: + - meta_scope: punctuation.output.liquid + - match: "-?}}" + pop: true + - include: template_var + - match: "{%-?" + push: + - meta_scope: punctuation.tag.liquid + - match: "-?%}" + pop: true + - include: template_tag_name + - include: template_var + - include: scope:text.html.basic + - include: scope:source.json + assign_op: + - match: /= + scope: keyword.operator.assignment.augmented.liquid + logic_expression: + - match: /= + scope: keyword.operator.assignment.augmented.liquid + logic_op: + - match: \s+(and|or|not|contains|(\!\=|\=\=|<\=|>\=|<|>)\s+ + scope: keyword.operator.logical.liquid + template_tag_name: + - match: '(?<={%)\s*(\w+)' + scope: entity.name.tag.liquid + - match: '(?<={%-)\s*(\w+)' + scope: entity.name.tag.liquid + template_var: + - match: '(\[)(\|)(?=[^\]]*)(?=\])' + captures: + 2: invalid.illegal.filter.liquid + 3: invalid.illegal.filter.liquid + - match: (?<=\s)(\+|\-|\/|\*)(?=\s) + scope: invalid.illegal.filter.liquid + - match: (false|true|nil) + scope: constant.language.liquid + - match: '(?=if|unless|elsif)\s*[^%}]+\s(in)\s' + captures: + 3: invalid.illegal.operator.liquid + - match: \s+(and|or|not|contains|in|by|((\!|\=|\<|\>)\=))\s+ + scope: keyword.operator.liquid + - match: '(?<=assign)([^\=]+)(\=\=+)' + captures: + 2: invalid.illegal.assignment.liquid + - match: '\|\s+(?![\.0-9])[a-zA-Z0-9_-]+\:\s+' + scope: support.function.with-args.liquid + - match: '\|\s+(?![\.0-9])[a-zA-Z0-9_-]+\s+' + scope: support.function.without-args.liquid + - match: (?<=\s)(with|offset\:|limit\:)(?=\s) + scope: keyword.control.liquid + - match: (?<=include)(.*)(with\:|offset|limit)(?=\s) + captures: + 2: invalid.illegal.argument.liquid + - match: (?<=\s)(\w+\:)(?=\:\s) + scope: invalid.illegal.liquid + - match: '"' + push: + - meta_scope: string.quoted.double.liquid + - match: '"' + pop: true + - match: "'" + push: + - meta_scope: string.quoted.single.liquid + - match: "'" + pop: true + - match: '(-|\+)?\s*[0-9]+(\.[0-9]+)?' + scope: constant.numeric.liquid + - match: \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema)\b + scope: support.class.liquid + - match: \b(assets|author|body|body_raw|current|date|excerpt_raw|meta|next|pages|parent|posts|previous|site|tags|taxonomy|title|url)\b + scope: support.class.liquid + - match: ((?<=\w\:\s)\w+) + scope: variable.parameter.liquid + - match: (?<=\.)\w+\b + scope: support.variable.liquid + - match: \w+ + scope: variable.other.liquid diff --git a/Syntaxes/HTML (Liquid).YAML-tmLanguage b/Syntaxes/HTML (Liquid).YAML-tmLanguage deleted file mode 100644 index 26958aa..0000000 --- a/Syntaxes/HTML (Liquid).YAML-tmLanguage +++ /dev/null @@ -1,97 +0,0 @@ -# [PackageDev] target_format: plist, ext: tmLanguage -name: HTML (Liquid) -scopeName: text.html.liquid -fileTypes: [liquid] -uuid: f2a39460-98fd-11e1-a8b0-0800200c9a66 - -patterns: -- name: comment.block.liquid - begin: '{%-?\s*comment\s*-?%}' - end: '{%-?\s*endcomment\s*-?%}' - -- name: punctuation.output.liquid - begin: '{{-?' - end: '-?}}' - patterns: - - include: '#template_var' - -- name: punctuation.tag.liquid - begin: '{%-?' - end: '-?%}' - patterns: - - include: '#template_tag_name' - - include: '#template_var' - -- include: text.html.basic -- include: source.json - -repository: - assign_op: - patterns: - - name: keyword.operator.assignment.augmented.liquid - match: /= - - logic_expression: - patterns: - - match: /= - name: keyword.operator.assignment.augmented.liquid - - logic_op: - patterns: - - name: keyword.operator.logical.liquid - match: \s+(and|or|not|contains|(\!\=|\=\=|<\=|>\=|<|>)\s+ - template_tag_name: - patterns: - - name: entity.name.tag.liquid - match: (?<={%)\s*(\w+) - - name: entity.name.tag.liquid - match: (?<={%-)\s*(\w+) - template_var: - patterns: - - match: (\[)(\|)(?=[^\]]*)(?=\]) - captures: - '2': {name: invalid.illegal.filter.liquid} - '3': {name: invalid.illegal.filter.liquid} - - name: invalid.illegal.filter.liquid - match: (?<=\s)(\+|\-|\/|\*)(?=\s) - - name: constant.language.liquid - match: (false|true|nil) - - match: (?=if|unless|elsif)\s*[^%}]+\s(in)\s - captures: - '3': {name: invalid.illegal.operator.liquid} - - name: keyword.operator.liquid - match: \s+(and|or|not|contains|in|by|((\!|\=|\<|\>)\=))\s+ - - match: (?<=assign)([^\=]+)(\=\=+) - captures: - '2': {name: invalid.illegal.assignment.liquid} - - name: support.function.with-args.liquid - match: \|\s+(?![\.0-9])[a-zA-Z0-9_-]+\:\s+ - - name: support.function.without-args.liquid - match: \|\s+(?![\.0-9])[a-zA-Z0-9_-]+\s+ - - name: keyword.control.liquid - match: (?<=\s)(with|offset\:|limit\:)(?=\s) - - match: (?<=include)(.*)(with\:|offset|limit)(?=\s) - captures: - '2': {name: invalid.illegal.argument.liquid} - - name: invalid.illegal.liquid - match: (?<=\s)(\w+\:)(?=\:\s) - - name: string.quoted.double.liquid - begin: '"' - end: '"' - - name: string.quoted.single.liquid - begin: '''' - end: '''' - - name: constant.numeric.liquid - match: (-|\+)?\s*[0-9]+(\.[0-9]+)? - - name: support.class.liquid - match: \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema)\b - - name: support.class.liquid - match: \b(assets|author|body|body_raw|current|date|excerpt_raw|meta|next|pages|parent|posts|previous|site|tags|taxonomy|title|url)\b - - name: variable.parameter.liquid - match: ((?<=\w\:\s)\w+) - - name: support.variable.liquid - match: (?<=\.)\w+\b - - name: variable.other.liquid - match: \w+ -foldingStartMarker: (?x){%\s*(if|unless|for|paginate|capture|form|case|tablerow|raw|comment|schema)[^(%})]+%} -foldingStopMarker: (?x){%\s*(endif|endunless|endfor|endpaginate|endcapture|endform|endcase|endtablerow|endraw|endcomment|endschema)[^(%})]+%} diff --git a/Syntaxes/HTML (Liquid).tmLanguage b/Syntaxes/HTML (Liquid).tmLanguage deleted file mode 100644 index 9c216ed..0000000 --- a/Syntaxes/HTML (Liquid).tmLanguage +++ /dev/null @@ -1,283 +0,0 @@ - - - - - fileTypes - - liquid - - foldingStartMarker - (?x){%\s*(if|unless|for|paginate|capture|form|case|tablerow|raw|comment|schema)[^(%})]+%} - foldingStopMarker - (?x){%\s*(endif|endunless|endfor|endpaginate|endcapture|endform|endcase|endtablerow|endraw|endcomment|endschema)[^(%})]+%} - name - HTML (Liquid) - patterns - - - begin - {%-?\s*comment\s*-?%} - end - {%-?\s*endcomment\s*-?%} - name - comment.block.liquid - - - begin - {{-? - end - -?}} - name - punctuation.output.liquid - patterns - - - include - #template_var - - - - - begin - {%-? - end - -?%} - name - punctuation.tag.liquid - patterns - - - include - #template_tag_name - - - include - #template_var - - - - - include - text.html.basic - - - include - source.json - - - repository - - assign_op - - patterns - - - match - /= - name - keyword.operator.assignment.augmented.liquid - - - - logic_expression - - patterns - - - match - /= - name - keyword.operator.assignment.augmented.liquid - - - - logic_op - - patterns - - - match - \s+(and|or|not|contains|(\!\=|\=\=|<\=|>\=|<|>)\s+ - name - keyword.operator.logical.liquid - - - - template_tag_name - - patterns - - - match - (?<={%)\s*(\w+) - name - entity.name.tag.liquid - - - match - (?<={%-)\s*(\w+) - name - entity.name.tag.liquid - - - - template_var - - patterns - - - captures - - 2 - - name - invalid.illegal.filter.liquid - - 3 - - name - invalid.illegal.filter.liquid - - - match - (\[)(\|)(?=[^\]]*)(?=\]) - - - match - (?<=\s)(\+|\-|\/|\*)(?=\s) - name - invalid.illegal.filter.liquid - - - match - (false|true|nil) - name - constant.language.liquid - - - captures - - 3 - - name - invalid.illegal.operator.liquid - - - match - (?=if|unless|elsif)\s*[^%}]+\s(in)\s - - - match - \s+(and|or|not|contains|in|by|((\!|\=|\<|\>)\=))\s+ - name - keyword.operator.liquid - - - captures - - 2 - - name - invalid.illegal.assignment.liquid - - - match - (?<=assign)([^\=]+)(\=\=+) - - - match - \|\s+(?![\.0-9])[a-zA-Z0-9_-]+\:\s+ - name - support.function.with-args.liquid - - - match - \|\s+(?![\.0-9])[a-zA-Z0-9_-]+\s+ - name - support.function.without-args.liquid - - - match - (?<=\s)(with|offset\:|limit\:)(?=\s) - name - keyword.control.liquid - - - captures - - 2 - - name - invalid.illegal.argument.liquid - - - match - (?<=include)(.*)(with\:|offset|limit)(?=\s) - - - match - (?<=\s)(\w+\:)(?=\:\s) - name - invalid.illegal.liquid - - - begin - " - end - " - name - string.quoted.double.liquid - - - begin - ' - end - ' - name - string.quoted.single.liquid - - - match - (-|\+)?\s*[0-9]+(\.[0-9]+)? - name - constant.numeric.liquid - - - match - \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema)\b - name - support.class.liquid - - - match - \b(assets|author|body|body_raw|current|date|excerpt_raw|meta|next|pages|parent|posts|previous|site|tags|taxonomy|title|url)\b - name - support.class.liquid - - - match - ((?<=\w\:\s)\w+) - name - variable.parameter.liquid - - - match - (?<=\.)\w+\b - name - support.variable.liquid - - - match - \w+ - name - variable.other.liquid - - - - - scopeName - text.html.liquid - uuid - f2a39460-98fd-11e1-a8b0-0800200c9a66 - - From 6a264e456fc19320f280c737e97e0258598037c6 Mon Sep 17 00:00:00 2001 From: humancopy Date: Fri, 6 Apr 2018 14:01:52 +0200 Subject: [PATCH 5/5] Add support to new javascript and stylesheet --- HTML (Liquid).sublime-syntax | 4 +++- Snippets/endjavascript.sublime-snippet | 7 +++++++ Snippets/endstylesheet.sublime-snippet | 7 +++++++ Snippets/javascript.sublime-snippet | 7 +++++++ Snippets/stylesheet.sublime-snippet | 7 +++++++ 5 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Snippets/endjavascript.sublime-snippet create mode 100644 Snippets/endstylesheet.sublime-snippet create mode 100644 Snippets/javascript.sublime-snippet create mode 100644 Snippets/stylesheet.sublime-snippet diff --git a/HTML (Liquid).sublime-syntax b/HTML (Liquid).sublime-syntax index 6a9948a..1e17370 100644 --- a/HTML (Liquid).sublime-syntax +++ b/HTML (Liquid).sublime-syntax @@ -27,6 +27,8 @@ contexts: - include: template_var - include: scope:text.html.basic - include: scope:source.json + - include: scope:source.js + - include: scope:source.css assign_op: - match: /= scope: keyword.operator.assignment.augmented.liquid @@ -81,7 +83,7 @@ contexts: pop: true - match: '(-|\+)?\s*[0-9]+(\.[0-9]+)?' scope: constant.numeric.liquid - - match: \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema)\b + - match: \b(collection|product|linklist|linklists|order|link|customer|customer_address|line_item|shop|collections|page_title|template|image|blog|blogs|cart|pages|theme|themes|variant|items|comment|forloop|settings|schema|javascript|stylesheet)\b scope: support.class.liquid - match: \b(assets|author|body|body_raw|current|date|excerpt_raw|meta|next|pages|parent|posts|previous|site|tags|taxonomy|title|url)\b scope: support.class.liquid diff --git a/Snippets/endjavascript.sublime-snippet b/Snippets/endjavascript.sublime-snippet new file mode 100644 index 0000000..9f78a3a --- /dev/null +++ b/Snippets/endjavascript.sublime-snippet @@ -0,0 +1,7 @@ + + + + endjavascript + text.html.liquid + endjavascript + \ No newline at end of file diff --git a/Snippets/endstylesheet.sublime-snippet b/Snippets/endstylesheet.sublime-snippet new file mode 100644 index 0000000..a4eef8c --- /dev/null +++ b/Snippets/endstylesheet.sublime-snippet @@ -0,0 +1,7 @@ + + + + endstylesheet + text.html.liquid + endstylesheet + \ No newline at end of file diff --git a/Snippets/javascript.sublime-snippet b/Snippets/javascript.sublime-snippet new file mode 100644 index 0000000..fbb411b --- /dev/null +++ b/Snippets/javascript.sublime-snippet @@ -0,0 +1,7 @@ + + + + javascript + text.html.liquid + javascript + \ No newline at end of file diff --git a/Snippets/stylesheet.sublime-snippet b/Snippets/stylesheet.sublime-snippet new file mode 100644 index 0000000..76c2208 --- /dev/null +++ b/Snippets/stylesheet.sublime-snippet @@ -0,0 +1,7 @@ + + + + stylesheet + text.html.liquid + stylesheet + \ No newline at end of file