From 134ac76b2db00cfc05796c98604cbb1e1f65abb9 Mon Sep 17 00:00:00 2001 From: George Fraser Date: Tue, 9 Oct 2018 20:32:48 -0700 Subject: Simplify variable declaration --- lib/java.tmLanguage.json | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/java.tmLanguage.json b/lib/java.tmLanguage.json index b92e93a..9f727cb 100644 --- a/lib/java.tmLanguage.json +++ b/lib/java.tmLanguage.json @@ -975,25 +975,34 @@ ] }, "variables": { - "begin": "(?x)\n(?=\n (\n (void|boolean|byte|char|short|int|float|long|double|var)\n |\n (?>(\\w+\\.)*[A-Z]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap`, or `List`\n )?\n (\n (\\[\\])* # int[][]\n )?\n \\s+\n [A-Za-z_$][\\w$]* # At least one identifier after space\n ([\\w\\[\\],$][\\w\\[\\],\\s]*)? # possibly primitive array or additional identifiers\n \\s*(=|;)\n)", + "begin": "(void|boolean|byte|char|short|int|float|long|double|var|(\\w+\\.)*\\w+)(<[\\w<>,\\.?\\s\\[\\]]*)?(\\[\\])*\\s+(?=\\w+)", "end": "(?=;)", "name": "meta.definition.variable.java", - "patterns": [ - { - "include": "#all-types" - }, - { - "match": "[\\w$]+", - "name": "variable.other.declaration.java" + "beginCaptures": { + "1": { + "name": "entity.name.type.variable.java" }, + "3": { + "patterns": [ + { + "include": "#generics" + } + ] + } + }, + "patterns": [ { - "begin": "=", + "begin": "(\\w+)(\\[\\])*\\s*(=)", + "end": "(?=[;,])", "beginCaptures": { - "0": { + "1": { + "name": "variable.other.declaration.java" + }, + "3": { "name": "keyword.operator.assignment.java" } }, - "end": "(?=;)", + "name": "meta.definition.initializer.java", "patterns": [ { "include": "#code" -- cgit v1.2.3