diff options
author | George Fraser <george@fivetran.com> | 2018-12-21 14:10:26 -0800 |
---|---|---|
committer | George Fraser <george@fivetran.com> | 2018-12-21 14:10:26 -0800 |
commit | 248b325b0ae672bcfac1bf61d2e5f540eb0a056d (patch) | |
tree | a9c1a01b2b549f4d4ed38103ff779f1e04bb2e0e /lib | |
parent | fe1838b24cda17d2fc3363e0ead6d9b35c609ab5 (diff) | |
download | java-language-server-248b325b0ae672bcfac1bf61d2e5f540eb0a056d.zip |
Focus on blocks
Diffstat (limited to 'lib')
-rw-r--r-- | lib/java.tmLanguage.json | 344 |
1 files changed, 85 insertions, 259 deletions
diff --git a/lib/java.tmLanguage.json b/lib/java.tmLanguage.json index 5689b90..53d3374 100644 --- a/lib/java.tmLanguage.json +++ b/lib/java.tmLanguage.json @@ -44,16 +44,7 @@ ] }, { - "include": "#annotation" - }, - { - "include": "#keywords" - }, - { - "include": "#comments" - }, - { - "include": "#class-declaration" + "include": "#code" } ], "repository": { @@ -99,59 +90,20 @@ } ] }, - "class-declaration": { + "class-body": { "patterns": [ { - "begin": "(?<!\\.)\\b(class|interface|@interface)\\b +(\\w+)\\b", + "begin": "\\(", + "end": "\\)", + "name": "meta.arguments.java", "beginCaptures": { - "1": { - "name": "keyword.class.java" - }, - "2": { - "name": "entity.name.class.java" + "0": { + "name": "keyword.other.begin-args.java" } }, - "end": "}", - "name": "meta.class.java", - "patterns": [ - { - "begin": "{", - "end": "(?=})", - "name": "meta.class.body.java", - "patterns": [ - { - "include": "#class-body" - } - ] - } - ] - } - ] - }, - "class-body": { - "patterns": [ - { - "include": "#comments" - }, - { - "include": "#keywords" - }, - { - "include": "#block" - }, - { - "include": "#class-declaration" - }, - { - "include": "#member-declaration" - }, - { - "begin": "=", - "end": "(?=[,;])", - "name": "meta.initialize.java", - "beginCaptures": { + "endCaptures": { "0": { - "name": "keyword.other.set.java" + "name": "keyword.other.end-args.java" } }, "patterns": [ @@ -161,201 +113,122 @@ ] }, { - "match": "\\w+ *(?=\\()", - "name": "variable.other.method.java" - }, - { - "include": "#arguments" - }, - { - "match": "[;,]", - "name": "keyword.other.punctuation.java" - } - ] - }, - "member-declaration": { - "patterns": [ - { - "match": "\\b(\\w+) +(?=\\w)", - "captures": { - "1": { - "name": "entity.name.type.java" - } - } - }, - { - "match": "\\b(\\w+) *(?=<)", - "captures": { - "1": { - "name": "entity.name.type.java" - } - } - }, - { - "match": "\\b(\\w+) *(?=\\[)", - "captures": { - "1": { - "name": "entity.name.type.java" - } - } - }, - { - "match": "(?<GROUP><([^<>]|\\g<GROUP>)+>)", - "name": "meta.type-parameters.java", - "captures": { + "begin": "\\b(throws)\\b", + "end": "(?=[{;])", + "beginCaptures": { "1": { - "patterns": [ - { - "match": "extends|super", - "name": "storage.modifier.java" - }, - { - "match": "\\w+", - "name": "entity.name.type.java" - }, - { - "match": "[<>]", - "name": "keyword.other.generics.java" - } - ] + "name": "keyword.other.throws.java" } - } - }, - { - "match": "\\[\\]", - "name": "keyword.other.brackets.java" - }, - { - "match": "\\w+ *(?=[,;=\\)])", - "name": "variable.other.field.java" - } - ] - }, - "arguments": { - "patterns": [ - { - "begin": "\\(", - "end": "\\)", - "name": "meta.arguments.java", - "beginCaptures": { - "0": {"name": "keyword.other.java"} - }, - "endCaptures": { - "0": {"name": "keyword.other.java"} }, + "name": "meta.throws.java", "patterns": [ { - "include": "#comments" - }, - { - "include": "#annotation" + "match": "(\\w+\\.)*[A-Z]\\w*", + "name": "entity.name.type.exception.java" }, { - "include": "#member-declaration" + "include": "#comments" } ] + }, + { + "include": "#code" } ] }, - "block-code": { + "code": { "patterns": [ { - "COMMENT": "prevent `) {` at the end of `if (...) {` from being interpreted as anonymous class", - "begin": "\\b(if) *(?=\\()", - "end": "(?={)", + "begin": "(?<!\\.)\\b(class|interface|@interface)\\b +(\\w+)\\b", "beginCaptures": { "1": { - "name": "keyword.control.if.java" + "name": "keyword.class.java" + }, + "2": { + "name": "entity.name.class.java" } }, - "name": "meta.if.java", + "end": "$", + "name": "meta.class.java", "patterns": [ { - "include": "#code" - } - ] - }, - { - "COMMENT": "prevent `) {` at the end of `try (...) {` from being interpreted as anonymous class", - "begin": "\\b(try) *(?=\\()", - "end": "(?={)", - "beginCaptures": { - "1": { - "name": "keyword.control.try.java" - } - }, - "name": "meta.try-with-resources.java", - "patterns": [ + "include": "#keywords" + }, { - "include": "#code" + "include": "#type-name" + }, + { + "match": "[<>,]", + "name": "keyword.other.java" + }, + { + "begin": "{", + "end": "}", + "beginCaptures": { + "0": { + "name": "keyword.other.begin-class-body.java" + } + }, + "endCaptures": { + "0": { + "name": "keyword.other.end-class-body.java" + } + }, + "name": "meta.class.body.java", + "patterns": [ + { + "include": "#class-body" + } + ] } ] }, { - "COMMENT": "prevent `) {` at the end of `catch (...) {` from being interpreted as anonymous class", - "begin": "\\b(catch) *(?=\\()", - "end": "(?={)", + "begin": "(new)", + "end": "$", "beginCaptures": { "1": { - "name": "keyword.control.catch.java" + "name": "keyword.other.new.java" } }, - "name": "meta.catch.java", + "name": "meta.new.java", "patterns": [ { - "match": "(\\w+\\.)*[A-Z]\\w*", - "name": "entity.name.type.exception.java" - }, - { - "match": "[a-z]\\w*", - "name": "variable.other.declaration.java" + "begin": "{", + "end": "}", + "name": "meta.anonymous-class.body.java", + "beginCaptures": { + "0": { + "name": "markup.underline" + } + }, + "endCaptures": { + "0": { + "name": "markup.underline" + } + }, + "patterns": [ + { + "include": "#class-body" + } + ] }, { - "include": "#comments" + "include": "#code" } ] }, { - "COMMENT": "otherwise, interpret `) {` as beginning of anonymous class", - "begin": "(?<=\\)) *({)", + "begin": "{", "end": "}", - "beginCaptures": { - "1": { - "name": "markup.underline" - } - }, - "endCaptures": { - "0": { - "name": "markup.underline" - } - }, - "name": "meta.anonymous.class.java", + "name": "meta.block.java", "patterns": [ { - "include": "#class-body" + "include": "#code" } ] }, { - "include": "#code" - } - ] - }, - "code": { - "patterns": [ - { - "include": "#class-declaration" - }, - { - "include": "#block" - }, - { - "include": "#paren" - }, - { - "include": "#throws" - }, - { "include": "#annotation" }, { @@ -394,6 +267,10 @@ { "match": "\\b(this|super)\\b", "name": "variable.language.java" + }, + { + "match": "\\?", + "name": "keyword.other.q.java" } ] }, @@ -499,57 +376,6 @@ } ] }, - "throws": { - "patterns": [ - { - "begin": "\\b(throws)\\b", - "end": "(?=[{;])", - "beginCaptures": { - "1": { - "name": "keyword.other.throws.java" - } - }, - "name": "meta.throws.java", - "patterns": [ - { - "match": "(\\w+\\.)*[A-Z]\\w*", - "name": "entity.name.type.exception.java" - }, - { - "include": "#comments" - } - ] - } - ] - }, - "block": { - "patterns": [ - { - "begin": "{", - "end": "}", - "name": "meta.block.java", - "patterns": [ - { - "include": "#block-code" - } - ] - } - ] - }, - "paren": { - "patterns": [ - { - "begin": "\\(", - "end": "\\)", - "name": "meta.paren.java", - "patterns": [ - { - "include": "#code" - } - ] - } - ] - }, "type-name": { "patterns": [ { |