diff --git a/syntaxes/kotlin.tmLanguage.json b/syntaxes/kotlin.tmLanguage.json index fd20f48..9a5685c 100644 --- a/syntaxes/kotlin.tmLanguage.json +++ b/syntaxes/kotlin.tmLanguage.json @@ -427,34 +427,70 @@ } }, "variable-declaration": { - "match": "\\b(var)\\b\\s*(?<([^<>]|\\g)+>)?", - "captures": { - "1": { - "name": "storage.type.variable.kotlin" + "begin": "(?=\\b(var)\\b\\s+[A-Za-z_$][\\w$]*\\s*(=|:|$))", + "end": "(?=\\=|:|$)", + "name": "meta.definition.variable.kotlin", + "patterns": [ + { + "match": "\\b(var)\\b\\s*(?<([^<>]|\\g)+>)?", + "captures": { + "1": { + "name": "storage.type.variable.kotlin" + }, + "2": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } }, - "2": { - "patterns": [ - { - "include": "#type-parameter" + { + "match": "([A-Za-z$_][\\w$]*)(?=\\s*(\\[\\])*\\s*(=|:|$))", + "captures": { + "1": { + "name": "variable.other.definition.kotlin" } - ] + } + }, + { + "include": "#code" } - } + ] }, "constant-declaration": { - "match": "\\b(val)\\b\\s*(?<([^<>]|\\g)+>)?", - "captures": { - "1": { - "name": "storage.type.variable.readonly.kotlin" + "begin": "(?=\\b(val)\\b\\s+[A-Za-z_$][\\w$]*\\s*(=|:|$))", + "end": "(?=\\=|:|$)", + "name": "meta.definition.variable.readonly.kotlin", + "patterns": [ + { + "match": "\\b(val)\\b\\s*(?<([^<>]|\\g)+>)?", + "captures": { + "1": { + "name": "storage.type.variable.kotlin" + }, + "2": { + "patterns": [ + { + "include": "#type-parameter" + } + ] + } + } }, - "2": { - "patterns": [ - { - "include": "#type-parameter" + { + "match": "([A-Za-z$_][\\w$]*)(?=\\s*(\\[\\])*\\s*(=|:|$))", + "captures": { + "1": { + "name": "variable.other.definition.kotlin" } - ] + } + }, + { + "include": "#code" } - } + ] }, "object": { "match": "\\b(\\w+)(?=\\.)",