From e8eae5406b74d97c698782793faf02bddd40294d Mon Sep 17 00:00:00 2001 From: Alexandre Borela Date: Wed, 25 Oct 2017 08:56:33 -0200 Subject: [PATCH] Add jest snapshot syntax --- syntaxes/jsnap1/root-value.sublime-syntax | 46 +++++++++++++++++++++++ syntaxes/naomi.fjsnap1.sublime-syntax | 26 +++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 syntaxes/jsnap1/root-value.sublime-syntax create mode 100644 syntaxes/naomi.fjsnap1.sublime-syntax diff --git a/syntaxes/jsnap1/root-value.sublime-syntax b/syntaxes/jsnap1/root-value.sublime-syntax new file mode 100644 index 00000000..8eeb0cb8 --- /dev/null +++ b/syntaxes/jsnap1/root-value.sublime-syntax @@ -0,0 +1,46 @@ +%YAML1.2 +--- + +# Licensed under the Apache License, Version 2.0 (the “License”); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +hidden: true + +scope: ... + +contexts: + main: + - match: | + (?x) + \s*(=)\s*(`) + captures: + 1: keyword.operator.assignment.js.fjsx15 + 2: >- + string.template.js.fjsx15 + punctuation.definition.string.begin.js.fjsx15 + set: value-contents + + value-contents: + - meta_scope: string.template.js.fjsx15 + - match: | + (?x) + \s*(`) + captures: + 1: >- + string.template.js.fjsx15 + punctuation.definition.string.end.js.fjsx15 + pop: true + - match: "" + push: + - include: Packages/Naomi/syntaxes/fjsx15/jsx1.sublime-syntax + - match: "" + pop: true diff --git a/syntaxes/naomi.fjsnap1.sublime-syntax b/syntaxes/naomi.fjsnap1.sublime-syntax new file mode 100644 index 00000000..0325f679 --- /dev/null +++ b/syntaxes/naomi.fjsnap1.sublime-syntax @@ -0,0 +1,26 @@ +%YAML1.2 +--- + +# Licensed under the Apache License, Version 2.0 (the “License”); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an “AS IS” BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +name: Jest Snapshot + +file_extensions: + - js.snap + +scope: source.js.fjsx15 + +contexts: + main: + - include: Packages/Naomi/syntaxes/jsnap1/root-value.sublime-syntax + - include: Packages/Naomi/syntaxes/fjsx15/statement-and-expression.sublime-syntax