diff --git a/JSON/JSON (Basic).sublime-syntax b/JSON/JSON (Basic).sublime-syntax index b96796122d4..0193a607530 100644 --- a/JSON/JSON (Basic).sublime-syntax +++ b/JSON/JSON (Basic).sublime-syntax @@ -1,9 +1,14 @@ %YAML 1.2 --- -# https://yaml.org/spec/1.2/spec.html -# https://www.sublimetext.com/docs/syntax.html#ver-dev -# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev -# https://www.sublimetext.com/docs/scope_naming.html +# YAML Documentation: +# https://yaml.org/spec/1.2/spec.html +# Sublime Text Documentation: +# https://www.sublimetext.com/docs/syntax.html#ver-dev +# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev +# https://www.sublimetext.com/docs/scope_naming.html +# This file is being maintained at: +# https://github.com/sublimehq/Packages/blob/master/JSON/JSON%20(Basic).sublime-syntax +# name: JSON (Basic) scope: source.json.basic version: 2 @@ -24,6 +29,10 @@ contexts: - match: '(?=\S)' push: top-level-expect-object +####[ Top level ]####################################################################################################### + + # Try these below one-by-one. + top-level-expect-object: - include: top-level-objects - match: '' @@ -57,6 +66,8 @@ contexts: - match: '\S*' scope: invalid.illegal.unexpected-code-after-first-structure-or-value.json +####[ Structural helpers ]############################################################################################## + any: - include: structures - include: values @@ -70,46 +81,52 @@ contexts: - include: numbers - include: strings +####[ Helpers ]######################################################################################################### + eol-pop: - match: '$\n?' pop: 1 - ####[ Comments ]######################################################################################################## comments: + - meta_include_prototype: false - include: comment-line - include: comment-doc-block - include: comment-block comment-line: + - meta_include_prototype: false - match: '//' scope: invalid.illegal.comment.json push: - - meta_content_scope: invalid.illegal.comment.json - meta_include_prototype: false + - meta_content_scope: invalid.illegal.comment.json - include: eol-pop comment-doc-block: + - meta_include_prototype: false - match: '/\*\*(?!/)' scope: invalid.illegal.comment.json push: - - meta_content_scope: invalid.illegal.comment.json - meta_include_prototype: false + - meta_content_scope: invalid.illegal.comment.json - include: comment-block-end - match: '^\s*(\*)(?!/)' captures: 1: invalid.illegal.comment.json comment-block: + - meta_include_prototype: false - match: '/\*' scope: invalid.illegal.comment.json push: - - meta_content_scope: invalid.illegal.comment.json - meta_include_prototype: false + - meta_content_scope: invalid.illegal.comment.json - include: comment-block-end comment-block-end: + - meta_include_prototype: false - match: '\*/' scope: invalid.illegal.comment.json pop: 1 @@ -121,7 +138,7 @@ contexts: scope: constant.language.null.json - match: \b(?:false|true)\b scope: constant.language.boolean.json - # when for example typing "Null" or "NULL" instead of "null" + # when erroneously containing upper case letters - match: \b(?i:null)\b scope: invalid.illegal.expected-lower-case-null.json - match: \b(?i:false|true)\b @@ -190,15 +207,18 @@ contexts: pop: 1 double-quoted-string-escape-characters: + - meta_include_prototype: false - match: \\\" scope: constant.character.escape.double-quote.json - include: string-escape-characters string-escape-characters: + - meta_include_prototype: false - include: valid-string-escape-characters - include: invalid-string-escape-characters valid-string-escape-characters: + - meta_include_prototype: false - match: \\\\ scope: constant.character.escape.back-slash.json - match: \\\/ @@ -217,6 +237,7 @@ contexts: scope: constant.character.escape.unicode-symbol.basic-multilingual-plane.json invalid-string-escape-characters: + - meta_include_prototype: false - match: \\. scope: invalid.illegal.unrecognized-string-escape.json @@ -329,14 +350,14 @@ contexts: top-level-mapping-key-double-quoted: - clear_scopes: 1 - - meta_scope: meta.mapping.key.json meta.toc-list.json meta.string.json string.quoted.double.json - meta_include_prototype: false + - meta_scope: meta.mapping.key.json meta.toc-list.json meta.string.json string.quoted.double.json - include: inside-double-quoted-string mapping-key-double-quoted: - clear_scopes: 1 - - meta_scope: meta.mapping.key.json meta.string.json string.quoted.double.json - meta_include_prototype: false + - meta_scope: meta.mapping.key.json meta.string.json string.quoted.double.json - include: inside-double-quoted-string mapping-separator: diff --git a/JSON/JSON.sublime-syntax b/JSON/JSON.sublime-syntax index bc9f7f4ccfa..4a22df01446 100644 --- a/JSON/JSON.sublime-syntax +++ b/JSON/JSON.sublime-syntax @@ -1,9 +1,14 @@ %YAML 1.2 --- -# https://yaml.org/spec/1.2/spec.html -# https://www.sublimetext.com/docs/syntax.html#ver-dev -# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev -# https://www.sublimetext.com/docs/scope_naming.html +# YAML Documentation: +# https://yaml.org/spec/1.2/spec.html +# Sublime Text Documentation: +# https://www.sublimetext.com/docs/syntax.html#ver-dev +# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev +# https://www.sublimetext.com/docs/scope_naming.html +# This file is being maintained at: +# https://github.com/sublimehq/Packages/blob/master/JSON/JSON.sublime-syntax +# name: JSON scope: source.json version: 2 diff --git a/JSON/JSON5.sublime-syntax b/JSON/JSON5.sublime-syntax index e2d0d628c84..4df096a9935 100644 --- a/JSON/JSON5.sublime-syntax +++ b/JSON/JSON5.sublime-syntax @@ -1,9 +1,14 @@ %YAML 1.2 --- -# https://yaml.org/spec/1.2/spec.html -# https://www.sublimetext.com/docs/syntax.html#ver-dev -# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev -# https://www.sublimetext.com/docs/scope_naming.html +# YAML Documentation: +# https://yaml.org/spec/1.2/spec.html +# Sublime Text Documentation: +# https://www.sublimetext.com/docs/syntax.html#ver-dev +# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev +# https://www.sublimetext.com/docs/scope_naming.html +# This file is being maintained at: +# https://github.com/sublimehq/Packages/blob/master/JSON/JSON5.sublime-syntax +# name: JSON5 scope: source.json.json5 version: 2 @@ -141,6 +146,7 @@ contexts: pop: 1 single-quoted-string-escape-characters: + - meta_include_prototype: false - match: \\\' scope: constant.character.escape.single-quote.json5 - include: string-escape-characters @@ -193,13 +199,13 @@ contexts: top-level-mapping-key-ecma: - clear_scopes: 1 - match: '{{identifier_name}}' - scope: meta.mapping.key.json5 meta.toc-list.json5 + scope: meta.mapping.key.json5 meta.toc-list.json5 meta.string.json5 string.unquoted.plain.json5 pop: 1 top-level-mapping-key-single-quoted: - clear_scopes: 1 - - meta_scope: meta.mapping.key.json5 meta.toc-list.json5 meta.string.json5 string.quoted.single.json5 - meta_include_prototype: false + - meta_scope: meta.mapping.key.json5 meta.toc-list.json5 meta.string.json5 string.quoted.single.json5 - include: inside-single-quoted-string mapping-key: @@ -213,11 +219,11 @@ contexts: mapping-key-ecma: - clear_scopes: 1 - match: '{{identifier_name}}' - scope: meta.mapping.key.json5 + scope: meta.mapping.key.json5 meta.string.json5 string.unquoted.plain.json5 pop: 1 mapping-key-single-quoted: - clear_scopes: 1 - - meta_scope: meta.mapping.key.json5 meta.string.json5 string.quoted.single.json5 - meta_include_prototype: false + - meta_scope: meta.mapping.key.json5 meta.string.json5 string.quoted.single.json5 - include: inside-single-quoted-string diff --git a/JSON/JSONC.sublime-syntax b/JSON/JSONC.sublime-syntax index f6bcdf17e39..94aa48201f1 100644 --- a/JSON/JSONC.sublime-syntax +++ b/JSON/JSONC.sublime-syntax @@ -1,9 +1,14 @@ %YAML 1.2 --- -# https://yaml.org/spec/1.2/spec.html -# https://www.sublimetext.com/docs/syntax.html#ver-dev -# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev -# https://www.sublimetext.com/docs/scope_naming.html +# YAML Documentation: +# https://yaml.org/spec/1.2/spec.html +# Sublime Text Documentation: +# https://www.sublimetext.com/docs/syntax.html#ver-dev +# https://www.sublimetext.com/docs/syntax.html#testing:ver-dev +# https://www.sublimetext.com/docs/scope_naming.html +# This file is being maintained at: +# https://github.com/sublimehq/Packages/blob/master/JSON/JSONC.sublime-syntax +# name: JSONC (JSON with Comments) scope: source.json.jsonc version: 2 @@ -114,20 +119,22 @@ contexts: # completely override original context comment-line: + - meta_include_prototype: false - match: '//' scope: punctuation.definition.comment.jsonc push: - - meta_scope: comment.line.double-slash.jsonc - meta_include_prototype: false + - meta_scope: comment.line.double-slash.jsonc - include: eol-pop # completely override original context comment-doc-block: + - meta_include_prototype: false - match: '/\*\*(?!/)' scope: punctuation.definition.comment.begin.jsonc push: - - meta_scope: comment.block.documentation.jsonc - meta_include_prototype: false + - meta_scope: comment.block.documentation.jsonc - include: comment-block-end - match: '^\s*(\*)(?!/)' captures: @@ -135,15 +142,17 @@ contexts: # completely override original context comment-block: + - meta_include_prototype: false - match: '/\*' scope: punctuation.definition.comment.begin.jsonc push: - - meta_scope: comment.block.jsonc - meta_include_prototype: false + - meta_scope: comment.block.jsonc - include: comment-block-end # completely override original context comment-block-end: + - meta_include_prototype: false - match: '\*/' scope: punctuation.definition.comment.end.jsonc pop: 1 diff --git a/JSON/Line Terminator.tmPreferences b/JSON/Line Terminator.tmPreferences deleted file mode 100644 index 9482e9a53f1..00000000000 --- a/JSON/Line Terminator.tmPreferences +++ /dev/null @@ -1,17 +0,0 @@ - - - - scope - source.json - settings - - shellVariables - - - nameTM_LINE_TERMINATOR - value, - - - - - diff --git a/JSON/tests/indentation/syntax_test_json.indentation.sequence.json b/JSON/tests/indentation/syntax_test_json.indentation.sequence.json index e84350cae63..6c7ba39e55a 100644 --- a/JSON/tests/indentation/syntax_test_json.indentation.sequence.json +++ b/JSON/tests/indentation/syntax_test_json.indentation.sequence.json @@ -50,7 +50,8 @@ [ 1, 2, - 3], + 3 + ], [ {"a": "a"}, {"b": "b"}, diff --git a/JSON/tests/indentation/syntax_test_json5.indentation.sequence.json5 b/JSON/tests/indentation/syntax_test_json5.indentation.sequence.json5 index 5a40f5bb38a..647e32e2a7d 100644 --- a/JSON/tests/indentation/syntax_test_json5.indentation.sequence.json5 +++ b/JSON/tests/indentation/syntax_test_json5.indentation.sequence.json5 @@ -50,7 +50,8 @@ [ 1, 2, - 3], + 3 + ], [ {"a": "a"}, {"b": "b"}, diff --git a/JSON/tests/indentation/syntax_test_jsonc.indentation.sequence.jsonc b/JSON/tests/indentation/syntax_test_jsonc.indentation.sequence.jsonc index 0499df39f34..dfb2ce15980 100644 --- a/JSON/tests/indentation/syntax_test_jsonc.indentation.sequence.jsonc +++ b/JSON/tests/indentation/syntax_test_jsonc.indentation.sequence.jsonc @@ -50,7 +50,8 @@ [ 1, 2, - 3], + 3 + ], [ {"a": "a"}, {"b": "b"}, diff --git a/JSON/tests/syntax/syntax_test_json5.meta.mapping.json5 b/JSON/tests/syntax/syntax_test_json5.meta.mapping.json5 index 741c15ed35b..d75c6004285 100644 --- a/JSON/tests/syntax/syntax_test_json5.meta.mapping.json5 +++ b/JSON/tests/syntax/syntax_test_json5.meta.mapping.json5 @@ -9,6 +9,7 @@ // ^^^^^^^^^^^^^^ meta.mapping.key // ^^^^^^^^^^^^^^ - meta.mapping meta.mapping.key // ^^^^^^^^^^^^^^ meta.toc-list +// ^^^^^^^^^^^^^^ meta.string string.unquoted.plain // ^ meta.mapping punctuation.separator.mapping.key-value // ^^^^ meta.mapping.value // ^^^^ - meta.mapping meta.mapping.value @@ -17,6 +18,7 @@ // ^^^^^^^^^^^^^^ meta.mapping.key // ^^^^^^^^^^^^^^ - meta.mapping meta.mapping.key // ^^^^^^^^^^^^^^ meta.toc-list +// ^^^^^^^^^^^^^^ meta.string string.unquoted.plain // ^ meta.mapping punctuation.separator.mapping.key-value // ^^^^ meta.mapping.value // ^^^^ - meta.mapping meta.mapping.value @@ -25,6 +27,7 @@ // ^^^^^^^^^ meta.mapping.key // ^^^^^^^^^ - meta.mapping meta.mapping.key // ^^^^^^^^^ meta.toc-list +// ^^^^^^^^^ meta.string string.unquoted.plain // ^ meta.mapping punctuation.separator.mapping.key-value // ^^^^ meta.mapping.value // ^^^^ - meta.mapping meta.mapping.value