Skip to content

Commit

Permalink
jsonc strings are wrong color. Fixes #53010
Browse files Browse the repository at this point in the history
  • Loading branch information
aeschli committed Jun 27, 2018
1 parent 7d8a845 commit 0e87ea1
Show file tree
Hide file tree
Showing 5 changed files with 64 additions and 65 deletions.
2 changes: 1 addition & 1 deletion extensions/json/build/update-grammars.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'));



Expand Down
2 changes: 1 addition & 1 deletion extensions/json/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
},
{
"language": "jsonc",
"scopeName": "source.jsonc",
"scopeName": "source.json.comments",
"path": "./syntaxes/JSONC.tmLanguage.json"
}
],
Expand Down
58 changes: 29 additions & 29 deletions extensions/json/syntaxes/JSONC.tmLanguage.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
}
]
},
Expand All @@ -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?",
Expand All @@ -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",
Expand All @@ -108,47 +108,47 @@
"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",
"include": "#value"
},
{
"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"
}
]
},
"string": {
"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"
Expand All @@ -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"
Expand All @@ -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"
}
]
},
Expand Down
3 changes: 1 addition & 2 deletions extensions/theme-defaults/themes/light_vs.json
Original file line number Diff line number Diff line change
Expand Up @@ -291,8 +291,7 @@
},
{
"scope": [
"support.type.property-name.json",
"support.type.property-name.jsonc"
"support.type.property-name.json"
],
"settings": {
"foreground": "#0451a5"
Expand Down

0 comments on commit 0e87ea1

Please sign in to comment.