From 44afbd61f6a6fa785656d32685cf3ca5236962bc Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 15 Jun 2024 22:50:59 +1000 Subject: [PATCH 1/3] Use latest textmate grammer from redhat-developer/vscode-java --- lib/java.tmLanguage.json | 1942 ++++++++++++++++++++++++++++++++------ 1 file changed, 1669 insertions(+), 273 deletions(-) diff --git a/lib/java.tmLanguage.json b/lib/java.tmLanguage.json index bd280660..cd8c57c8 100644 --- a/lib/java.tmLanguage.json +++ b/lib/java.tmLanguage.json @@ -1,492 +1,1888 @@ { - "$schema": "https://raw.githubusercontent.com/ealap/tmlanguage/master/tmlanguage.json", + "information_for_contributors": [ + "This file has been copied from https://github.com/redhat-developer/vscode-java/blob/master/language-support/java/java.tmLanguage.json", + "If you want to provide a fix or improvement, please create a pull request against the original repository.", + "Once accepted there, we are happy to receive an update request." + ], + "version": "https://github.com/redhat-developer/vscode-java/commit/f09b712f5d6d6339e765f58c8dfab3f78a378183", "name": "Java", "scopeName": "source.java", "patterns": [ { - "include": "#class-declaration" + "begin": "\\b(package)\\b\\s*", + "beginCaptures": { + "1": { + "name": "keyword.other.package.java" + } + }, + "end": "\\s*(;)", + "endCaptures": { + "1": { + "name": "punctuation.terminator.java" + } + }, + "name": "meta.package.java", + "contentName": "storage.modifier.package.java", + "patterns": [ + { + "include": "#comments" + }, + { + "match": "(?<=\\.)\\s*\\.|\\.(?=\\s*;)", + "name": "invalid.illegal.character_not_allowed_here.java" + }, + { + "match": "(?]+>", - "name": "meta.type-parameters-declaration", - "captures": { - "0": { + "assertions": { + "patterns": [ + { + "begin": "\\b(assert)\\s", + "beginCaptures": { + "1": { + "name": "keyword.control.assert.java" + } + }, + "end": "$", + "name": "meta.declaration.assertion.java", "patterns": [ { - "include": "#keywords" + "match": ":", + "name": "keyword.operator.assert.expression-separator.java" }, { - "include": "#comments" - }, - { - "match": "\\b([A-Z]\\w*)\\b", - "name": "entity.name.type" + "include": "#code" } ] } - } + ] }, - "block": { - "begin": "{", + "class": { + "begin": "(?=\\w?[\\w\\s-]*\\b(?:class|(?", + "endCaptures": { + "0": { + "name": "punctuation.bracket.angle.java" + } + }, + "patterns": [ + { + "match": "\\b(extends|super)\\b", + "name": "storage.modifier.$1.java" }, { - "match": "\\.(class)\\b", + "match": "(?>>?|~|\\^)", + "name": "keyword.operator.bitwise.java" + }, + { + "match": "((&|\\^|\\||<<|>>>?)=)", + "name": "keyword.operator.assignment.bitwise.java" + }, + { + "match": "(===?|!=|<=|>=|<>|<|>)", + "name": "keyword.operator.comparison.java" + }, + { + "match": "([+*/%-]=)", + "name": "keyword.operator.assignment.arithmetic.java" + }, + { + "match": "(=)", + "name": "keyword.operator.assignment.java" + }, + { + "match": "(\\-\\-|\\+\\+)", + "name": "keyword.operator.increment-decrement.java" + }, + { + "match": "(\\-|\\+|\\*|\\/|%)", + "name": "keyword.operator.arithmetic.java" + }, + { + "match": "(!|&&|\\|\\|)", + "name": "keyword.operator.logical.java" + }, + { + "match": "(\\||&)", + "name": "keyword.operator.bitwise.java" + }, + { + "match": "\\b(const|goto)\\b", + "name": "keyword.reserved.java" + } + ] + }, + "lambda-expression": { + "patterns": [ + { + "match": "->", + "name": "storage.type.function.arrow.java" + } + ] + }, + "member-variables": { + "begin": "(?=private|protected|public|native|synchronized|abstract|threadsafe|transient|static|final)", + "end": "(?=\\=|;)", + "patterns": [ + { + "include": "#storage-modifiers" + }, + { + "include": "#variables" + }, + { + "include": "#primitive-arrays" + }, + { + "include": "#object-types" + } + ] + }, + "method-call": { + "begin": "(\\.)\\s*([A-Za-z_$][\\w$]*)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.separator.period.java" + }, + "2": { + "name": "entity.name.function.java" + }, + "3": { + "name": "punctuation.definition.parameters.begin.bracket.round.java" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.java" + } + }, + "name": "meta.method-call.java", + "patterns": [ + { + "include": "#code" + } + ] + }, + "methods": { + "begin": "(?!new)(?=[\\w<].*\\s+)(?=([^=/]|/(?!/))+\\()", + "end": "(})|(?=;)", + "endCaptures": { + "1": { + "name": "punctuation.section.method.end.bracket.curly.java" + } + }, + "name": "meta.method.java", + "patterns": [ + { + "include": "#storage-modifiers" + }, + { + "begin": "(\\w+)\\s*(\\()", + "beginCaptures": { + "1": { + "name": "entity.name.function.java" + }, + "2": { + "name": "punctuation.definition.parameters.begin.bracket.round.java" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.java" + } + }, + "name": "meta.method.identifier.java", + "patterns": [ + { + "include": "#parameters" + }, + { + "include": "#parens" + }, + { + "include": "#comments" + } + ] + }, + { + "include": "#generics" + }, + { + "begin": "(?=\\w.*\\s+\\w+\\s*\\()", + "end": "(?=\\s+\\w+\\s*\\()", + "name": "meta.method.return-type.java", + "patterns": [ + { + "include": "#all-types" + }, + { + "include": "#parens" + }, + { + "include": "#comments" + } + ] + }, + { + "include": "#throws" + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.method.begin.bracket.curly.java" + } + }, + "end": "(?=})", + "contentName": "meta.method.body.java", + "patterns": [ + { + "include": "#code" + } + ] + }, + { + "include": "#comments" + } + ] + }, + "module": { + "begin": "((open)\\s)?(module)\\s+(\\w+)", + "end": "}", + "beginCaptures": { + "1": { + "name": "storage.modifier.java" + }, + "3": { + "name": "storage.modifier.java" + }, + "4": { + "name": "entity.name.type.module.java" + } + }, + "endCaptures": { + "0": { + "name": "punctuation.section.module.end.bracket.curly.java" + } + }, + "name": "meta.module.java", + "patterns": [ + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.module.begin.bracket.curly.java" + } + }, + "end": "(?=})", + "contentName": "meta.module.body.java", + "patterns": [ + { + "include": "#comments" + }, + { + "include": "#comments-javadoc" + }, + { + "match": "\\b(requires|transitive|exports|opens|to|uses|provides|with)\\b", + "name": "keyword.module.java" + } + ] + } + ] + }, + "numbers": { + "patterns": [ + { + "match": "(?x)\n\\b(?)?(\\()", + "beginCaptures": { + "1": { + "name": "storage.modifier.java" + }, + "2": { + "name": "entity.name.type.record.java" + }, + "3": { + "patterns": [ + { + "include": "#generics" + } + ] + }, + "4": { + "name": "punctuation.definition.parameters.begin.bracket.round.java" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.java" + } + }, + "name": "meta.record.identifier.java", + "patterns": [ + { + "include": "#code" } - } + ] }, { - "match": "\\b(default):", - "captures": { + "begin": "(implements)\\s", + "beginCaptures": { "1": { - "name": "keyword.control.default" + "name": "storage.modifier.implements.java" } - } - }, - { - "match": "\\b(private|public|protected|abstract|default(?!=:)|static|final|volatile|const|extends|implements|synchronized)\\b", - "name": "storage.modifier.java" - }, - { - "match": "\\b(this|super)\\b", - "name": "variable.language.java" - }, - { - "match": "\\?", - "name": "constant.numeric" - }, - { - "match": "\\b(byte|short|int|long|char|float|double|boolean|void)\\b", - "name": "keyword.type" + }, + "end": "(?=\\s*\\{)", + "name": "meta.definition.class.implemented.interfaces.java", + "patterns": [ + { + "include": "#object-types-inherited" + }, + { + "include": "#comments" + } + ] }, { - "match": "\\bvar\\b", - "name": "keyword.other.var" + "include": "#record-body" } ] }, - "comments": { + "record-body": { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.class.begin.bracket.curly.java" + } + }, + "end": "(?=})", + "name": "meta.record.body.java", "patterns": [ { - "begin": "/\\*", - "end": "\\*/", - "name": "comment.block" + "include": "#record-constructor" }, { - "begin": "//", - "end": "$", - "name": "comment.line" + "include": "#class-body" } ] }, - "constants": { + "record-constructor": { + "begin": "(?!new)(?=[\\w<].*\\s+)(?=([^\\(=/]|/(?!/))+(?={))", + "end": "(})|(?=;)", + "endCaptures": { + "1": { + "name": "punctuation.section.method.end.bracket.curly.java" + } + }, + "name": "meta.method.java", "patterns": [ { - "match": "\\b(null|true|false)\\b", - "name": "constant.numeric" + "include": "#storage-modifiers" }, { - "match": "(?x)\n\\b(?<([^<>]|\\g)*>)", - "captures": { + "begin": "\\b(catch)\\b", + "beginCaptures": { "1": { - "name": "entity.name.type" + "name": "keyword.control.catch.java" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.catch.end.bracket.curly.java" + } + }, + "name": "meta.catch.java", + "patterns": [ + { + "include": "#comments" }, - "2": { - "name": "meta.type-parameters-declaration", + { + "begin": "\\(", + "beginCaptures": { + "0": { + "name": "punctuation.definition.parameters.begin.bracket.round.java" + } + }, + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.definition.parameters.end.bracket.round.java" + } + }, + "contentName": "meta.catch.parameters.java", "patterns": [ { - "include": "#keywords" + "include": "#comments" }, { - "include": "#comments" + "include": "#storage-modifiers" }, { - "match": "\\b([a-z]\\w*\\.)*([A-Z]\\w*)\\b", - "captures": { - "2": { - "name": "entity.name.type" + "begin": "[a-zA-Z$_][\\.a-zA-Z0-9$_]*", + "beginCaptures": { + "0": { + "name": "storage.type.java" } - } + }, + "end": "(\\|)|(?=\\))", + "endCaptures": { + "1": { + "name": "punctuation.catch.separator.java" + } + }, + "patterns": [ + { + "include": "#comments" + }, + { + "match": "\\w+", + "captures": { + "0": { + "name": "variable.parameter.java" + } + } + } + ] + } + ] + }, + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.catch.begin.bracket.curly.java" + } + }, + "end": "(?=})", + "contentName": "meta.catch.body.java", + "patterns": [ + { + "include": "#code" } ] } - } + ] + }, + { + "begin": "\\bfinally\\b", + "beginCaptures": { + "0": { + "name": "keyword.control.finally.java" + } + }, + "end": "}", + "endCaptures": { + "0": { + "name": "punctuation.section.finally.end.bracket.curly.java" + } + }, + "name": "meta.finally.java", + "patterns": [ + { + "begin": "{", + "beginCaptures": { + "0": { + "name": "punctuation.section.finally.begin.bracket.curly.java" + } + }, + "end": "(?=})", + "contentName": "meta.finally.body.java", + "patterns": [ + { + "include": "#code" + } + ] + } + ] } ] }, - "new": { - "begin": "\\b(new)\\b", - "end": "(?=;|\\)|\\.|,|:|}|=)", - "name": "meta.new", - "captures": { - "1": { - "name": "keyword.control" - } - }, + "variables": { + "begin": "(?x)\n(?=\n \\b\n (\n (void|boolean|byte|char|short|int|float|long|double)\n |\n (?>(\\w+\\.)*[A-Z_]+\\w*) # e.g. `javax.ws.rs.Response`, or `String`\n )\n \\b\n \\s*\n (\n <[\\w<>,\\.?\\s\\[\\]]*> # e.g. `HashMap`, or `List`\n )?\n \\s*\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)", + "end": "(?=\\=|:|;)", + "name": "meta.definition.variable.java", "patterns": [ { - "include": "#expressions" - }, - { - "match": "\\b([a-z]\\w*\\.)*([A-Z]\\w*)\\b", + "match": "([A-Za-z$_][\\w$]*)(?=\\s*(\\[\\])*\\s*(;|:|=|,))", "captures": { - "2": { - "name": "entity.name.type" + "1": { + "name": "variable.other.definition.java" } } }, { - "begin": "{", - "end": "}", - "name": "meta.anonymous-class", - "patterns": [ - { - "include": "#class-declaration" - }, - { - "include": "#field-initializer" - }, - { - "include": "#method-declaration" - }, - { - "include": "#type-parameters-declaration" - }, - { - "include": "#block" - }, - { - "include": "#annotations" - }, - { - "include": "#keywords" - }, - { - "include": "#comments" - }, - { - "include": "#types" - } - ] + "include": "#all-types" + }, + { + "include": "#code" } ] }, - "type-arguments": { + "variables-local": { + "begin": "(?=\\b(var)\\b\\s+[A-Za-z_$][\\w$]*\\s*(=|:|;))", + "end": "(?=\\=|:|;)", + "name": "meta.definition.variable.local.java", "patterns": [ { - "match": "\\.(?<([^<>]|\\g)*>)", - "name": "meta.type-arguments", + "match": "\\bvar\\b", + "name": "storage.type.local.java" + }, + { + "match": "([A-Za-z$_][\\w$]*)(?=\\s*(\\[\\])*\\s*(=|:|;))", "captures": { "1": { - "patterns": [ - { - "include": "#keywords" - }, - { - "include": "#comments" - }, - { - "match": "\\b([a-z]\\w*\\.)*([A-Z]\\w*)\\b", - "captures": { - "2": { - "name": "entity.name.type" - } - } - } - ] + "name": "variable.other.definition.java" } } + }, + { + "include": "#code" } ] } From 7e226a28b07ed2599c593747e00801ddeceb8571 Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sat, 15 Jun 2024 23:05:40 +1000 Subject: [PATCH 2/3] Enable CI building for screenshot --- .github/workflows/release.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a7711159..90a08c16 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,8 +2,11 @@ name: Release on: push: - tags: - - release + branches: + - master + pull_request: + branches: + - master jobs: build: @@ -35,5 +38,8 @@ jobs: run: mvn --batch-mode package - name: Build extension run: npm run-script vscode:build - - name: Publish extension in VSCode marketplace - run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath build.vsix \ No newline at end of file + - name: Upload VSIX + uses: actions/upload-artifact@v4 + with: + name: vsix + path: build.vsix From a34c81462e754add52b51dd44174bbda96b78fda Mon Sep 17 00:00:00 2001 From: Jordan Mele Date: Sun, 16 Jun 2024 00:13:55 +1000 Subject: [PATCH 3/3] undo --- .github/workflows/release.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 90a08c16..a7711159 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,11 +2,8 @@ name: Release on: push: - branches: - - master - pull_request: - branches: - - master + tags: + - release jobs: build: @@ -38,8 +35,5 @@ jobs: run: mvn --batch-mode package - name: Build extension run: npm run-script vscode:build - - name: Upload VSIX - uses: actions/upload-artifact@v4 - with: - name: vsix - path: build.vsix + - name: Publish extension in VSCode marketplace + run: npx vsce publish --pat ${{ secrets.MARKETPLACE_TOKEN }} --packagePath build.vsix \ No newline at end of file