From 0e87ea1c5eae1294c72f363d3cd2e1f58e01142f Mon Sep 17 00:00:00 2001 From: Martin Aeschlimann Date: Wed, 27 Jun 2018 14:34:45 +0200 Subject: [PATCH] jsonc strings are wrong color. Fixes #53010 --- extensions/json/build/update-grammars.js | 2 +- extensions/json/package.json | 2 +- .../json/syntaxes/JSONC.tmLanguage.json | 58 ++++++++--------- .../theme-defaults/themes/light_vs.json | 3 +- .../test/colorize-results/tsconfig_json.json | 64 +++++++++---------- 5 files changed, 64 insertions(+), 65 deletions(-) diff --git a/extensions/json/build/update-grammars.js b/extensions/json/build/update-grammars.js index 191ef935444..d7d92e18258 100644 --- a/extensions/json/build/update-grammars.js +++ b/extensions/json/build/update-grammars.js @@ -33,7 +33,7 @@ function adaptJSON(grammar, replacementScope) { var tsGrammarRepo = 'Microsoft/vscode-JSON.tmLanguage'; updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSON.tmLanguage.json'); -updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSONC.tmLanguage.json', grammar => adaptJSON(grammar, '.jsonc')); +updateGrammar.update(tsGrammarRepo, 'JSON.tmLanguage', './syntaxes/JSONC.tmLanguage.json', grammar => adaptJSON(grammar, '.json.comments')); diff --git a/extensions/json/package.json b/extensions/json/package.json index 12b3ccf9ef6..af9024bfde9 100644 --- a/extensions/json/package.json +++ b/extensions/json/package.json @@ -58,7 +58,7 @@ }, { "language": "jsonc", - "scopeName": "source.jsonc", + "scopeName": "source.json.comments", "path": "./syntaxes/JSONC.tmLanguage.json" } ], diff --git a/extensions/json/syntaxes/JSONC.tmLanguage.json b/extensions/json/syntaxes/JSONC.tmLanguage.json index cea3c59d5aa..50028ef0f35 100644 --- a/extensions/json/syntaxes/JSONC.tmLanguage.json +++ b/extensions/json/syntaxes/JSONC.tmLanguage.json @@ -6,7 +6,7 @@ ], "version": "https://github.com/Microsoft/vscode-JSON.tmLanguage/commit/9bd83f1c252b375e957203f21793316203f61f70", "name": "JSON with comments", - "scopeName": "source.jsonc", + "scopeName": "source.json.comments", "patterns": [ { "include": "#value" @@ -17,27 +17,27 @@ "begin": "\\[", "beginCaptures": { "0": { - "name": "punctuation.definition.array.begin.jsonc" + "name": "punctuation.definition.array.begin.json.comments" } }, "end": "\\]", "endCaptures": { "0": { - "name": "punctuation.definition.array.end.jsonc" + "name": "punctuation.definition.array.end.json.comments" } }, - "name": "meta.structure.array.jsonc", + "name": "meta.structure.array.json.comments", "patterns": [ { "include": "#value" }, { "match": ",", - "name": "punctuation.separator.array.jsonc" + "name": "punctuation.separator.array.json.comments" }, { "match": "[^\\s\\]]", - "name": "invalid.illegal.expected-array-separator.jsonc" + "name": "invalid.illegal.expected-array-separator.json.comments" } ] }, @@ -47,26 +47,26 @@ "begin": "/\\*\\*(?!/)", "captures": { "0": { - "name": "punctuation.definition.comment.jsonc" + "name": "punctuation.definition.comment.json.comments" } }, "end": "\\*/", - "name": "comment.block.documentation.jsonc" + "name": "comment.block.documentation.json.comments" }, { "begin": "/\\*", "captures": { "0": { - "name": "punctuation.definition.comment.jsonc" + "name": "punctuation.definition.comment.json.comments" } }, "end": "\\*/", - "name": "comment.block.jsonc" + "name": "comment.block.json.comments" }, { "captures": { "1": { - "name": "punctuation.definition.comment.jsonc" + "name": "punctuation.definition.comment.json.comments" } }, "match": "(//).*$\\n?", @@ -76,26 +76,26 @@ }, "constant": { "match": "\\b(?:true|false|null)\\b", - "name": "constant.language.jsonc" + "name": "constant.language.json.comments" }, "number": { "match": "(?x) # turn on extended mode\n -? # an optional minus\n (?:\n 0 # a zero\n | # ...or...\n [1-9] # a 1-9 character\n \\d* # followed by zero or more digits\n )\n (?:\n (?:\n \\. # a period\n \\d+ # followed by one or more digits\n )?\n (?:\n [eE] # an e character\n [+-]? # followed by an option +/-\n \\d+ # followed by one or more digits\n )? # make exponent optional\n )? # make decimal portion optional", - "name": "constant.numeric.jsonc" + "name": "constant.numeric.json.comments" }, "object": { "begin": "\\{", "beginCaptures": { "0": { - "name": "punctuation.definition.dictionary.begin.jsonc" + "name": "punctuation.definition.dictionary.begin.json.comments" } }, "end": "\\}", "endCaptures": { "0": { - "name": "punctuation.definition.dictionary.end.jsonc" + "name": "punctuation.definition.dictionary.end.json.comments" } }, - "name": "meta.structure.dictionary.jsonc", + "name": "meta.structure.dictionary.json.comments", "patterns": [ { "comment": "the JSON object key", @@ -108,16 +108,16 @@ "begin": ":", "beginCaptures": { "0": { - "name": "punctuation.separator.dictionary.key-value.jsonc" + "name": "punctuation.separator.dictionary.key-value.json.comments" } }, "end": "(,)|(?=\\})", "endCaptures": { "1": { - "name": "punctuation.separator.dictionary.pair.jsonc" + "name": "punctuation.separator.dictionary.pair.json.comments" } }, - "name": "meta.structure.dictionary.value.jsonc", + "name": "meta.structure.dictionary.value.json.comments", "patterns": [ { "comment": "the JSON object value", @@ -125,13 +125,13 @@ }, { "match": "[^\\s,]", - "name": "invalid.illegal.expected-dictionary-separator.jsonc" + "name": "invalid.illegal.expected-dictionary-separator.json.comments" } ] }, { "match": "[^\\s\\}]", - "name": "invalid.illegal.expected-dictionary-separator.jsonc" + "name": "invalid.illegal.expected-dictionary-separator.json.comments" } ] }, @@ -139,16 +139,16 @@ "begin": "\"", "beginCaptures": { "0": { - "name": "punctuation.definition.string.begin.jsonc" + "name": "punctuation.definition.string.begin.json.comments" } }, "end": "\"", "endCaptures": { "0": { - "name": "punctuation.definition.string.end.jsonc" + "name": "punctuation.definition.string.end.json.comments" } }, - "name": "string.quoted.double.jsonc", + "name": "string.quoted.double.json.comments", "patterns": [ { "include": "#stringcontent" @@ -159,16 +159,16 @@ "begin": "\"", "beginCaptures": { "0": { - "name": "punctuation.support.type.property-name.begin.jsonc" + "name": "punctuation.support.type.property-name.begin.json.comments" } }, "end": "\"", "endCaptures": { "0": { - "name": "punctuation.support.type.property-name.end.jsonc" + "name": "punctuation.support.type.property-name.end.json.comments" } }, - "name": "string.jsonc support.type.property-name.jsonc", + "name": "string.json.comments support.type.property-name.json.comments", "patterns": [ { "include": "#stringcontent" @@ -179,11 +179,11 @@ "patterns": [ { "match": "(?x) # turn on extended mode\n \\\\ # a literal backslash\n (?: # ...followed by...\n [\"\\\\/bfnrt] # one of these characters\n | # ...or...\n u # a u\n [0-9a-fA-F]{4}) # and four hex digits", - "name": "constant.character.escape.jsonc" + "name": "constant.character.escape.json.comments" }, { "match": "\\\\.", - "name": "invalid.illegal.unrecognized-string-escape.jsonc" + "name": "invalid.illegal.unrecognized-string-escape.json.comments" } ] }, diff --git a/extensions/theme-defaults/themes/light_vs.json b/extensions/theme-defaults/themes/light_vs.json index 23d74f67aa7..4134ce0a4cb 100644 --- a/extensions/theme-defaults/themes/light_vs.json +++ b/extensions/theme-defaults/themes/light_vs.json @@ -291,8 +291,7 @@ }, { "scope": [ - "support.type.property-name.json", - "support.type.property-name.jsonc" + "support.type.property-name.json" ], "settings": { "foreground": "#0451a5" diff --git a/extensions/typescript-basics/test/colorize-results/tsconfig_json.json b/extensions/typescript-basics/test/colorize-results/tsconfig_json.json index 0fbf1b4c28c..69ce07f643d 100644 --- a/extensions/typescript-basics/test/colorize-results/tsconfig_json.json +++ b/extensions/typescript-basics/test/colorize-results/tsconfig_json.json @@ -1,7 +1,7 @@ [ { "c": "{", - "t": "source.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.begin.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.begin.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -12,7 +12,7 @@ }, { "c": "\t", - "t": "source.jsonc meta.structure.dictionary.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -23,40 +23,40 @@ }, { "c": "\"", - "t": "source.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.begin.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.begin.json.comments", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.jsonc: #0451A5", + "light_plus": "support.type.property-name.json: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.jsonc: #0451A5", + "light_vs": "support.type.property-name.json: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "compilerOptions", - "t": "source.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.jsonc: #0451A5", + "light_plus": "support.type.property-name.json: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.jsonc: #0451A5", + "light_vs": "support.type.property-name.json: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "\"", - "t": "source.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.end.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.end.json.comments", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.jsonc: #0451A5", + "light_plus": "support.type.property-name.json: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.jsonc: #0451A5", + "light_vs": "support.type.property-name.json: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": ":", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc punctuation.separator.dictionary.key-value.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments punctuation.separator.dictionary.key-value.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -67,7 +67,7 @@ }, { "c": " ", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -78,7 +78,7 @@ }, { "c": "{", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.begin.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.begin.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -89,7 +89,7 @@ }, { "c": "\t\t", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -100,40 +100,40 @@ }, { "c": "\"", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.begin.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.begin.json.comments", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.jsonc: #0451A5", + "light_plus": "support.type.property-name.json: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.jsonc: #0451A5", + "light_vs": "support.type.property-name.json: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "target", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.jsonc: #0451A5", + "light_plus": "support.type.property-name.json: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.jsonc: #0451A5", + "light_vs": "support.type.property-name.json: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": "\"", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc string.jsonc support.type.property-name.jsonc punctuation.support.type.property-name.end.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments string.json.comments support.type.property-name.json.comments punctuation.support.type.property-name.end.json.comments", "r": { "dark_plus": "support.type.property-name: #9CDCFE", - "light_plus": "support.type.property-name.jsonc: #0451A5", + "light_plus": "support.type.property-name.json: #0451A5", "dark_vs": "support.type.property-name: #9CDCFE", - "light_vs": "support.type.property-name.jsonc: #0451A5", + "light_vs": "support.type.property-name.json: #0451A5", "hc_black": "support.type.property-name: #D4D4D4" } }, { "c": ":", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc punctuation.separator.dictionary.key-value.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments punctuation.separator.dictionary.key-value.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -144,7 +144,7 @@ }, { "c": " ", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -155,7 +155,7 @@ }, { "c": "\"", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc string.quoted.double.jsonc punctuation.definition.string.begin.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments string.quoted.double.json.comments punctuation.definition.string.begin.json.comments", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -166,7 +166,7 @@ }, { "c": "es6", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc string.quoted.double.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments string.quoted.double.json.comments", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -177,7 +177,7 @@ }, { "c": "\"", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc string.quoted.double.jsonc punctuation.definition.string.end.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments string.quoted.double.json.comments punctuation.definition.string.end.json.comments", "r": { "dark_plus": "string: #CE9178", "light_plus": "string: #A31515", @@ -188,7 +188,7 @@ }, { "c": "\t", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -199,7 +199,7 @@ }, { "c": "}", - "t": "source.jsonc meta.structure.dictionary.jsonc meta.structure.dictionary.value.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.end.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments meta.structure.dictionary.value.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.end.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000", @@ -210,7 +210,7 @@ }, { "c": "}", - "t": "source.jsonc meta.structure.dictionary.jsonc punctuation.definition.dictionary.end.jsonc", + "t": "source.json.comments meta.structure.dictionary.json.comments punctuation.definition.dictionary.end.json.comments", "r": { "dark_plus": "default: #D4D4D4", "light_plus": "default: #000000",