diff --git a/extensions/go/syntaxes/go.json b/extensions/go/syntaxes/go.json index aac3cac72fe..b4983d40002 100644 --- a/extensions/go/syntaxes/go.json +++ b/extensions/go/syntaxes/go.json @@ -170,6 +170,64 @@ } } }, + { + "comment": "Single line import declarations", + "match": "(?<=import)(\\s+((?!\\s+\")[^\\s]*)?\\s*)((\")([^\"]*)(\"))", + "captures": { + "2": { + "name": "entity.alias.import.go" + }, + "3": { + "name": "string.quoted.double.go" + }, + "4": { + "name": "punctuation.definition.string.begin.go" + }, + "5": { + "name": "entity.name.import.go" + }, + "6": { + "name": "punctuation.definition.string.end.go" + } + } + }, + { + "comment": "Multiline import declarations", + "begin": "(?<=import)\\s+(\\()", + "beginCaptures": { + "1": { + "name": "punctuation.other.bracket.round.go" + } + }, + "patterns": [ + { + "match": "((?!\\s+\")[^\\s]*)?\\s+((\")([^\"]*)(\"))", + "captures": { + "1": { + "name": "entity.alias.import.go" + }, + "2": { + "name": "string.quoted.double.go" + }, + "3": { + "name": "punctuation.definition.string.begin.go" + }, + "4": { + "name": "entity.name.import.go" + }, + "5": { + "name": "punctuation.definition.string.end.go" + } + } + } + ], + "end": "\\)", + "endCaptures": { + "0": { + "name": "punctuation.other.bracket.round.go" + } + } + }, { "comment": "Type declarations", "match": "(?<=type)\\s+([a-zA-Z_]\\w*)", @@ -549,5 +607,5 @@ ] } }, - "version": "https://github.com/atom/language-go/commit/93594dfb138a664f0914d54e408527e136899fb2" + "version": "https://github.com/atom/language-go/commit/d941ce3155b500e65b4d7fbc53ea51b9c92ec1cb" } \ No newline at end of file diff --git a/extensions/go/test/colorize-fixtures/test-13777.go b/extensions/go/test/colorize-fixtures/test-13777.go new file mode 100644 index 00000000000..a146307555c --- /dev/null +++ b/extensions/go/test/colorize-fixtures/test-13777.go @@ -0,0 +1 @@ +var e [][]*aType // ( bug in highligher?) \ No newline at end of file diff --git a/extensions/go/test/colorize-results/test-13777_go.json b/extensions/go/test/colorize-results/test-13777_go.json new file mode 100644 index 00000000000..b6fb84f6526 --- /dev/null +++ b/extensions/go/test/colorize-results/test-13777_go.json @@ -0,0 +1,57 @@ +[ + { + "c": "var", + "t": "go.keyword.var", + "r": { + "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.keyword rgb(86, 156, 214)", + "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.keyword rgb(0, 0, 255)", + "dark_vs": ".vs-dark.vscode-theme-defaults-themes-dark_vs-json .token.keyword rgb(86, 156, 214)", + "light_vs": ".vs.vscode-theme-defaults-themes-light_vs-json .token.keyword rgb(0, 0, 255)", + "hc_black": ".hc-black.vscode-theme-defaults-themes-hc_black-json .token.keyword rgb(86, 156, 214)" + } + }, + { + "c": " e [][]*aType // ( ", + "t": "", + "r": { + "dark_plus": ".vs-dark .token rgb(212, 212, 212)", + "light_plus": ".vs .token rgb(0, 0, 0)", + "dark_vs": ".vs-dark .token rgb(212, 212, 212)", + "light_vs": ".vs .token rgb(0, 0, 0)", + "hc_black": ".hc-black .token rgb(255, 255, 255)" + } + }, + { + "c": "bug", + "t": "declaration.go.other.variable", + "r": { + "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.variable rgb(156, 220, 254)", + "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.variable rgb(0, 16, 128)", + "dark_vs": ".vs-dark .token rgb(212, 212, 212)", + "light_vs": ".vs .token rgb(0, 0, 0)", + "hc_black": ".hc-black .token rgb(255, 255, 255)" + } + }, + { + "c": " in highligher?", + "t": "", + "r": { + "dark_plus": ".vs-dark .token rgb(212, 212, 212)", + "light_plus": ".vs .token rgb(0, 0, 0)", + "dark_vs": ".vs-dark .token rgb(212, 212, 212)", + "light_vs": ".vs .token rgb(0, 0, 0)", + "hc_black": ".hc-black .token rgb(255, 255, 255)" + } + }, + { + "c": ")", + "t": "bracket.go.other.punctuation.round", + "r": { + "dark_plus": ".vs-dark .token rgb(212, 212, 212)", + "light_plus": ".vs .token rgb(0, 0, 0)", + "dark_vs": ".vs-dark .token rgb(212, 212, 212)", + "light_vs": ".vs .token rgb(0, 0, 0)", + "hc_black": ".hc-black .token rgb(255, 255, 255)" + } + } +] \ No newline at end of file diff --git a/extensions/go/test/colorize-results/test_go.json b/extensions/go/test/colorize-results/test_go.json index 33160e16b3e..4b8295454e3 100644 --- a/extensions/go/test/colorize-results/test_go.json +++ b/extensions/go/test/colorize-results/test_go.json @@ -89,7 +89,7 @@ }, { "c": "encoding/base64", - "t": "double.go.quoted.string", + "t": "double.entity.go.import.name.quoted.string", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)", @@ -133,7 +133,7 @@ }, { "c": "fmt", - "t": "double.go.quoted.string", + "t": "double.entity.go.import.name.quoted.string", "r": { "dark_plus": ".vs-dark.vscode-theme-defaults-themes-dark_plus-json .token.string rgb(206, 145, 120)", "light_plus": ".vs.vscode-theme-defaults-themes-light_plus-json .token.string rgb(163, 21, 21)",