From a277a07366995e48d578e070b6c4d3b865d64758 Mon Sep 17 00:00:00 2001 From: jingyuexing Date: Fri, 24 Sep 2021 12:37:03 +0800 Subject: [PATCH] * Add GraphQL.js syntax * Add GraphQL.re syntax * Add GraphQL.rescript syntax --- GraphQL.js.sublime-syntax | 39 +++++++++++ GraphQL.js.tmLanguage | 111 ++++++++++++++++++++++++++++++++ GraphQL.re.sublime-syntax | 31 +++++++++ GraphQL.re.tmLanguage | 72 +++++++++++++++++++++ GraphQL.rescript.sublime-syntax | 27 ++++++++ GraphQL.rescript.tmlanguage | 57 ++++++++++++++++ 6 files changed, 337 insertions(+) create mode 100644 GraphQL.js.sublime-syntax create mode 100644 GraphQL.js.tmLanguage create mode 100644 GraphQL.re.sublime-syntax create mode 100644 GraphQL.re.tmLanguage create mode 100644 GraphQL.rescript.sublime-syntax create mode 100644 GraphQL.rescript.tmlanguage diff --git a/GraphQL.js.sublime-syntax b/GraphQL.js.sublime-syntax new file mode 100644 index 0000000..acb7ea8 --- /dev/null +++ b/GraphQL.js.sublime-syntax @@ -0,0 +1,39 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +file_extensions: + - js + - jsx + - ts + - tsx + - vue + - svelte +scope: inline.graphql +contexts: + main: + - match: \s*+(?:(?:(Relay)\??\.)(QL)|(gql|graphql|graphql\.experimental)|(/\* GraphQL \*/))\s*(`) + captures: + 1: variable.other.class.js + 2: entity.name.function.tagged-template.js + 3: entity.name.function.tagged-template.js + 4: comment.graphql.js + 5: punctuation.definition.string.template.begin.js + push: + - meta_content_scope: meta.embedded.block.graphql + - match: '`' + captures: + 0: punctuation.definition.string.template.end.js + pop: true + - include: scope:source.graphql + - match: (`)(#graphql) + captures: + 1: punctuation.definition.string.template.begin.js + 2: comment.line.graphql.js + push: + - meta_scope: taggedTemplates + - meta_content_scope: meta.embedded.block.graphql + - match: '`' + captures: + 0: punctuation.definition.string.template.end.js + pop: true + - include: scope:source.graphql diff --git a/GraphQL.js.tmLanguage b/GraphQL.js.tmLanguage new file mode 100644 index 0000000..a2721c2 --- /dev/null +++ b/GraphQL.js.tmLanguage @@ -0,0 +1,111 @@ + + + + + fileTypes + + js + jsx + ts + tsx + vue + svelte + + injectionSelector + L:source -string -comment + patterns + + + begin + \s*+(?:(?:(Relay)\??\.)(QL)|(gql|graphql|graphql\.experimental)|(/\* GraphQL \*/))\s*(`) + beginCaptures + + 1 + + name + variable.other.class.js + + 2 + + name + entity.name.function.tagged-template.js + + 3 + + name + entity.name.function.tagged-template.js + + 4 + + name + comment.graphql.js + + 5 + + name + punctuation.definition.string.template.begin.js + + + contentName + meta.embedded.block.graphql + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.template.end.js + + + patterns + + + include + source.graphql + + + + + begin + (`)(#graphql) + beginCaptures + + 1 + + name + punctuation.definition.string.template.begin.js + + 2 + + name + comment.line.graphql.js + + + contentName + meta.embedded.block.graphql + end + ` + endCaptures + + 0 + + name + punctuation.definition.string.template.end.js + + + name + taggedTemplates + patterns + + + include + source.graphql + + + + + scopeName + inline.graphql + + diff --git a/GraphQL.re.sublime-syntax b/GraphQL.re.sublime-syntax new file mode 100644 index 0000000..d6c5858 --- /dev/null +++ b/GraphQL.re.sublime-syntax @@ -0,0 +1,31 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html +file_extensions: + - re + - ml +scope: inline.graphql.re +contexts: + main: + - match: '(\{)(gql)(\|)' + push: + - meta_content_scope: meta.embedded.block.graphql + - match: '(\|)(\2)(\})' + pop: true + - include: scope:source.graphql + - match: '(\[%graphql)s*$' + push: + - meta_content_scope: meta.embedded.block.graphql + - match: '(?<=\])' + pop: true + - match: '^\s*({\|)$' + push: + - match: '^\s*(\|})' + pop: true + - include: scope:source.graphql + - match: '(\[%graphql \{\|)' + push: + - meta_content_scope: meta.embedded.block.graphql + - match: '(\|\}( )?\])' + pop: true + - include: scope:source.graphql diff --git a/GraphQL.re.tmLanguage b/GraphQL.re.tmLanguage new file mode 100644 index 0000000..f48919a --- /dev/null +++ b/GraphQL.re.tmLanguage @@ -0,0 +1,72 @@ + + + + + fileTypes + + re + ml + + injectionSelector + L:source -string -comment + patterns + + + begin + ({)(gql)(\|) + contentName + meta.embedded.block.graphql + end + (\|)(\2)(}) + patterns + + + include + source.graphql + + + + + begin + (\[%graphql)s*$ + contentName + meta.embedded.block.graphql + end + (?<=]) + patterns + + + begin + ^\s*({\|)$ + end + ^\s*(\|}) + patterns + + + include + source.graphql + + + + + + + begin + (\[%graphql {\|) + contentName + meta.embedded.block.graphql + end + (\|}( )?]) + patterns + + + include + source.graphql + + + + + scopeName + inline.graphql.re + + diff --git a/GraphQL.rescript.sublime-syntax b/GraphQL.rescript.sublime-syntax new file mode 100644 index 0000000..400106e --- /dev/null +++ b/GraphQL.rescript.sublime-syntax @@ -0,0 +1,27 @@ +%YAML 1.2 +--- +# http://www.sublimetext.com/docs/3/syntax.html + +file_extensions: + - res + - resi +scope: inline.graphql.res +contexts: + main: + - match: (%graphql\()\s*$ + push: + - meta_content_scope: meta.embedded.block.graphql + - match: (?<=\)) + pop: true + - match: '^\s*(`)$' + push: + - match: '^\s*(`)' + pop: true + - include: scope:source.graphql + - match: '(%graphql\(`)' + push: + - meta_content_scope: meta.embedded.block.graphql + - match: (\`\s?\)) + pop: true + - include: scope:source.graphql + # injectionSelector: L:source -string -comment \ No newline at end of file diff --git a/GraphQL.rescript.tmlanguage b/GraphQL.rescript.tmlanguage new file mode 100644 index 0000000..dee75a2 --- /dev/null +++ b/GraphQL.rescript.tmlanguage @@ -0,0 +1,57 @@ + + + + + fileTypes + + res + resi + + injectionSelector + L:source -string -comment + patterns + + + begin + (%graphql\()\s*$ + contentName + meta.embedded.block.graphql + end + (?<=\)) + patterns + + + begin + ^\s*(`)$ + end + ^\s*(`) + patterns + + + include + source.graphql + + + + + + + begin + (%graphql\(`) + contentName + meta.embedded.block.graphql + end + (\`( )?\)) + patterns + + + include + source.graphql + + + + + scopeName + inline.graphql.res + +