|
| 1 | +{ |
| 2 | + "$schema": "https://raw.githubusercontent.com/RedCMD/TmLanguage-Syntax-Highlighter/main/vscode.tmLanguage.schema.json", |
| 3 | + "name": "\"when\" & \"enablement\" inside package.json and keybingings.json", |
| 4 | + "comment": "https://code.visualstudio.com/api/references/when-clause-contexts", |
| 5 | + "scopeName": "source.json.package.when", |
| 6 | + "injectionSelector": [ |
| 7 | + "L:source.json.embedded .meta.embedded.contributes. (.meta.embedded.continueEditSession. | .meta.embedded.keybindings. | .meta.embedded.viewsWelcome. | .meta.embedded.taskDefinitions. | .meta.embedded.chatParticipants. | .meta.embedded.languageModelTools. | .meta.embedded.debuggers. | .meta.embedded.debugVisualizers. | .meta.embedded.walkthroughs. | .meta.embedded.chatViewsWelcome. | .meta.embedded.breakpoints.) meta.structure.array.json .meta.embedded.when. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json) -meta.embedded.when.json -comment", |
| 8 | + "L:source.json.embedded .meta.embedded.contributes. (.meta.embedded.walkthroughs. meta.structure.array.json .meta.embedded.steps. | .meta.embedded.chatParticipants. meta.structure.array.json .meta.embedded.commands.) meta.structure.array.json .meta.embedded.when. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json meta.structure.array.json) -meta.embedded.when.json -comment", |
| 9 | + "L:source.json.embedded .meta.embedded.contributes. (.meta.embedded.views. | .meta.embedded.menus. | .meta.embedded.viewsContainers.) meta.structure.dictionary.json meta.structure.array.json .meta.embedded.when. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json) -meta.embedded.when.json -comment", |
| 10 | + "L:source.json.embedded .meta.embedded.contributes. (.meta.embedded.keybindings. .meta.embedded.when. | .meta.embedded.commands. .meta.embedded.enablement.) string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json) -meta.embedded.when.json -comment", |
| 11 | + "L:source.json.embedded .meta.embedded.contributes. .meta.embedded.viewsWelcome. meta.structure.array.json .meta.embedded.enablement. string.quoted.double.json -(meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json meta.structure.dictionary.json) -(meta.structure.array.json meta.structure.array.json) -meta.embedded.when.json -comment", |
| 12 | + "L:source.json.comments.embedded meta.structure.array.json.comments .meta.embedded.when. string.quoted.double.json.comments -(meta.structure.dictionary.json.comments meta.structure.dictionary.json.comments) -(meta.structure.array.json.comments meta.structure.array.json.comments) -meta.embedded.when.json -comment" |
| 13 | + ], |
| 14 | + "patterns": [ |
| 15 | + { |
| 16 | + "begin": "(?<=\")\\G(?=(?>[^\\x00-\\x1F\"\\\\]++|\\\\.)++\")", |
| 17 | + "end": "(?=\"|$)", |
| 18 | + "name": "meta.embedded.when.json", |
| 19 | + "patterns": [ { "include": "#when" } ] |
| 20 | + } |
| 21 | + ], |
| 22 | + "repository": { |
| 23 | + "when": { |
| 24 | + "comment": "https://vscode.dev/github/microsoft/vscode/blob/main/src/vs/platform/contextkey/common/scanner.ts#L198-L268", |
| 25 | + "patterns": [ |
| 26 | + { "include": "#parenthesized" }, |
| 27 | + { "include": "#single-quote" }, |
| 28 | + { "include": "#regexp" }, |
| 29 | + { "include": "#operator" }, |
| 30 | + { "include": "#in" }, |
| 31 | + { "include": "#key" }, |
| 32 | + { "include": "source.json#stringcontent" } |
| 33 | + ] |
| 34 | + }, |
| 35 | + "parenthesized": { |
| 36 | + "patterns": [ |
| 37 | + { |
| 38 | + "begin": "\\(", |
| 39 | + "end": "\\)|(?=\")|$", |
| 40 | + "beginCaptures": { "0": { "name": "meta.brace.round.begin.when.json" } }, |
| 41 | + "endCaptures": { "0": { "name": "meta.brace.round.end.when.json" } }, |
| 42 | + "patterns": [ |
| 43 | + { "include": "source.json#stringcontent" }, |
| 44 | + { "include": "#when" } |
| 45 | + ] |
| 46 | + }, |
| 47 | + { |
| 48 | + "match": "\\)+", |
| 49 | + "name": "invalid.illegal.brace.when.json" |
| 50 | + } |
| 51 | + ] |
| 52 | + }, |
| 53 | + "operator": { |
| 54 | + "patterns": [ |
| 55 | + { |
| 56 | + "begin": "([!=]==?)|([<>]=?)|(=~)", |
| 57 | + "end": "(?=[\"&)|])|$", |
| 58 | + "beginCaptures": { |
| 59 | + "1": { "name": "keyword.operator.comparison.when.json" }, |
| 60 | + "2": { "name": "keyword.operator.relational.when.json" }, |
| 61 | + "3": { "name": "keyword.operator.comparison.when.json" } |
| 62 | + }, |
| 63 | + "name": "meta.value.when.json", |
| 64 | + "patterns": [ |
| 65 | + { "include": "#regexp" }, |
| 66 | + { |
| 67 | + "begin": "(?=[]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 68 | + "end": "(?![]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 69 | + "name": "string.unquoted.when.json", |
| 70 | + "patterns": [ |
| 71 | + { |
| 72 | + "comment": "parseFloat()", |
| 73 | + "match": "\\G[-+]?(?>(?>[0-9]+(?>\\.[0-9]*)?|\\.[0-9]+)(?>[Ee][-+]?[0-9]+)?|Infinity)", |
| 74 | + "name": "constant.numeric.when.json" |
| 75 | + }, |
| 76 | + { "include": "#boolean" }, |
| 77 | + { "include": "source.json#stringcontent" } |
| 78 | + ] |
| 79 | + }, |
| 80 | + { "include": "#when" } |
| 81 | + ] |
| 82 | + }, |
| 83 | + { |
| 84 | + "match": "!", |
| 85 | + "name": "keyword.operator.logical.not.when.json" |
| 86 | + }, |
| 87 | + { |
| 88 | + "match": "&&", |
| 89 | + "name": "keyword.operator.logical.and.when.json" |
| 90 | + }, |
| 91 | + { |
| 92 | + "match": "\\|\\|", |
| 93 | + "name": "keyword.operator.logical.or.when.json" |
| 94 | + }, |
| 95 | + { |
| 96 | + "match": "[&=|~]+", |
| 97 | + "name": "invalid.illegal.keyword.operator.when.json" |
| 98 | + } |
| 99 | + ] |
| 100 | + }, |
| 101 | + "in": { |
| 102 | + "patterns": [ |
| 103 | + { |
| 104 | + "begin": "in(?![]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 105 | + "end": "(?=[!\"&)|]|$)", |
| 106 | + "beginCaptures": { "0": { "name": "keyword.operator.expression.in.when.json" } }, |
| 107 | + "name": "meta.value.when.json", |
| 108 | + "patterns": [ |
| 109 | + { |
| 110 | + "begin": "(?=[]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 111 | + "end": "(?![]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 112 | + "name": "variable.other.value.when.json", |
| 113 | + "patterns": [ { "include": "source.json#stringcontent" } ] |
| 114 | + }, |
| 115 | + { "include": "#when" } |
| 116 | + ] |
| 117 | + }, |
| 118 | + { |
| 119 | + "match": "not(?![]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 120 | + "name": "keyword.operator.expression.not.when.json" |
| 121 | + } |
| 122 | + ] |
| 123 | + }, |
| 124 | + "boolean": { |
| 125 | + "match": "\\G(?>true|false)(?![]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 126 | + "name": "constant.language.boolean.$0.when.json" |
| 127 | + }, |
| 128 | + "single-quote": { |
| 129 | + "begin": "'", |
| 130 | + "end": "'|(?=\")|$", |
| 131 | + "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.when.json" } }, |
| 132 | + "endCaptures": { "0": { "name": "punctuation.definition.string.end.when.json" } }, |
| 133 | + "name": "string.quoted.single.when.json", |
| 134 | + "patterns": [ { "include": "source.json#stringcontent" } ] |
| 135 | + }, |
| 136 | + "key": { |
| 137 | + "begin": "(?=[]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 138 | + "end": "(?![]#$%*-<>-\\[^_\\p{L}]|\\\\[\\\\\"/])", |
| 139 | + "name": "variable.other.constant.key.when.json", |
| 140 | + "patterns": [ |
| 141 | + { "include": "#boolean" }, |
| 142 | + { "include": "source.json#stringcontent" } |
| 143 | + ] |
| 144 | + }, |
| 145 | + "regexp": { |
| 146 | + "begin": "(\\\\)?(/)", |
| 147 | + "end": "(\\\\)?(/)([igsmyu]*)|(?=\")|$", |
| 148 | + "beginCaptures": { |
| 149 | + "1": { "name": "constant.character.escape.regexp.json" }, |
| 150 | + "2": { "name": "punctuation.definition.string.begin.when.json" } |
| 151 | + }, |
| 152 | + "endCaptures": { |
| 153 | + "1": { "name": "constant.character.escape.regexp.json" }, |
| 154 | + "2": { "name": "punctuation.definition.string.end.when.json" }, |
| 155 | + "3": { "name": "keyword.other.when.json" } |
| 156 | + }, |
| 157 | + "name": "string.regexp.when.json", |
| 158 | + "patterns": [ |
| 159 | + { "include": "source.json.regexp#regexp" }, |
| 160 | + { "include": "source.json#stringcontent" } |
| 161 | + ] |
| 162 | + } |
| 163 | + } |
| 164 | +} |
0 commit comments