shiki 1.6.0 → 1.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "Gleam", "name": "gleam", "patterns": [{ "include": "#comments" }, { "include": "#keywords" }, { "include": "#strings" }, { "include": "#constant" }, { "include": "#entity" }], "repository": { "binary_number": { "match": "\\b0b[0-1]+\\b", "name": "constant.numeric.binary.gleam", "patterns": [] }, "boolean": { "match": "\\b(True|False)\\b", "name": "constant.language.boolean.gleam", "patterns": [] }, "comments": { "patterns": [{ "match": "//.*", "name": "comment.line.gleam" }] }, "constant": { "patterns": [{ "include": "#binary_number" }, { "include": "#octal_number" }, { "include": "#hexadecimal_number" }, { "include": "#decimal_number" }, { "include": "#boolean" }, { "match": "[[:upper:]][[:word:]]*", "name": "entity.name.type.gleam" }] }, "decimal_number": { "match": "\\b[[:digit:]]+(_?[[:digit:]])*(\\.[[:digit:]]*)?(e-?[[:digit:]]*)?\\b", "name": "constant.numeric.decimal.gleam", "patterns": [] }, "entity": { "patterns": [{ "begin": "\\b([[:lower:]][[:word:]]*)([[:space:]]*)?\\(", "captures": { "1": { "name": "entity.name.function.gleam" } }, "end": "\\)", "patterns": [{ "include": "$self" }] }, { "match": "\\b([[:lower:]][[:word:]]*):\\s", "name": "variable.parameter.gleam" }, { "match": "\\b([[:lower:]][[:word:]]*):", "name": "entity.name.namespace.gleam" }] }, "hexadecimal_number": { "match": "\\b0x[[:xdigit:]]+\\b", "name": "constant.numeric.hexadecimal.gleam", "patterns": [] }, "keywords": { "patterns": [{ "match": "\\b(as|use|case|if|fn|import|let|assert|pub|type|opaque|const|todo|panic)\\b", "name": "keyword.control.gleam" }, { "match": "(<\\-|\\->)", "name": "keyword.operator.arrow.gleam" }, { "match": "\\|>", "name": "keyword.operator.pipe.gleam" }, { "match": "\\.\\.", "name": "keyword.operator.splat.gleam" }, { "match": "(<=\\.|>=\\.|==\\.|!=\\.|<\\.|>\\.)", "name": "keyword.operator.comparison.float.gleam" }, { "match": "(<=|>=|==|!=|<|>)", "name": "keyword.operator.comparison.int.gleam" }, { "match": "(&&|\\|\\|)", "name": "keyword.operator.logical.gleam" }, { "match": "<>", "name": "keyword.operator.string.gleam" }, { "match": "\\|", "name": "keyword.operator.other.gleam" }, { "match": "(\\+\\.|\\-\\.|/\\.|\\*\\.|%\\.)", "name": "keyword.operator.arithmetic.float.gleam" }, { "match": "(\\+|\\-|/|\\*|%)", "name": "keyword.operator.arithmetic.int.gleam" }, { "match": "=", "name": "keyword.operator.assignment.gleam" }] }, "octal_number": { "match": "\\b0o[0-7]+\\b", "name": "constant.numeric.octal.gleam", "patterns": [] }, "strings": { "begin": '"', "end": '"', "name": "string.quoted.double.gleam", "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.gleam" }] } }, "scopeName": "source.gleam" });
1
+ const lang = Object.freeze({ "displayName": "Gleam", "name": "gleam", "patterns": [{ "include": "#comments" }, { "include": "#keywords" }, { "include": "#strings" }, { "include": "#constant" }, { "include": "#entity" }, { "include": "#discards" }], "repository": { "binary_number": { "match": "\\b0[bB](_?[01])+\\b", "name": "constant.numeric.binary.gleam", "patterns": [] }, "boolean": { "match": "\\b(True|False)\\b", "name": "constant.language.boolean.gleam", "patterns": [] }, "comments": { "patterns": [{ "match": "//.*", "name": "comment.line.gleam" }] }, "constant": { "patterns": [{ "include": "#binary_number" }, { "include": "#octal_number" }, { "include": "#hexadecimal_number" }, { "include": "#decimal_number" }, { "include": "#boolean" }, { "match": "[[:upper:]][[:word:]]*", "name": "entity.name.type.gleam" }] }, "decimal_number": { "match": "\\b[[:digit:]]+(_?[[:digit:]])*(\\.[[:digit:]]*)?(e-?[[:digit:]]*)?\\b", "name": "constant.numeric.decimal.gleam", "patterns": [] }, "discards": { "match": "\\b_(?:[[:word:]]+)?\\b", "name": "comment.unused.gleam" }, "entity": { "patterns": [{ "begin": "\\b([[:lower:]][[:word:]]*)([[:space:]]*)?\\(", "captures": { "1": { "name": "entity.name.function.gleam" } }, "end": "\\)", "patterns": [{ "include": "$self" }] }, { "match": "\\b([[:lower:]][[:word:]]*):\\s", "name": "variable.parameter.gleam" }, { "match": "\\b([[:lower:]][[:word:]]*):", "name": "entity.name.namespace.gleam" }] }, "hexadecimal_number": { "match": "\\b0[xX](_?[[:xdigit:]])+\\b", "name": "constant.numeric.hexadecimal.gleam", "patterns": [] }, "keywords": { "patterns": [{ "match": "\\b(as|use|case|if|fn|import|let|assert|pub|type|opaque|const|todo|panic)\\b", "name": "keyword.control.gleam" }, { "match": "(<\\-|\\->)", "name": "keyword.operator.arrow.gleam" }, { "match": "\\|>", "name": "keyword.operator.pipe.gleam" }, { "match": "\\.\\.", "name": "keyword.operator.splat.gleam" }, { "match": "(<=\\.|>=\\.|==\\.|!=\\.|<\\.|>\\.)", "name": "keyword.operator.comparison.float.gleam" }, { "match": "(<=|>=|==|!=|<|>)", "name": "keyword.operator.comparison.int.gleam" }, { "match": "(&&|\\|\\|)", "name": "keyword.operator.logical.gleam" }, { "match": "<>", "name": "keyword.operator.string.gleam" }, { "match": "\\|", "name": "keyword.operator.other.gleam" }, { "match": "(\\+\\.|\\-\\.|/\\.|\\*\\.|%\\.)", "name": "keyword.operator.arithmetic.float.gleam" }, { "match": "(\\+|\\-|/|\\*|%)", "name": "keyword.operator.arithmetic.int.gleam" }, { "match": "=", "name": "keyword.operator.assignment.gleam" }] }, "octal_number": { "match": "\\b0[oO](_?[0-7])+\\b", "name": "constant.numeric.octal.gleam", "patterns": [] }, "strings": { "begin": '"', "end": '"', "name": "string.quoted.double.gleam", "patterns": [{ "match": "\\\\.", "name": "constant.character.escape.gleam" }] } }, "scopeName": "source.gleam" });
2
2
  var gleam = [
3
3
  lang
4
4
  ];
package/dist/langs/go.mjs CHANGED
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "Go", "name": "go", "patterns": [{ "include": "#statements" }], "repository": { "after_control_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "(?:\\w+)", "name": "variable.other.go" }] } }, "comment": "After control variables, to not highlight as a struct/interface (before formatting with gofmt)", "match": "(?:(?<=\\brange\\b|\\bswitch\\b|\\;|\\bif\\b|\\bfor\\b|\\<|\\>|\\<\\=|\\>\\=|\\=\\=|\\!\\=|\\w(?:\\+|/|\\-|\\*|\\%)|\\w(?:\\+|/|\\-|\\*|\\%)\\=|\\|\\||\\&\\&)(?:\\s*)((?![\\[\\]]+)[[:alnum:]\\-\\_\\!\\.\\[\\]\\<\\>\\=\\*/\\+\\%\\:]+)(?:\\s*)(?=\\{))" }, "brackets": { "patterns": [{ "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "$self" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "$self" }] }, { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "$self" }] }] }, "built_in_functions": { "comment": "Built-in functions", "patterns": [{ "match": "\\b(append|cap|close|complex|copy|delete|imag|len|panic|print|println|real|recover|min|max|clear)\\b(?=\\()", "name": "entity.name.function.support.builtin.go" }, { "begin": "(?:(\\bnew\\b)(\\())", "beginCaptures": { "1": { "name": "entity.name.function.support.builtin.go" }, "2": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "new keyword", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#functions" }, { "include": "#struct_variables_types" }, { "include": "#type-declarations" }, { "include": "#generic_types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }, { "include": "$self" }] }, { "captures": { "1": { "name": "entity.name.function.support.builtin.go" }, "2": { "name": "punctuation.definition.begin.bracket.round.go" }, "3": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "4": { "patterns": [{ "include": "$self" }] }, "5": { "name": "punctuation.definition.end.bracket.round.go" } }, "comment": "make keyword", "match": "(?:(\\bmake\\b)(?:(\\()((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?:[\\w\\.\\*\\[\\]\\{\\}]+)?(?:\\[(?:[^\\]]+)?\\])?(?:[\\w\\.\\*\\[\\]\\{\\}]+)?)?((?:\\,\\s*(?:[\\w\\.\\(\\)/\\+\\-\\<\\>\\&\\|\\%\\*]+)?)+)?(\\))))" }] }, "comments": { "patterns": [{ "begin": "(\\/\\*)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.go" } }, "end": "(\\*\\/)", "endCaptures": { "1": { "name": "punctuation.definition.comment.go" } }, "name": "comment.block.go" }, { "begin": "(\\/\\/)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.go" } }, "end": "(?:\\n|$)", "name": "comment.line.double-slash.go" }] }, "delimiters": { "patterns": [{ "match": "\\,", "name": "punctuation.other.comma.go" }, { "match": "\\.(?!\\.\\.)", "name": "punctuation.other.period.go" }, { "match": ":(?!=)", "name": "punctuation.other.colon.go" }] }, "double_parentheses_types": { "captures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "double parentheses types", "match": "(?:(?<!\\w)(\\((?:[\\w\\.\\[\\]\\*\\&]+)\\))(?=\\())" }, "function_declaration": { "begin": "(?:^(\\bfunc\\b)(?:\\s*(\\([^\\)]+\\)\\s*)?(?:(\\w+)(?=\\(|\\[))?))", "beginCaptures": { "1": { "name": "keyword.function.go" }, "2": { "patterns": [{ "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "captures": { "1": { "name": "variable.parameter.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "match": "(?:(\\w+(?:\\s+))?((?:[\\w\\.\\*]+)(?:\\[(?:(?:(?:[\\w\\.\\*]+)(?:\\,\\s+)?)+)?\\])?))" }, { "include": "$self" }] }] }, "3": { "patterns": [{ "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "entity.name.function.go" }] } }, "comment": "Function declarations", "end": "(?:(?<=\\))\\s*((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?(?:\\bstruct\\b|\\binterface\\b))[\\w\\.\\-\\*\\[\\]]+)?\\s*(?=\\{))", "endCaptures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "patterns": [{ "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }] }, { "begin": "(?:([\\w\\.\\*]+)?(\\[))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#generic_param_types" }] }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "single function as a type returned type(s) declaration", "match": "(?:(?<=\\))(?:\\s*)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?[\\w\\*\\.\\[\\]\\<\\>\\-]+(?:\\s*)(?:\\/(?:\\/|\\*).*)?)$)" }, { "include": "$self" }] }, "function_param_types": { "comment": "function parameter variables and types", "patterns": [{ "include": "#struct_variables_types" }, { "include": "#interface_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "struct/interface type declaration", "match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "multiple parameters one type -with multilines", "match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)" }, { "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.parameter.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "multiple params and types | multiple params one type | one param one type", "match": "(?:((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)(?:\\s+)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?:(?:[\\w\\[\\]\\.\\*]+)?(?:(?:\\bfunc\\b\\((?:[^\\)]+)?\\))(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*))+(?:(?:(?:[\\w\\*\\.\\[\\]]+)|(?:\\((?:[^\\)]+)?\\))))?)|(?:(?:[\\[\\]\\*]+)?[\\w\\*\\.]+(?:\\[(?:[^\\]]+)\\])?(?:[\\w\\.\\*]+)?)+)))" }, { "include": "#parameter-variable-types" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "other types", "match": "([\\w\\.]+)" }, { "include": "$self" }] }, "functions": { "begin": "(?:(\\bfunc\\b)(?=\\())", "beginCaptures": { "1": { "name": "keyword.function.go" } }, "comment": "Functions", "end": "(?:(?<=\\))(\\s*(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?((?:(?:\\s*(?:(?:[\\[\\]\\*]+)?[\\w\\.\\*]+)?(?:(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\])|(?:\\((?:[^\\)]+)?\\)))?(?:[\\w\\.\\*]+)?)(?:\\s*)(?=\\{))|(?:\\s*(?:(?:(?:[\\[\\]\\*]+)?(?!\\bfunc\\b)(?:[\\w\\.\\*]+)(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\])?(?:[\\w\\.\\*]+)?)|(?:\\((?:[^\\)]+)?\\)))))?)", "endCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "patterns": [{ "include": "#parameter-variable-types" }] }, "functions_inline": { "captures": { "1": { "name": "keyword.function.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }, { "include": "$self" }] }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "functions in-line with multi return types", "match": "(?:(\\bfunc\\b)((?:\\((?:[^/]*?)\\))(?:\\s+)(?:\\((?:[^/]*?)\\)))(?:\\s+)(?=\\{))" }, "generic_param_types": { "comment": "generic parameter variables and types", "patterns": [{ "include": "#struct_variables_types" }, { "include": "#interface_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "struct/interface type declaration", "match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "multiple parameters one type -with multilines", "match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)" }, { "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.parameter.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "3": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "multiple params and types | multiple types one param", "match": "(?:((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)(?:\\s+)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?:(?:[\\w\\[\\]\\.\\*]+)?(?:(?:\\bfunc\\b\\((?:[^\\)]+)?\\))(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*))+(?:(?:(?:[\\w\\*\\.]+)|(?:\\((?:[^\\)]+)?\\))))?)|(?:(?:(?:[\\w\\*\\.\\~]+)|(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\]))(?:[\\w\\.\\*]+)?)+)))" }, { "include": "#parameter-variable-types" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "other types", "match": "(?:\\b([\\w\\.]+))" }, { "include": "$self" }] }, "generic_types": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "2": { "patterns": [{ "include": "#parameter-variable-types" }] } }, "comment": "Generic support for all types", "match": "(?:([\\w\\.\\*]+)(\\[(?:[^\\]]+)?\\]))" }, "group-functions": { "comment": "all statements related to functions", "patterns": [{ "include": "#function_declaration" }, { "include": "#functions_inline" }, { "include": "#functions" }, { "include": "#built_in_functions" }, { "include": "#support_functions" }] }, "group-types": { "comment": "all statements related to types", "patterns": [{ "include": "#other_struct_interface_expressions" }, { "include": "#type_assertion_inline" }, { "include": "#struct_variables_types" }, { "include": "#interface_variables_types" }, { "include": "#single_type" }, { "include": "#multi_types" }, { "include": "#struct_interface_declaration" }, { "include": "#double_parentheses_types" }, { "include": "#switch_types" }, { "include": "#type-declarations" }] }, "group-variables": { "comment": "all statements related to variables", "patterns": [{ "include": "#var_const_assignment" }, { "include": "#variable_assignment" }, { "include": "#label_loop_variables" }, { "include": "#slice_index_variables" }, { "include": "#property_variables" }, { "include": "#switch_select_case_variables" }, { "include": "#other_variables" }] }, "import": { "comment": "import", "patterns": [{ "begin": "\\b(import)\\s+", "beginCaptures": { "1": { "name": "keyword.control.import.go" } }, "comment": "import", "end": "(?!\\G)", "patterns": [{ "include": "#imports" }] }] }, "imports": { "comment": "import package(s)", "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "(?:\\w+)", "name": "variable.other.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" } }, "match": '(\\s*[\\w\\.]+)?\\s*((")([^"]*)("))' }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.imports.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.imports.end.bracket.round.go" } }, "patterns": [{ "include": "#comments" }, { "include": "#imports" }] }, { "include": "$self" }] }, "interface_variables_types": { "begin": "(\\binterface\\b)\\s*(\\{)", "beginCaptures": { "1": { "name": "keyword.interface.go" }, "2": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "interface variable types", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#interface_variables_types_field" }, { "include": "$self" }] }, "interface_variables_types_field": { "comment": "interface variable type fields", "patterns": [{ "include": "#support_functions" }, { "include": "#type-declarations-without-brackets" }, { "begin": "(?:([\\w\\.\\*]+)?(\\[))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#generic_param_types" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }] }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "other types", "match": "([\\w\\.]+)" }] }, "keywords": { "patterns": [{ "comment": "Flow control keywords", "match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b", "name": "keyword.control.go" }, { "match": "\\bchan\\b", "name": "keyword.channel.go" }, { "match": "\\bconst\\b", "name": "keyword.const.go" }, { "match": "\\bvar\\b", "name": "keyword.var.go" }, { "match": "\\bfunc\\b", "name": "keyword.function.go" }, { "match": "\\binterface\\b", "name": "keyword.interface.go" }, { "match": "\\bmap\\b", "name": "keyword.map.go" }, { "match": "\\bstruct\\b", "name": "keyword.struct.go" }, { "match": "\\bimport\\b", "name": "keyword.control.import.go" }, { "match": "\\btype\\b", "name": "keyword.type.go" }] }, "label_loop_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.label.go" }] } }, "comment": "labeled loop variable name", "match": "((?:^\\s*\\w+:\\s*$)|(?:^\\s*(?:\\bbreak\\b|\\bgoto\\b|\\bcontinue\\b)\\s+\\w+(?:\\s*/(?:/|\\*)\\s*.*)?$))" }, "language_constants": { "captures": { "1": { "name": "constant.language.boolean.go" }, "2": { "name": "constant.language.null.go" }, "3": { "name": "constant.language.iota.go" } }, "comment": "Language constants", "match": "\\b(?:(true|false)|(nil)|(iota))\\b" }, "map_types": { "begin": "(?:(\\bmap\\b)(\\[))", "beginCaptures": { "1": { "name": "keyword.map.go" }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "comment": "map types", "end": "(?:(\\])((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?\\b(?:func|struct|map)\\b)(?:[\\*\\[\\]]+)?(?:[\\w\\.]+))?)", "endCaptures": { "1": { "name": "punctuation.definition.end.bracket.square.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "include": "#functions" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "multi_types": { "begin": "(\\btype\\b)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.type.go" }, "2": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "multi type declaration", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#struct_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "numeric_literals": { "captures": { "0": { "patterns": [{ "begin": "(?=.)", "end": "(?:\\n|$)", "patterns": [{ "captures": { "1": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "2": { "name": "punctuation.separator.constant.numeric.go" }, "3": { "name": "constant.numeric.decimal.point.go" }, "4": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "5": { "name": "punctuation.separator.constant.numeric.go" }, "6": { "name": "keyword.other.unit.exponent.decimal.go" }, "7": { "name": "keyword.operator.plus.exponent.decimal.go" }, "8": { "name": "keyword.operator.minus.exponent.decimal.go" }, "9": { "name": "constant.numeric.exponent.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "10": { "name": "keyword.other.unit.imaginary.go" }, "11": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "12": { "name": "punctuation.separator.constant.numeric.go" }, "13": { "name": "keyword.other.unit.exponent.decimal.go" }, "14": { "name": "keyword.operator.plus.exponent.decimal.go" }, "15": { "name": "keyword.operator.minus.exponent.decimal.go" }, "16": { "name": "constant.numeric.exponent.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "17": { "name": "keyword.other.unit.imaginary.go" }, "18": { "name": "constant.numeric.decimal.point.go" }, "19": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "20": { "name": "punctuation.separator.constant.numeric.go" }, "21": { "name": "keyword.other.unit.exponent.decimal.go" }, "22": { "name": "keyword.operator.plus.exponent.decimal.go" }, "23": { "name": "keyword.operator.minus.exponent.decimal.go" }, "24": { "name": "constant.numeric.exponent.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "25": { "name": "keyword.other.unit.imaginary.go" }, "26": { "name": "keyword.other.unit.hexadecimal.go" }, "27": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "28": { "name": "punctuation.separator.constant.numeric.go" }, "29": { "name": "constant.numeric.hexadecimal.go" }, "30": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "31": { "name": "punctuation.separator.constant.numeric.go" }, "32": { "name": "keyword.other.unit.exponent.hexadecimal.go" }, "33": { "name": "keyword.operator.plus.exponent.hexadecimal.go" }, "34": { "name": "keyword.operator.minus.exponent.hexadecimal.go" }, "35": { "name": "constant.numeric.exponent.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "36": { "name": "keyword.other.unit.imaginary.go" }, "37": { "name": "keyword.other.unit.hexadecimal.go" }, "38": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "39": { "name": "punctuation.separator.constant.numeric.go" }, "40": { "name": "keyword.other.unit.exponent.hexadecimal.go" }, "41": { "name": "keyword.operator.plus.exponent.hexadecimal.go" }, "42": { "name": "keyword.operator.minus.exponent.hexadecimal.go" }, "43": { "name": "constant.numeric.exponent.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "44": { "name": "keyword.other.unit.imaginary.go" }, "45": { "name": "keyword.other.unit.hexadecimal.go" }, "46": { "name": "constant.numeric.hexadecimal.go" }, "47": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "48": { "name": "punctuation.separator.constant.numeric.go" }, "49": { "name": "keyword.other.unit.exponent.hexadecimal.go" }, "50": { "name": "keyword.operator.plus.exponent.hexadecimal.go" }, "51": { "name": "keyword.operator.minus.exponent.hexadecimal.go" }, "52": { "name": "constant.numeric.exponent.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "53": { "name": "keyword.other.unit.imaginary.go" } }, "match": "(?:(?:(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$)|\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|\\G((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))" }, { "captures": { "1": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "2": { "name": "punctuation.separator.constant.numeric.go" }, "3": { "name": "keyword.other.unit.imaginary.go" }, "4": { "name": "keyword.other.unit.binary.go" }, "5": { "name": "constant.numeric.binary.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "6": { "name": "punctuation.separator.constant.numeric.go" }, "7": { "name": "keyword.other.unit.imaginary.go" }, "8": { "name": "keyword.other.unit.octal.go" }, "9": { "name": "constant.numeric.octal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "10": { "name": "punctuation.separator.constant.numeric.go" }, "11": { "name": "keyword.other.unit.imaginary.go" }, "12": { "name": "keyword.other.unit.hexadecimal.go" }, "13": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "14": { "name": "punctuation.separator.constant.numeric.go" }, "15": { "name": "keyword.other.unit.imaginary.go" } }, "match": "(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$)|(\\G0[bB])_?([01](?:[01]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))|(\\G0[oO]?)_?((?:[0-7]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))+)(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))" }, { "match": "(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])+", "name": "invalid.illegal.constant.numeric.go" }] }] } }, "match": "(?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])*" }, "operators": { "comment": "Note that the order here is very important!", "patterns": [{ "match": "((?:\\*|\\&)+)(?:(?!\\d)(?=(?:[\\w\\[\\]])|(?:\\<\\-)))", "name": "keyword.operator.address.go" }, { "match": "<\\-", "name": "keyword.operator.channel.go" }, { "match": "\\-\\-", "name": "keyword.operator.decrement.go" }, { "match": "\\+\\+", "name": "keyword.operator.increment.go" }, { "match": "(==|!=|<=|>=|<(?!<)|>(?!>))", "name": "keyword.operator.comparison.go" }, { "match": "(&&|\\|\\||!)", "name": "keyword.operator.logical.go" }, { "match": "(=|\\+=|\\-=|\\|=|\\^=|\\*=|/=|:=|%=|<<=|>>=|&\\^=|&=)", "name": "keyword.operator.assignment.go" }, { "match": "(\\+|\\-|\\*|/|%)", "name": "keyword.operator.arithmetic.go" }, { "match": "(&(?!\\^)|\\||\\^|&\\^|<<|>>|\\~)", "name": "keyword.operator.arithmetic.bitwise.go" }, { "match": "\\.\\.\\.", "name": "keyword.operator.ellipsis.go" }] }, "other_struct_interface_expressions": { "comment": "struct and interface expression in-line (before curly bracket)", "patterns": [{ "comment": "after control variables must be added exactly here, do not move it! (changing may not affect tests, so be careful!)", "include": "#after_control_variables" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "2": { "patterns": [{ "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }, { "include": "$self" }] }] } }, "match": "(\\b[\\w\\.]+)(\\[(?:[^\\]]+)?\\])?(?=\\{)(?<!\\bstruct\\b|\\binterface\\b)" }] }, "other_variables": { "comment": "all other variables", "match": "\\w+", "name": "variable.other.go" }, "package_name": { "patterns": [{ "begin": "\\b(package)\\s+", "beginCaptures": { "1": { "name": "keyword.package.go" } }, "comment": "package name", "end": "(?!\\G)", "patterns": [{ "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "entity.name.type.package.go" }] }] }, "parameter-variable-types": { "comment": "function and generic parameter types", "patterns": [{ "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "begin": "(?:([\\w\\.\\*]+)?(\\[))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#generic_param_types" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }] }] }, "property_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }, { "include": "$self" }] }, "3": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.field.go" }, { "include": "$self" }] }, "4": { "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.field.go" }] } }, "match": "([\\w\\.\\*\\&\\[\\]]+)(\\.\\w+)" }, { "include": "$self" }] } }, "comment": "Property variables in struct | parameter field in struct initialization", "match": "(?:(?:((?:\\b[\\w\\.]+)(?:\\:(?!\\=))))(?:(?:\\s*([\\w\\.\\*\\&\\[\\]]+)(\\.\\w+)(?![\\w\\.\\*\\&\\[\\]]*(?:\\{|\\()))((?:\\s*(?:\\<|\\>|\\<\\=|\\>\\=|\\=\\=|\\!\\=|\\|\\||\\&\\&|\\+|/|\\-|\\*|\\%|\\||\\&)\\s*(?:[\\w\\.\\*\\&\\[\\]]+)(?:\\.\\w+)(?![\\w\\.\\*\\&\\[\\]]*(?:\\{|\\()))*))?)" }, "raw_string_literals": { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.go" } }, "comment": "Raw string literals", "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.go" } }, "name": "string.quoted.raw.go", "patterns": [{ "include": "#string_placeholder" }] }, "runes": { "patterns": [{ "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.go" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.go" } }, "name": "string.quoted.rune.go", "patterns": [{ "match": `\\G(\\\\([0-7]{3}|[abfnrtv\\\\'"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})|.)(?=')`, "name": "constant.other.rune.go" }, { "match": "[^']+", "name": "invalid.illegal.unknown-rune.go" }] }] }, "single_type": { "patterns": [{ "captures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "3": { "patterns": [{ "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }, { "include": "$self" }] }, { "include": "#type-declarations" }, { "include": "#generic_types" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "single type declaration", "match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?:\\s+)(?!(?:\\=\\s*)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b)([\\s\\S]+))" }, { "begin": "(?:(?:^|\\s+)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?=\\[))", "beginCaptures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "single type declaration with generics", "end": "(?:(?<=\\])((?:\\s+)(?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?!(?:[\\[\\]\\*]+)?(?:\\bstruct\\b|\\binterface\\b|\\bfunc\\b))[\\w\\.\\-\\*\\[\\]]+))?)", "endCaptures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "patterns": [{ "include": "#struct_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] }] }, "slice_index_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }] } }, "comment": "slice index and capacity variables, to not scope them as property variables", "match": "(?<=\\w\\[)((?:(?:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+\\:)|(?:\\:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+))(?:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+)?(?:\\:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+)?)(?=\\])" }, "statements": { "patterns": [{ "include": "#package_name" }, { "include": "#import" }, { "include": "#syntax_errors" }, { "include": "#group-functions" }, { "include": "#group-types" }, { "include": "#group-variables" }] }, "storage_types": { "patterns": [{ "match": "\\bbool\\b", "name": "storage.type.boolean.go" }, { "match": "\\bbyte\\b", "name": "storage.type.byte.go" }, { "match": "\\berror\\b", "name": "storage.type.error.go" }, { "match": "\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\b", "name": "storage.type.numeric.go" }, { "match": "\\brune\\b", "name": "storage.type.rune.go" }, { "match": "\\bstring\\b", "name": "storage.type.string.go" }, { "match": "\\buintptr\\b", "name": "storage.type.uintptr.go" }, { "match": "\\bany\\b", "name": "entity.name.type.any.go" }] }, "string_escaped_char": { "patterns": [{ "match": `\\\\([0-7]{3}|[abfnrtv\\\\'"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})`, "name": "constant.character.escape.go" }, { "match": `\\\\[^0-7xuUabfnrtv\\'"]`, "name": "invalid.illegal.unknown-escape.go" }] }, "string_literals": { "patterns": [{ "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.go" } }, "comment": "Interpreted string literals", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.go" } }, "name": "string.quoted.double.go", "patterns": [{ "include": "#string_escaped_char" }, { "include": "#string_placeholder" }] }] }, "string_placeholder": { "patterns": [{ "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGspw]", "name": "constant.other.placeholder.go" }] }, "struct_interface_declaration": { "captures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "struct, interface type declarations (related to: struct_variables_types, interface_variables_types)", "match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.]+))" }, "struct_variable_types_fields_multi": { "comment": "struct variable and type fields with multi lines", "patterns": [{ "begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\bstruct\\b)(?:\\s*)(\\{))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "name": "keyword.struct.go" }, "3": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "struct in struct types", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#struct_variables_types_fields" }, { "include": "$self" }] }, { "begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\binterface\\b)(?:\\s*)(\\{))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "name": "keyword.interface.go" }, "3": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "interface in struct types", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#interface_variables_types_field" }, { "include": "$self" }] }, { "begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\bfunc\\b)(?:\\s*)(\\())", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "name": "keyword.function.go" }, "3": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "function in struct types", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }, { "include": "$self" }] }, { "include": "#parameter-variable-types" }] }, "struct_variables_types": { "begin": "(\\bstruct\\b)\\s*(\\{)", "beginCaptures": { "1": { "name": "keyword.struct.go" }, "2": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "Struct variable type", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#struct_variables_types_fields" }, { "include": "$self" }] }, "struct_variables_types_fields": { "comment": "Struct variable type fields", "patterns": [{ "include": "#struct_variable_types_fields_multi" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "one line - single type", "match": "(?:(?<=\\{)\\s*((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+))\\s*(?=\\}))" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "one line - property variables and types", "match": "(?:(?<=\\{)\\s*((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+))\\s*(?=\\}))" }, { "captures": { "1": { "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\S]+)(?:\\;)?))" }] } }, "comment": "one line with semicolon(;) without formatting gofmt - single type | property variables and types", "match": "(?:(?<=\\{)((?:\\s*(?:(?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?(?:(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\S]+)(?:\\;)?))+)\\s*(?=\\}))" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "one type only", "match": '(?:((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?<!\\,\\s*)(?:[\\w\\.\\*]+)\\s*(?:(?:(?:".*")|(?:\\`.*\\`))\\s*)?(?:/(?:/|\\*).*)?)$)' }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "property variables and types", "match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))([\\s\\S]+))" }] }, "support_functions": { "captures": { "1": { "name": "entity.name.function.support.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "entity.name.function.support.go" }] }, "3": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "Support Functions", "match": `(?:(?:((?<=\\.)\\b\\w+)|(\\b\\w+))(\\[(?:(?:[\\w\\.\\*\\[\\]\\{\\}"\\']+)(?:(?:\\,\\s*(?:[\\w\\.\\*\\[\\]\\{\\}]+))*))?\\])?(?=\\())` }, "switch_select_case_variables": { "captures": { "1": { "name": "keyword.control.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "include": "#support_functions" }, { "include": "#variable_assignment" }, { "match": "\\w+", "name": "variable.other.go" }] } }, "comment": "variables after case control keyword in switch/select expression, to not scope them as property variables", "match": "(?:(?:^\\s*(\\bcase\\b))(?:\\s+)([\\s\\S]+(?:\\:)\\s*(?:/(?:/|\\*).*)?)$)" }, "switch_types": { "begin": "(?<=\\bswitch\\b)(?:\\s*)(?:(\\w+\\s*\\:\\=)?\\s*([\\w\\.\\*\\(\\)\\[\\]]+))(\\.\\(\\btype\\b\\)\\s*)(\\{)", "beginCaptures": { "1": { "patterns": [{ "include": "#operators" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] }, "2": { "patterns": [{ "include": "#support_functions" }, { "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }] }, "3": { "patterns": [{ "include": "#delimiters" }, { "include": "#brackets" }, { "match": "\\btype\\b", "name": "keyword.type.go" }] }, "4": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "switch type assertions, only highlights types after case keyword", "end": "(?:\\})", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "captures": { "1": { "name": "keyword.control.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "3": { "name": "punctuation.other.colon.go" }, "4": { "patterns": [{ "include": "#comments" }] } }, "comment": "types after case keyword with single line", "match": "(?:^\\s*(\\bcase\\b))(?:\\s+)([\\w\\.\\,\\*\\=\\<\\>\\!\\s]+)(:)(\\s*/(?:/|\\*)\\s*.*)?$" }, { "begin": "\\bcase\\b", "beginCaptures": { "0": { "name": "keyword.control.go" } }, "comment": "types after case keyword with multi lines", "end": "\\:", "endCaptures": { "0": { "name": "punctuation.other.colon.go" } }, "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, { "include": "$self" }] }, "syntax_errors": { "patterns": [{ "captures": { "1": { "name": "invalid.illegal.slice.go" } }, "comment": "Syntax error using slices", "match": "\\[\\](\\s+)" }, { "comment": "Syntax error numeric literals", "match": "\\b0[0-7]*[89]\\d*\\b", "name": "invalid.illegal.numeric.go" }] }, "terminators": { "comment": "Terminators", "match": ";", "name": "punctuation.terminator.go" }, "type-declarations": { "comment": "includes all type declarations", "patterns": [{ "include": "#language_constants" }, { "include": "#comments" }, { "include": "#map_types" }, { "include": "#brackets" }, { "include": "#delimiters" }, { "include": "#keywords" }, { "include": "#operators" }, { "include": "#runes" }, { "include": "#storage_types" }, { "include": "#raw_string_literals" }, { "include": "#string_literals" }, { "include": "#numeric_literals" }, { "include": "#terminators" }] }, "type-declarations-without-brackets": { "comment": "includes all type declarations without brackets (in some cases, brackets need to be captured manually)", "patterns": [{ "include": "#language_constants" }, { "include": "#comments" }, { "include": "#map_types" }, { "include": "#delimiters" }, { "include": "#keywords" }, { "include": "#operators" }, { "include": "#runes" }, { "include": "#storage_types" }, { "include": "#raw_string_literals" }, { "include": "#string_literals" }, { "include": "#numeric_literals" }, { "include": "#terminators" }] }, "type_assertion_inline": { "captures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "struct/interface types in-line (type assertion) | switch type keyword", "match": "(?:(?<=\\.\\()(?:(\\btype\\b)|((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?[\\w\\.\\[\\]\\*]+))(?=\\)))" }, "var_const_assignment": { "comment": "variable assignment with var and const keyword", "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#generic_types" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "var and const with single type assignment", "match": "(?:(?<=\\bvar\\b|\\bconst\\b)(?:\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)" }, { "begin": "(?:(?<=\\bvar\\b|\\bconst\\b)(?:\\s*)(\\())", "beginCaptures": { "1": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "var and const with multi type assignment", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#generic_types" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "match": "(?:(?:^\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)" }, { "include": "$self" }] }] }, "variable_assignment": { "comment": "variable assignment", "patterns": [{ "captures": { "0": { "patterns": [{ "include": "#delimiters" }, { "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] } }, "comment": "variable assignment with :=", "match": "\\b\\w+(?:\\,\\s*\\w+)*(?=\\s*:=)" }, { "captures": { "0": { "patterns": [{ "include": "#delimiters" }, { "include": "#operators" }, { "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] } }, "comment": "variable assignment with =", "match": "\\b[\\w\\.\\*]+(?:\\,\\s*[\\w\\.\\*]+)*(?=\\s*=(?!=))" }] } }, "scopeName": "source.go" });
1
+ const lang = Object.freeze({ "displayName": "Go", "name": "go", "patterns": [{ "include": "#statements" }], "repository": { "after_control_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "(?:\\w+)", "name": "variable.other.go" }] } }, "comment": "After control variables, to not highlight as a struct/interface (before formatting with gofmt)", "match": "(?:(?<=\\brange\\b|\\bswitch\\b|\\;|\\bif\\b|\\bfor\\b|\\<|\\>|\\<\\=|\\>\\=|\\=\\=|\\!\\=|\\w(?:\\+|/|\\-|\\*|\\%)|\\w(?:\\+|/|\\-|\\*|\\%)\\=|\\|\\||\\&\\&)(?:\\s*)((?![\\[\\]]+)[[:alnum:]\\-\\_\\!\\.\\[\\]\\<\\>\\=\\*/\\+\\%\\:]+)(?:\\s*)(?=\\{))" }, "brackets": { "patterns": [{ "begin": "\\{", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "$self" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "$self" }] }, { "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "$self" }] }] }, "built_in_functions": { "comment": "Built-in functions", "patterns": [{ "match": "\\b(append|cap|close|complex|copy|delete|imag|len|panic|print|println|real|recover|min|max|clear)\\b(?=\\()", "name": "entity.name.function.support.builtin.go" }, { "begin": "(?:(\\bnew\\b)(\\())", "beginCaptures": { "1": { "name": "entity.name.function.support.builtin.go" }, "2": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "new keyword", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#functions" }, { "include": "#struct_variables_types" }, { "include": "#type-declarations" }, { "include": "#generic_types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }, { "include": "$self" }] }, { "begin": "(?:(\\bmake\\b)(?:(\\()((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?:[\\[\\]\\*]+)?(?:(?!\\bmap\\b)(?:[\\w\\.]+))?(\\[(?:(?:[\\S]+)(?:(?:\\,\\s*(?:[\\S]+))*))?\\])?(?:\\,)?)?))", "beginCaptures": { "1": { "name": "entity.name.function.support.builtin.go" }, "2": { "name": "punctuation.definition.begin.bracket.round.go" }, "3": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "make keyword", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "$self" }] }] }, "comments": { "patterns": [{ "begin": "(\\/\\*)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.go" } }, "end": "(\\*\\/)", "endCaptures": { "1": { "name": "punctuation.definition.comment.go" } }, "name": "comment.block.go" }, { "begin": "(\\/\\/)", "beginCaptures": { "1": { "name": "punctuation.definition.comment.go" } }, "end": "(?:\\n|$)", "name": "comment.line.double-slash.go" }] }, "delimiters": { "patterns": [{ "match": "\\,", "name": "punctuation.other.comma.go" }, { "match": "\\.(?!\\.\\.)", "name": "punctuation.other.period.go" }, { "match": ":(?!=)", "name": "punctuation.other.colon.go" }] }, "double_parentheses_types": { "captures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "double parentheses types", "match": "(?:(?<!\\w)(\\((?:[\\w\\.\\[\\]\\*\\&]+)\\))(?=\\())" }, "field_hover": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\binvalid\\b\\s+\\btype\\b", "name": "invalid.field.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "struct field property and types when hovering with the mouse", "match": "(?:(?<=^\\bfield\\b)\\s+([\\w\\*\\.]+)\\s+([\\s\\S]+))" }, "function_declaration": { "begin": "(?:^(\\bfunc\\b)(?:\\s*(\\([^\\)]+\\)\\s*)?(?:(\\w+)(?=\\(|\\[))?))", "beginCaptures": { "1": { "name": "keyword.function.go" }, "2": { "patterns": [{ "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "captures": { "1": { "name": "variable.parameter.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "match": "(?:(\\w+(?:\\s+))?((?:[\\w\\.\\*]+)(?:\\[(?:(?:(?:[\\w\\.\\*]+)(?:\\,\\s+)?)+)?\\])?))" }, { "include": "$self" }] }] }, "3": { "patterns": [{ "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "entity.name.function.go" }] } }, "comment": "Function declarations", "end": "(?:(?<=\\))\\s*((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?(?:\\bstruct\\b|\\binterface\\b))[\\w\\.\\-\\*\\[\\]]+)?\\s*(?=\\{))", "endCaptures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "patterns": [{ "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }] }, { "begin": "(?:([\\w\\.\\*]+)?(\\[))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#generic_param_types" }] }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "single function as a type returned type(s) declaration", "match": "(?:(?<=\\))(?:\\s*)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?[\\w\\*\\.\\[\\]\\<\\>\\-]+(?:\\s*)(?:\\/(?:\\/|\\*).*)?)$)" }, { "include": "$self" }] }, "function_param_types": { "comment": "function parameter variables and types", "patterns": [{ "include": "#struct_variables_types" }, { "include": "#interface_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "struct/interface type declaration", "match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "multiple parameters one type -with multilines", "match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)" }, { "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.parameter.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "multiple params and types | multiple params one type | one param one type", "match": "(?:((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)(?:\\s+)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?:(?:[\\w\\[\\]\\.\\*]+)?(?:(?:\\bfunc\\b\\((?:[^\\)]+)?\\))(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*))+(?:(?:(?:[\\w\\*\\.\\[\\]]+)|(?:\\((?:[^\\)]+)?\\))))?)|(?:(?:[\\[\\]\\*]+)?[\\w\\*\\.]+(?:\\[(?:[^\\]]+)\\])?(?:[\\w\\.\\*]+)?)+)))" }, { "include": "#parameter-variable-types" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "other types", "match": "([\\w\\.]+)" }, { "include": "$self" }] }, "functions": { "begin": "(?:(\\bfunc\\b)(?=\\())", "beginCaptures": { "1": { "name": "keyword.function.go" } }, "comment": "Functions", "end": "(?:(?<=\\))(\\s*(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?((?:(?:\\s*(?:(?:[\\[\\]\\*]+)?[\\w\\.\\*]+)?(?:(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\])|(?:\\((?:[^\\)]+)?\\)))?(?:[\\w\\.\\*]+)?)(?:\\s*)(?=\\{))|(?:\\s*(?:(?:(?:[\\[\\]\\*]+)?(?!\\bfunc\\b)(?:[\\w\\.\\*]+)(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\])?(?:[\\w\\.\\*]+)?)|(?:\\((?:[^\\)]+)?\\)))))?)", "endCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "patterns": [{ "include": "#parameter-variable-types" }] }, "functions_inline": { "captures": { "1": { "name": "keyword.function.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }, { "include": "$self" }] }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "functions in-line with multi return types", "match": "(?:(\\bfunc\\b)((?:\\((?:[^/]*?)\\))(?:\\s+)(?:\\((?:[^/]*?)\\)))(?:\\s+)(?=\\{))" }, "generic_param_types": { "comment": "generic parameter variables and types", "patterns": [{ "include": "#struct_variables_types" }, { "include": "#interface_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "struct/interface type declaration", "match": "((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)\\s+(?=(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b\\s*\\{)" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.parameter.go" }] } }, "comment": "multiple parameters one type -with multilines", "match": "(?:(?:(?<=\\()|^\\s*)((?:(?:\\b\\w+\\,\\s*)+)(?:/(?:/|\\*).*)?)$)" }, { "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.parameter.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "3": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "multiple params and types | multiple types one param", "match": "(?:((?:(?:\\b\\w+\\,\\s*)+)?\\b\\w+)(?:\\s+)((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?:(?:[\\w\\[\\]\\.\\*]+)?(?:(?:\\bfunc\\b\\((?:[^\\)]+)?\\))(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s*))+(?:(?:(?:[\\w\\*\\.]+)|(?:\\((?:[^\\)]+)?\\))))?)|(?:(?:(?:[\\w\\*\\.\\~]+)|(?:\\[(?:(?:[\\w\\.\\*]+)?(?:\\[(?:[^\\]]+)?\\])?(?:\\,\\s+)?)+\\]))(?:[\\w\\.\\*]+)?)+)))" }, { "include": "#parameter-variable-types" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "other types", "match": "(?:\\b([\\w\\.]+))" }, { "include": "$self" }] }, "generic_types": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "2": { "patterns": [{ "include": "#parameter-variable-types" }] } }, "comment": "Generic support for all types", "match": "(?:([\\w\\.\\*]+)(\\[(?:[^\\]]+)?\\]))" }, "group-functions": { "comment": "all statements related to functions", "patterns": [{ "include": "#function_declaration" }, { "include": "#functions_inline" }, { "include": "#functions" }, { "include": "#built_in_functions" }, { "include": "#support_functions" }] }, "group-types": { "comment": "all statements related to types", "patterns": [{ "include": "#other_struct_interface_expressions" }, { "include": "#type_assertion_inline" }, { "include": "#struct_variables_types" }, { "include": "#interface_variables_types" }, { "include": "#single_type" }, { "include": "#multi_types" }, { "include": "#struct_interface_declaration" }, { "include": "#double_parentheses_types" }, { "include": "#switch_types" }, { "include": "#type-declarations" }] }, "group-variables": { "comment": "all statements related to variables", "patterns": [{ "include": "#var_const_assignment" }, { "include": "#variable_assignment" }, { "include": "#label_loop_variables" }, { "include": "#slice_index_variables" }, { "include": "#property_variables" }, { "include": "#switch_select_case_variables" }, { "include": "#other_variables" }] }, "import": { "comment": "import", "patterns": [{ "begin": "\\b(import)\\s+", "beginCaptures": { "1": { "name": "keyword.control.import.go" } }, "comment": "import", "end": "(?!\\G)", "patterns": [{ "include": "#imports" }] }] }, "imports": { "comment": "import package(s)", "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "(?:\\w+)", "name": "variable.other.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" } }, "match": '(\\s*[\\w\\.]+)?\\s*((")([^"]*)("))' }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.imports.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.imports.end.bracket.round.go" } }, "patterns": [{ "include": "#comments" }, { "include": "#imports" }] }, { "include": "$self" }] }, "interface_variables_types": { "begin": "(\\binterface\\b)\\s*(\\{)", "beginCaptures": { "1": { "name": "keyword.interface.go" }, "2": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "interface variable types", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#interface_variables_types_field" }, { "include": "$self" }] }, "interface_variables_types_field": { "comment": "interface variable type fields", "patterns": [{ "include": "#support_functions" }, { "include": "#type-declarations-without-brackets" }, { "begin": "(?:([\\w\\.\\*]+)?(\\[))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#generic_param_types" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }] }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "other types", "match": "([\\w\\.]+)" }] }, "keywords": { "patterns": [{ "comment": "Flow control keywords", "match": "\\b(break|case|continue|default|defer|else|fallthrough|for|go|goto|if|range|return|select|switch)\\b", "name": "keyword.control.go" }, { "match": "\\bchan\\b", "name": "keyword.channel.go" }, { "match": "\\bconst\\b", "name": "keyword.const.go" }, { "match": "\\bvar\\b", "name": "keyword.var.go" }, { "match": "\\bfunc\\b", "name": "keyword.function.go" }, { "match": "\\binterface\\b", "name": "keyword.interface.go" }, { "match": "\\bmap\\b", "name": "keyword.map.go" }, { "match": "\\bstruct\\b", "name": "keyword.struct.go" }, { "match": "\\bimport\\b", "name": "keyword.control.import.go" }, { "match": "\\btype\\b", "name": "keyword.type.go" }] }, "label_loop_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.label.go" }] } }, "comment": "labeled loop variable name", "match": "((?:^\\s*\\w+:\\s*$)|(?:^\\s*(?:\\bbreak\\b|\\bgoto\\b|\\bcontinue\\b)\\s+\\w+(?:\\s*/(?:/|\\*)\\s*.*)?$))" }, "language_constants": { "captures": { "1": { "name": "constant.language.boolean.go" }, "2": { "name": "constant.language.null.go" }, "3": { "name": "constant.language.iota.go" } }, "comment": "Language constants", "match": "\\b(?:(true|false)|(nil)|(iota))\\b" }, "map_types": { "begin": "(?:(\\bmap\\b)(\\[))", "beginCaptures": { "1": { "name": "keyword.map.go" }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "comment": "map types", "end": "(?:(\\])((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?!(?:[\\[\\]\\*]+)?\\b(?:func|struct|map)\\b)(?:[\\*\\[\\]]+)?(?:[\\w\\.]+))?)", "endCaptures": { "1": { "name": "punctuation.definition.end.bracket.square.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "include": "#functions" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "multi_types": { "begin": "(\\btype\\b)\\s*(\\()", "beginCaptures": { "1": { "name": "keyword.type.go" }, "2": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "multi type declaration", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#struct_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "numeric_literals": { "captures": { "0": { "patterns": [{ "begin": "(?=.)", "end": "(?:\\n|$)", "patterns": [{ "captures": { "1": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "2": { "name": "punctuation.separator.constant.numeric.go" }, "3": { "name": "constant.numeric.decimal.point.go" }, "4": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "5": { "name": "punctuation.separator.constant.numeric.go" }, "6": { "name": "keyword.other.unit.exponent.decimal.go" }, "7": { "name": "keyword.operator.plus.exponent.decimal.go" }, "8": { "name": "keyword.operator.minus.exponent.decimal.go" }, "9": { "name": "constant.numeric.exponent.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "10": { "name": "keyword.other.unit.imaginary.go" }, "11": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "12": { "name": "punctuation.separator.constant.numeric.go" }, "13": { "name": "keyword.other.unit.exponent.decimal.go" }, "14": { "name": "keyword.operator.plus.exponent.decimal.go" }, "15": { "name": "keyword.operator.minus.exponent.decimal.go" }, "16": { "name": "constant.numeric.exponent.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "17": { "name": "keyword.other.unit.imaginary.go" }, "18": { "name": "constant.numeric.decimal.point.go" }, "19": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "20": { "name": "punctuation.separator.constant.numeric.go" }, "21": { "name": "keyword.other.unit.exponent.decimal.go" }, "22": { "name": "keyword.operator.plus.exponent.decimal.go" }, "23": { "name": "keyword.operator.minus.exponent.decimal.go" }, "24": { "name": "constant.numeric.exponent.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "25": { "name": "keyword.other.unit.imaginary.go" }, "26": { "name": "keyword.other.unit.hexadecimal.go" }, "27": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "28": { "name": "punctuation.separator.constant.numeric.go" }, "29": { "name": "constant.numeric.hexadecimal.go" }, "30": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "31": { "name": "punctuation.separator.constant.numeric.go" }, "32": { "name": "keyword.other.unit.exponent.hexadecimal.go" }, "33": { "name": "keyword.operator.plus.exponent.hexadecimal.go" }, "34": { "name": "keyword.operator.minus.exponent.hexadecimal.go" }, "35": { "name": "constant.numeric.exponent.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "36": { "name": "keyword.other.unit.imaginary.go" }, "37": { "name": "keyword.other.unit.hexadecimal.go" }, "38": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "39": { "name": "punctuation.separator.constant.numeric.go" }, "40": { "name": "keyword.other.unit.exponent.hexadecimal.go" }, "41": { "name": "keyword.operator.plus.exponent.hexadecimal.go" }, "42": { "name": "keyword.operator.minus.exponent.hexadecimal.go" }, "43": { "name": "constant.numeric.exponent.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "44": { "name": "keyword.other.unit.imaginary.go" }, "45": { "name": "keyword.other.unit.hexadecimal.go" }, "46": { "name": "constant.numeric.hexadecimal.go" }, "47": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "48": { "name": "punctuation.separator.constant.numeric.go" }, "49": { "name": "keyword.other.unit.exponent.hexadecimal.go" }, "50": { "name": "keyword.operator.plus.exponent.hexadecimal.go" }, "51": { "name": "keyword.operator.minus.exponent.hexadecimal.go" }, "52": { "name": "constant.numeric.exponent.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "53": { "name": "keyword.other.unit.imaginary.go" } }, "match": "(?:(?:(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$)|\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|\\G((?:(?<=[0-9])\\.|\\.(?=[0-9])))([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?:(?<!_)([eE])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)))?(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)?(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))|(\\G0[xX])((?:(?<=[0-9a-fA-F])\\.|\\.(?=[0-9a-fA-F])))([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(?<!_)([pP])(\\+?)(\\-?)((?:[0-9](?:[0-9]|(?:(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*))(i(?!\\w))?(?:\\n|$))" }, { "captures": { "1": { "name": "constant.numeric.decimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "2": { "name": "punctuation.separator.constant.numeric.go" }, "3": { "name": "keyword.other.unit.imaginary.go" }, "4": { "name": "keyword.other.unit.binary.go" }, "5": { "name": "constant.numeric.binary.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "6": { "name": "punctuation.separator.constant.numeric.go" }, "7": { "name": "keyword.other.unit.imaginary.go" }, "8": { "name": "keyword.other.unit.octal.go" }, "9": { "name": "constant.numeric.octal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "10": { "name": "punctuation.separator.constant.numeric.go" }, "11": { "name": "keyword.other.unit.imaginary.go" }, "12": { "name": "keyword.other.unit.hexadecimal.go" }, "13": { "name": "constant.numeric.hexadecimal.go", "patterns": [{ "match": "(?<=[0-9a-fA-F])_(?=[0-9a-fA-F])", "name": "punctuation.separator.constant.numeric.go" }] }, "14": { "name": "punctuation.separator.constant.numeric.go" }, "15": { "name": "keyword.other.unit.imaginary.go" } }, "match": "(?:(?:(?:\\G(?=[0-9.])(?!0[xXbBoO])([0-9](?:[0-9]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$)|(\\G0[bB])_?([01](?:[01]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))|(\\G0[oO]?)_?((?:[0-7]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))+)(i(?!\\w))?(?:\\n|$))|(\\G0[xX])_?([0-9a-fA-F](?:[0-9a-fA-F]|((?<=[0-9a-fA-F])_(?=[0-9a-fA-F])))*)(i(?!\\w))?(?:\\n|$))" }, { "match": "(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])+", "name": "invalid.illegal.constant.numeric.go" }] }] } }, "match": "(?<!\\w)\\.?\\d(?:(?:[0-9a-zA-Z_\\.])|(?<=[eEpP])[+-])*" }, "operators": { "comment": "Note that the order here is very important!", "patterns": [{ "match": "((?:\\*|\\&)+)(?:(?!\\d)(?=(?:[\\w\\[\\]])|(?:\\<\\-)))", "name": "keyword.operator.address.go" }, { "match": "<\\-", "name": "keyword.operator.channel.go" }, { "match": "\\-\\-", "name": "keyword.operator.decrement.go" }, { "match": "\\+\\+", "name": "keyword.operator.increment.go" }, { "match": "(==|!=|<=|>=|<(?!<)|>(?!>))", "name": "keyword.operator.comparison.go" }, { "match": "(&&|\\|\\||!)", "name": "keyword.operator.logical.go" }, { "match": "(=|\\+=|\\-=|\\|=|\\^=|\\*=|/=|:=|%=|<<=|>>=|&\\^=|&=)", "name": "keyword.operator.assignment.go" }, { "match": "(\\+|\\-|\\*|/|%)", "name": "keyword.operator.arithmetic.go" }, { "match": "(&(?!\\^)|\\||\\^|&\\^|<<|>>|\\~)", "name": "keyword.operator.arithmetic.bitwise.go" }, { "match": "\\.\\.\\.", "name": "keyword.operator.ellipsis.go" }] }, "other_struct_interface_expressions": { "comment": "struct and interface expression in-line (before curly bracket)", "patterns": [{ "comment": "after control variables must be added exactly here, do not move it! (changing may not affect tests, so be careful!)", "include": "#after_control_variables" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "2": { "patterns": [{ "begin": "\\[", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }, { "include": "$self" }] }] } }, "match": "(\\b[\\w\\.]+)(\\[(?:[^\\]]+)?\\])?(?=\\{)(?<!\\bstruct\\b|\\binterface\\b)" }] }, "other_variables": { "comment": "all other variables", "match": "\\w+", "name": "variable.other.go" }, "package_name": { "patterns": [{ "begin": "\\b(package)\\s+", "beginCaptures": { "1": { "name": "keyword.package.go" } }, "comment": "package name", "end": "(?!\\G)", "patterns": [{ "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "entity.name.type.package.go" }] }] }, "parameter-variable-types": { "comment": "function and generic parameter types", "patterns": [{ "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "begin": "(?:([\\w\\.\\*]+)?(\\[))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] }, "2": { "name": "punctuation.definition.begin.bracket.square.go" } }, "end": "\\]", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.square.go" } }, "patterns": [{ "include": "#generic_param_types" }] }, { "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }] }] }, "property_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }, { "include": "$self" }] }, "3": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.field.go" }, { "include": "$self" }] }, "4": { "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.field.go" }] } }, "match": "([\\w\\.\\*\\&\\[\\]]+)(\\.\\w+)" }, { "include": "$self" }] } }, "comment": "Property variables in struct | parameter field in struct initialization", "match": "(?:(?:((?:\\b[\\w\\.]+)(?:\\:(?!\\=))))(?:(?:\\s*([\\w\\.\\*\\&\\[\\]]+)(\\.\\w+)(?![\\w\\.\\*\\&\\[\\]]*(?:\\{|\\()))((?:\\s*(?:\\<|\\>|\\<\\=|\\>\\=|\\=\\=|\\!\\=|\\|\\||\\&\\&|\\+|/|\\-|\\*|\\%|\\||\\&)\\s*(?:[\\w\\.\\*\\&\\[\\]]+)(?:\\.\\w+)(?![\\w\\.\\*\\&\\[\\]]*(?:\\{|\\()))*))?)" }, "raw_string_literals": { "begin": "`", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.go" } }, "comment": "Raw string literals", "end": "`", "endCaptures": { "0": { "name": "punctuation.definition.string.end.go" } }, "name": "string.quoted.raw.go", "patterns": [{ "include": "#string_placeholder" }] }, "runes": { "patterns": [{ "begin": "'", "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.go" } }, "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.end.go" } }, "name": "string.quoted.rune.go", "patterns": [{ "match": `\\G(\\\\([0-7]{3}|[abfnrtv\\\\'"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})|.)(?=')`, "name": "constant.other.rune.go" }, { "match": "[^']+", "name": "invalid.illegal.unknown-rune.go" }] }] }, "single_type": { "patterns": [{ "captures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "3": { "patterns": [{ "begin": "\\(", "beginCaptures": { "0": { "name": "punctuation.definition.begin.bracket.round.go" } }, "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }, { "include": "$self" }] }, { "include": "#type-declarations" }, { "include": "#generic_types" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "single type declaration", "match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?:\\s+)(?!(?:\\=\\s*)?(?:[\\[\\]\\*]+)?\\b(?:struct|interface)\\b)([\\s\\S]+))" }, { "begin": "(?:(?:^|\\s+)(\\btype\\b)(?:\\s*)([\\w\\.\\*]+)(?=\\[))", "beginCaptures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "single type declaration with generics", "end": "(?:(?<=\\])((?:\\s+)(?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:(?!(?:[\\[\\]\\*]+)?(?:\\bstruct\\b|\\binterface\\b|\\bfunc\\b))[\\w\\.\\-\\*\\[\\]]+))?)", "endCaptures": { "1": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "patterns": [{ "include": "#struct_variables_types" }, { "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] }] }, "slice_index_variables": { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }] } }, "comment": "slice index and capacity variables, to not scope them as property variables", "match": "(?<=\\w\\[)((?:(?:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+\\:)|(?:\\:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+))(?:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+)?(?:\\:\\b[\\w\\.\\*\\+/\\-\\*\\%\\<\\>\\|\\&]+)?)(?=\\])" }, "statements": { "patterns": [{ "include": "#package_name" }, { "include": "#import" }, { "include": "#syntax_errors" }, { "include": "#group-functions" }, { "include": "#group-types" }, { "include": "#group-variables" }, { "include": "#field_hover" }] }, "storage_types": { "patterns": [{ "match": "\\bbool\\b", "name": "storage.type.boolean.go" }, { "match": "\\bbyte\\b", "name": "storage.type.byte.go" }, { "match": "\\berror\\b", "name": "storage.type.error.go" }, { "match": "\\b(complex(64|128)|float(32|64)|u?int(8|16|32|64)?)\\b", "name": "storage.type.numeric.go" }, { "match": "\\brune\\b", "name": "storage.type.rune.go" }, { "match": "\\bstring\\b", "name": "storage.type.string.go" }, { "match": "\\buintptr\\b", "name": "storage.type.uintptr.go" }, { "match": "\\bany\\b", "name": "entity.name.type.any.go" }] }, "string_escaped_char": { "patterns": [{ "match": `\\\\([0-7]{3}|[abfnrtv\\\\'"]|x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|U[0-9a-fA-F]{8})`, "name": "constant.character.escape.go" }, { "match": `\\\\[^0-7xuUabfnrtv\\'"]`, "name": "invalid.illegal.unknown-escape.go" }] }, "string_literals": { "patterns": [{ "begin": '"', "beginCaptures": { "0": { "name": "punctuation.definition.string.begin.go" } }, "comment": "Interpreted string literals", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.end.go" } }, "name": "string.quoted.double.go", "patterns": [{ "include": "#string_escaped_char" }, { "include": "#string_placeholder" }] }] }, "string_placeholder": { "patterns": [{ "match": "%(\\[\\d+\\])?([\\+#\\-0\\x20]{,2}((\\d+|\\*)?(\\.?(\\d+|\\*|(\\[\\d+\\])\\*?)?(\\[\\d+\\])?)?))?[vT%tbcdoqxXUbeEfFgGspw]", "name": "constant.other.placeholder.go" }] }, "struct_interface_declaration": { "captures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "struct, interface type declarations (related to: struct_variables_types, interface_variables_types)", "match": "(?:(?:^\\s*)(\\btype\\b)(?:\\s*)([\\w\\.]+))" }, "struct_variable_types_fields_multi": { "comment": "struct variable and type fields with multi lines", "patterns": [{ "begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\bstruct\\b)(?:\\s*)(\\{))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "name": "keyword.struct.go" }, "3": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "struct in struct types", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#struct_variables_types_fields" }, { "include": "$self" }] }, { "begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\binterface\\b)(?:\\s*)(\\{))", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "name": "keyword.interface.go" }, "3": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "interface in struct types", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#interface_variables_types_field" }, { "include": "$self" }] }, { "begin": "(?:((?:\\w+(?:\\,\\s*\\w+)*)(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:\\s+)(?:[\\[\\]\\*]+)?)(\\bfunc\\b)(?:\\s*)(\\())", "beginCaptures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.property.go" }] }, "2": { "name": "keyword.function.go" }, "3": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "function in struct types", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "include": "#function_param_types" }, { "include": "$self" }] }, { "include": "#parameter-variable-types" }] }, "struct_variables_types": { "begin": "(\\bstruct\\b)\\s*(\\{)", "beginCaptures": { "1": { "name": "keyword.struct.go" }, "2": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "Struct variable type", "end": "\\}", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "include": "#struct_variables_types_fields" }, { "include": "$self" }] }, "struct_variables_types_fields": { "comment": "Struct variable type fields", "patterns": [{ "include": "#struct_variable_types_fields_multi" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "one line - single type", "match": "(?:(?<=\\{)\\s*((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+))\\s*(?=\\}))" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "one line - property variables and types", "match": "(?:(?<=\\{)\\s*((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\w\\.\\*\\[\\]]+))\\s*(?=\\}))" }, { "captures": { "1": { "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\S]+)(?:\\;)?))" }] } }, "comment": "one line with semicolon(;) without formatting gofmt - single type | property variables and types", "match": "(?:(?<=\\{)((?:\\s*(?:(?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))?(?:(?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?:[\\S]+)(?:\\;)?))+)\\s*(?=\\}))" }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "one type only", "match": '(?:((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?(?<!\\,\\s*)(?:[\\w\\.\\*]+)\\s*(?:(?:(?:".*")|(?:\\`.*\\`))\\s*)?(?:/(?:/|\\*).*)?)$)' }, { "captures": { "1": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "variable.other.property.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#parameter-variable-types" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "property variables and types", "match": "(?:((?:(?:\\w+\\,\\s*)+)?(?:\\w+\\s+))([\\s\\S]+))" }] }, "support_functions": { "captures": { "1": { "name": "entity.name.function.support.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "entity.name.function.support.go" }] }, "3": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\{", "name": "punctuation.definition.begin.bracket.curly.go" }, { "match": "\\}", "name": "punctuation.definition.end.bracket.curly.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "Support Functions", "match": `(?:(?:((?<=\\.)\\b\\w+)|(\\b\\w+))(\\[(?:(?:[\\w\\.\\*\\[\\]\\{\\}"\\']+)(?:(?:\\,\\s*(?:[\\w\\.\\*\\[\\]\\{\\}]+))*))?\\])?(?=\\())` }, "switch_select_case_variables": { "captures": { "1": { "name": "keyword.control.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "include": "#support_functions" }, { "include": "#variable_assignment" }, { "match": "\\w+", "name": "variable.other.go" }] } }, "comment": "variables after case control keyword in switch/select expression, to not scope them as property variables", "match": "(?:(?:^\\s*(\\bcase\\b))(?:\\s+)([\\s\\S]+(?:\\:)\\s*(?:/(?:/|\\*).*)?)$)" }, "switch_types": { "begin": "(?<=\\bswitch\\b)(?:\\s*)(?:(\\w+\\s*\\:\\=)?\\s*([\\w\\.\\*\\(\\)\\[\\]]+))(\\.\\(\\btype\\b\\)\\s*)(\\{)", "beginCaptures": { "1": { "patterns": [{ "include": "#operators" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] }, "2": { "patterns": [{ "include": "#support_functions" }, { "include": "#type-declarations" }, { "match": "\\w+", "name": "variable.other.go" }] }, "3": { "patterns": [{ "include": "#delimiters" }, { "include": "#brackets" }, { "match": "\\btype\\b", "name": "keyword.type.go" }] }, "4": { "name": "punctuation.definition.begin.bracket.curly.go" } }, "comment": "switch type assertions, only highlights types after case keyword", "end": "(?:\\})", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.curly.go" } }, "patterns": [{ "captures": { "1": { "name": "keyword.control.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, "3": { "name": "punctuation.other.colon.go" }, "4": { "patterns": [{ "include": "#comments" }] } }, "comment": "types after case keyword with single line", "match": "(?:^\\s*(\\bcase\\b))(?:\\s+)([\\w\\.\\,\\*\\=\\<\\>\\!\\s]+)(:)(\\s*/(?:/|\\*)\\s*.*)?$" }, { "begin": "\\bcase\\b", "beginCaptures": { "0": { "name": "keyword.control.go" } }, "comment": "types after case keyword with multi lines", "end": "\\:", "endCaptures": { "0": { "name": "punctuation.other.colon.go" } }, "patterns": [{ "include": "#type-declarations" }, { "match": "\\w+", "name": "entity.name.type.go" }] }, { "include": "$self" }] }, "syntax_errors": { "patterns": [{ "captures": { "1": { "name": "invalid.illegal.slice.go" } }, "comment": "Syntax error using slices", "match": "\\[\\](\\s+)" }, { "comment": "Syntax error numeric literals", "match": "\\b0[0-7]*[89]\\d*\\b", "name": "invalid.illegal.numeric.go" }] }, "terminators": { "comment": "Terminators", "match": ";", "name": "punctuation.terminator.go" }, "type-declarations": { "comment": "includes all type declarations", "patterns": [{ "include": "#language_constants" }, { "include": "#comments" }, { "include": "#map_types" }, { "include": "#brackets" }, { "include": "#delimiters" }, { "include": "#keywords" }, { "include": "#operators" }, { "include": "#runes" }, { "include": "#storage_types" }, { "include": "#raw_string_literals" }, { "include": "#string_literals" }, { "include": "#numeric_literals" }, { "include": "#terminators" }] }, "type-declarations-without-brackets": { "comment": "includes all type declarations without brackets (in some cases, brackets need to be captured manually)", "patterns": [{ "include": "#language_constants" }, { "include": "#comments" }, { "include": "#map_types" }, { "include": "#delimiters" }, { "include": "#keywords" }, { "include": "#operators" }, { "include": "#runes" }, { "include": "#storage_types" }, { "include": "#raw_string_literals" }, { "include": "#string_literals" }, { "include": "#numeric_literals" }, { "include": "#terminators" }] }, "type_assertion_inline": { "captures": { "1": { "name": "keyword.type.go" }, "2": { "patterns": [{ "include": "#type-declarations" }, { "match": "(?:\\w+)", "name": "entity.name.type.go" }] } }, "comment": "struct/interface types in-line (type assertion) | switch type keyword", "match": "(?:(?<=\\.\\()(?:(\\btype\\b)|((?:(?:\\s*(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+)?[\\w\\.\\[\\]\\*]+))(?=\\)))" }, "var_const_assignment": { "comment": "variable assignment with var and const keyword", "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#generic_types" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "comment": "var and const with single type assignment", "match": "(?:(?<=\\bvar\\b|\\bconst\\b)(?:\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)" }, { "begin": "(?:(?<=\\bvar\\b|\\bconst\\b)(?:\\s*)(\\())", "beginCaptures": { "1": { "name": "punctuation.definition.begin.bracket.round.go" } }, "comment": "var and const with multi type assignment", "end": "\\)", "endCaptures": { "0": { "name": "punctuation.definition.end.bracket.round.go" } }, "patterns": [{ "captures": { "1": { "patterns": [{ "include": "#delimiters" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] }, "2": { "patterns": [{ "include": "#type-declarations-without-brackets" }, { "include": "#generic_types" }, { "match": "\\(", "name": "punctuation.definition.begin.bracket.round.go" }, { "match": "\\)", "name": "punctuation.definition.end.bracket.round.go" }, { "match": "\\[", "name": "punctuation.definition.begin.bracket.square.go" }, { "match": "\\]", "name": "punctuation.definition.end.bracket.square.go" }, { "match": "\\w+", "name": "entity.name.type.go" }] } }, "match": "(?:(?:^\\s*)(\\b[\\w\\.]+(?:\\,\\s*[\\w\\.]+)*)(?:\\s*)((?:(?:(?:[\\*\\[\\]]+)?(?:\\<\\-\\s*)?\\bchan\\b(?:\\s*\\<\\-)?\\s*)+(?:\\([^\\)]+\\))?)?(?!(?:[\\[\\]\\*]+)?\\b(?:struct|func|map)\\b)(?:[\\w\\.\\[\\]\\*]+(?:\\,\\s*[\\w\\.\\[\\]\\*]+)*)?(?:\\s*)(?:\\=)?)?)" }, { "include": "$self" }] }] }, "variable_assignment": { "comment": "variable assignment", "patterns": [{ "captures": { "0": { "patterns": [{ "include": "#delimiters" }, { "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] } }, "comment": "variable assignment with :=", "match": "\\b\\w+(?:\\,\\s*\\w+)*(?=\\s*:=)" }, { "captures": { "0": { "patterns": [{ "include": "#delimiters" }, { "include": "#operators" }, { "match": "\\d\\w*", "name": "invalid.illegal.identifier.go" }, { "match": "\\w+", "name": "variable.other.assignment.go" }] } }, "comment": "variable assignment with =", "match": "\\b[\\w\\.\\*]+(?:\\,\\s*[\\w\\.\\*]+)*(?=\\s*=(?!=))" }] } }, "scopeName": "source.go" });
2
2
  var go = [
3
3
  lang
4
4
  ];
@@ -1,4 +1,4 @@
1
- const lang = Object.freeze({ "displayName": "Kusto", "fileTypes": ["csl", "kusto", "kql"], "name": "kusto", "patterns": [{ "comment": "Tabular operators: common helper operators", "match": "\\b(by|from|of|to|step|with)\\b", "name": "keyword.other.operator.kusto" }, { "comment": "Query statements: https://docs.microsoft.com/en-us/azure/kusto/query/statements", "match": "\\b(let|set|alias|declare|pattern|query_parameters|restrict|access|set)\\b", "name": "keyword.control.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatypes-string-operators", "match": "\\b(and|or|has_all|has_any|matches|regex)\\b", "name": "keyword.other.operator.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#Strings" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/clusterfunction", "match": "\\b(cluster|database)(?:\\s*\\(\\s*(.+?)\\s*\\))?(?!\\w)", "name": "meta.special.database.kusto" }, { "comment": "Special functions: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/tablefunction", "match": "\\b(external_table|materialized_view|materialize|table|toscalar)\\b", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/betweenoperator", "match": "(?<!\\w)(!?between)\\b", "name": "keyword.other.operator.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binoperators", "match": "\\b(binary_and|binary_or|binary_shift_left|binary_shift_right|binary_xor)(?:\\s*\\(\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\))?(?!\\w)", "name": "meta.scalar.bitwise.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binary-notfunction", "match": "\\b(binary_not|bitset_count_ones)(?:\\s*\\(\\s*(\\w+)\\s*\\))?(?!\\w)", "name": "meta.scalar.bitwise.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/in-cs-operator", "match": "(?<!\\w)(!?in~?)(?!\\w)", "name": "keyword.other.operator.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatypes-string-operators", "match": "(?<!\\w)(!?(?:contains|endswith|hasprefix|hassuffix|has|startswith)(?:_cs)?)(?!\\w)", "name": "keyword.other.operator.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "3": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "4": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/rangefunction", "match": "\\b(range)\\s*\\((?:\\s*(\\w+(?:\\(.*?\\))?)\\s*,\\s*(\\w+(?:\\(.*?\\))?)\\s*,?(?:\\s*)?(\\w+(?:\\(.*?\\))?)?\\s*\\))?(?!\\w)", "name": "meta.scalar.function.range.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalarfunctions", "match": "\\b(abs|acos|around|array_concat|array_iff|array_index_of|array_length|array_reverse|array_rotate_left|array_rotate_right|array_shift_left|array_shift_right|array_slice|array_sort_asc|array_sort_desc|array_split|array_sum|asin|assert|atan2|atan|bag_has_key|bag_keys|bag_merge|bag_remove_keys|base64_decode_toarray|base64_decode_tostring|base64_decode_toguid|base64_encode_fromarray|base64_encode_tostring|base64_encode_fromguid|beta_cdf|beta_inv|beta_pdf|bin_at|bin_auto|case|ceiling|coalesce|column_ifexists|convert_angle|convert_energy|convert_force|convert_length|convert_mass|convert_speed|convert_temperature|convert_volume|cos|cot|countof|current_cluster_endpoint|current_database|current_principal_details|current_principal_is_member_of|current_principal|cursor_after|cursor_before_or_at|cursor_current|current_cursor|dcount_hll|degrees|dynamic_to_json|estimate_data_size|exp10|exp2|exp|extent_id|extent_tags|extract_all|extract_json|extractjson|extract|floor|format_bytes|format_ipv4_mask|format_ipv4|gamma|gettype|gzip_compress_to_base64_string|gzip_decompress_from_base64_string|has_any_index|has_any_ipv4_prefix|has_any_ipv4|has_ipv4_prefix|has_ipv4|hash_combine|hash_many|hash_md5|hash_sha1|hash_sha256|hash_xxhash64|hash|iff|iif|indexof_regex|indexof|ingestion_time|ipv4_compare|ipv4_is_in_range|ipv4_is_in_any_range|ipv4_is_match|ipv4_is_private|ipv4_netmask_suffix|ipv6_compare|ipv6_is_match|isascii|isempty|isfinite|isinf|isnan|isnotempty|notempty|isnotnull|notnull|isnull|isutf8|jaccard_index|log10|log2|loggamma|log|make_string|max_of|min_of|new_guid|not|bag_pack|pack_all|pack_array|pack_dictionary|pack|parse_command_line|parse_csv|parse_ipv4_mask|parse_ipv4|parse_ipv6_mask|parse_ipv6|parse_path|parse_urlquery|parse_url|parse_user_agent|parse_version|parse_xml|percentile_tdigest|percentile_array_tdigest|percentrank_tdigest|pi|pow|radians|rand|rank_tdigest|regex_quote|repeat|replace_regex|replace_string|reverse|round|set_difference|set_has_element|set_intersect|set_union|sign|sin|split|sqrt|strcat_array|strcat_delim|strcmp|strcat|string_size|strlen|strrep|substring|tan|to_utf8|tobool|todecimal|todouble|toreal|toguid|tohex|toint|tolong|tolower|tostring|toupper|translate|treepath|trim_end|trim_start|trim|unixtime_microseconds_todatetime|unixtime_milliseconds_todatetime|unixtime_nanoseconds_todatetime|unixtime_seconds_todatetime|url_decode|url_encode_component|url_encode|welch_test|zip|zlib_compress_to_base64_string|zlib_decompress_from_base64_string)\\b", "name": "support.function.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "3": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binfunction", "match": "\\b(bin)(?:\\s*\\(\\s*(.+?)\\s*,\\s*(.+?)\\s*\\))?(?!\\w)", "name": "meta.scalar.function.bin.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/count-aggfunction", "match": "\\b(count)\\s*\\(\\s*\\)(?!\\w)", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/aggregation-functions", "match": "\\b(arg_max|arg_min|avgif|avg|binary_all_and|binary_all_or|binary_all_xor|buildschema|countif|dcount|dcountif|hll|hll_merge|make_bag_if|make_bag|make_list_with_nulls|make_list_if|make_list|make_set_if|make_set|maxif|max|minif|min|percentilesw_array|percentiles_array|percentilesw|percentilew|percentiles|percentile|stdevif|stdevp|stdev|sumif|sum|take_anyif|take_any|tdigest_merge|merge_tdigest|tdigest|varianceif|variancep|variance)\\b", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/geospatial-grid-systems", "match": "\\b(geo_distance_2points|geo_distance_point_to_line|geo_distance_point_to_polygon|geo_intersects_2lines|geo_intersects_2polygons|geo_intersects_line_with_polygon|geo_intersection_2lines|geo_intersection_2polygons|geo_intersection_line_with_polygon|geo_line_centroid|geo_line_densify|geo_line_length|geo_line_simplify|geo_polygon_area|geo_polygon_centroid|geo_polygon_densify|geo_polygon_perimeter|geo_polygon_simplify|geo_polygon_to_s2cells|geo_point_in_circle|geo_point_in_polygon|geo_point_to_geohash|geo_point_to_h3cell|geo_point_to_s2cell|geo_geohash_to_central_point|geo_geohash_neighbors|geo_geohash_to_polygon|geo_s2cell_to_central_point|geo_s2cell_neighbors|geo_s2cell_to_polygon|geo_h3cell_to_central_point|geo_h3cell_neighbors|geo_h3cell_to_polygon|geo_h3cell_parent|geo_h3cell_children|geo_h3cell_level|geo_h3cell_rings|geo_simplify_polygons_array|geo_union_lines_array|geo_union_polygons_array)\\b", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/windowsfunctions", "match": "\\b(next|prev|row_cumsum|row_number|row_rank|row_window_session)\\b", "name": "support.function.kusto" }, { "comment": "User-defined functions: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions", "match": "\\.(create-or-alter|replace)", "name": "keyword.control.kusto" }, { "comment": "User-defined functions: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions", "match": "(?<=let ).+(?=\\W*=)", "name": "entity.function.name.lambda.kusto" }, { "comment": "User-defined functions: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions", "match": "\\b(folder|docstring|skipvalidation)\\b", "name": "keyword.other.operator.kusto" }, { "match": "\\b(function)\\b", "name": "storage.type.kusto" }, { "comment": "Data types: https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types", "match": "\\b(bool|decimal|dynamic|guid|int|long|real|string)\\b", "name": "storage.type.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "variable.other.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/asoperator", "match": "\\b(as)\\s+(\\w+)\\b", "name": "meta.query.as.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatableoperator", "match": "\\b(datatable)(?=\\W*\\()", "name": "keyword.other.query.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "keyword.other.operator.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/facetoperator", "match": "\\b(facet)(?:\\s+(by))?\\b", "name": "meta.query.facet.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "entity.name.function.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/invokeoperator", "match": "\\b(invoke)(?:\\s+(\\w+))?\\b", "name": "meta.query.invoke.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "keyword.other.operator.kusto" }, "3": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/orderoperator", "match": "\\b(order)(?:\\s+(by)\\s+(\\w+))?\\b", "name": "meta.query.order.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "variable.other.column.kusto" }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "5": { "name": "keyword.other.operator.kusto" }, "6": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "7": { "name": "keyword.other.operator.kusto" }, "8": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/rangeoperator", "match": "\\b(range)\\s+(\\w+)\\s+(from)\\s+(\\w+(?:\\(\\w*\\))?)\\s+(to)\\s+(\\w+(?:\\(\\w*\\))?)\\s+(step)\\s+(\\w+(?:\\(\\w*\\))?)\\b", "name": "meta.query.range.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sampleoperator", "match": "\\b(sample)(?:\\s+(\\d+))?(?![\\w-])", "name": "meta.query.sample.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sampledistinctoperator", "match": "\\b(sample-distinct)(?:\\s+(\\d+)\\s+(of)\\s+(\\w+))?\\b", "name": "meta.query.sample-distinct.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "keyword.other.operator.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sortoperator", "match": "\\b(sort)(?:\\s+(by))?\\b", "name": "meta.query.sort.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/takeoperator", "match": "\\b(take|limit)(?:\\s+(\\d+))\\b", "name": "meta.query.take.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/topoperator", "match": "\\b(top)(?:\\s+(\\d+)\\s+(by)\\s+(\\w+))?(?![\\w-])\\b", "name": "meta.query.top.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "name": "variable.other.column.kusto" }, "5": { "name": "keyword.other.operator.kusto" }, "6": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/tophittersoperator", "match": "\\b(top-hitters)(?:\\s+(\\d+)\\s+(of)\\s+(\\w+)(?:\\s+(by)\\s+(\\w+))?)?\\b", "name": "meta.query.top-hitters.kusto" }, { "comment": "Tabular operators: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/queries", "match": "\\b(consume|count|distinct|evaluate|extend|externaldata|find|fork|getschema|join|lookup|make-series|mv-apply|mv-expand|project-away|project-keep|project-rename|project-reorder|project|parse|parse-where|parse-kv|partition|print|reduce|render|scan|search|serialize|shuffle|summarize|top-nested|union|where)\\b", "name": "keyword.other.query.kusto" }, { "comment": "Tabular operators: evalute (plugins): https://docs.microsoft.com/en-us/azure/kusto/query/evaluateoperator", "match": "\\b(active_users_count|activity_counts_metrics|activity_engagement|new_activity_metrics|activity_metrics|autocluster|azure_digital_twins_query_request|bag_unpack|basket|cosmosdb_sql_request|dcount_intersect|diffpatterns|funnel_sequence_completion|funnel_sequence|http_request_post|http_request|infer_storage_schema|ipv4_lookup|mysql_request|narrow|pivot|preview|rolling_percentile|rows_near|schema_merge|session_count|sequence_detect|sliding_window_counts|sql_request)\\b", "name": "support.function.kusto" }, { "comment": "Tabular operators: join: https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator", "match": "\\b(on|kind|hint\\.remote|hint\\.strategy)\\b", "name": "keyword.other.operator.kusto" }, { "comment": "Tabular operators: join ($left, $right): https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator", "match": "(\\$left|\\$right)\\b", "name": "keyword.other.kusto" }, { "comment": "Tabular operators: join (kinds, strategies): https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator", "match": "\\b(innerunique|inner|leftouter|rightouter|fullouter|leftanti|anti|leftantisemi|rightanti|rightantisemi|leftsemi|rightsemi|broadcast)\\b", "name": "keyword.other.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/machine-learning-and-tsa", "match": "\\b(series_abs|series_acos|series_add|series_asin|series_atan|series_cos|series_decompose|series_decompose_anomalies|series_decompose_forecast|series_divide|series_equals|series_exp|series_fft|series_fill_backward|series_fill_const|series_fill_forward|series_fill_linear|series_fir|series_fit_2lines_dynamic|series_fit_2lines|series_fit_line_dynamic|series_fit_line|series_fit_poly|series_greater_equals|series_greater|series_ifft|series_iir|series_less_equals|series_less|series_multiply|series_not_equals|series_outliers|series_pearson_correlation|series_periods_detect|series_periods_validate|series_pow|series_seasonal|series_sign|series_sin|series_stats|series_stats_dynamic|series_subtract|series_tan)\\b", "name": "support.function.kusto" }, { "comment": "Tabular operators: mv-expand (bagexpand options): https://docs.microsoft.com/en-us/azure/kusto/query/mvexpandoperator", "match": "\\b(bag|array)\\b", "name": "keyword.other.operator.kusto" }, { "comment": "Tabular operators: order: https://docs.microsoft.com/en-us/azure/kusto/query/orderoperator", "match": "\\b(asc|desc|nulls first|nulls last)\\b", "name": "keyword.other.kusto" }, { "comment": "Tabular operators: parse: https://docs.microsoft.com/en-us/azure/kusto/query/parseoperator", "match": "\\b(regex|simple|relaxed)\\b", "name": "keyword.other.kusto" }, { "match": "\\b(anomalychart|areachart|barchart|card|columnchart|ladderchart|linechart|piechart|pivotchart|scatterchart|stackedareachart|timechart|timepivot)\\b", "name": "support.function.kusto" }, { "include": "#Strings" }, { "match": "\\{.*?\\}", "name": "string.other.kusto" }, { "comment": "Comments", "match": "//.*", "name": "comment.line.kusto" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#Numeric" }, { "match": "\\b(true|false|null)\\b", "name": "constant.language.kusto" }, { "comment": "Deprecated functions", "match": "\\b(anyif|any|array_strcat|base64_decodestring|base64_encodestring|make_dictionary|makelist|makeset|mvexpand|todynamic|parse_json|replace|weekofyear)(?=\\W*\\(|\\b)", "name": "invalid.deprecated.kusto" }], "repository": { "DateTimeTimeSpanDataTypes": { "patterns": [{ "match": "\\b(datetime|timespan|time)\\b", "name": "storage.type.kusto" }] }, "DateTimeTimeSpanFunctions": { "patterns": [{ "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }] }, "3": { "patterns": [{ "include": "#Strings" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/format-datetimefunction", "match": `\\b(format_datetime)(?:\\s*\\(\\s*(.+?)\\s*,\\s*(['"].*?['"])\\s*\\))?(?!\\w)`, "name": "meta.scalar.function.format_datetime.kusto" }, { "comment": "Scalar function: DateTime/Timespan Functions: https://docs.microsoft.com/en-us/azure/kusto/query/scalarfunctions#datetimetimespan-functions", "match": "\\b(ago|datetime_add|datetime_diff|datetime_local_to_utc|datetime_part|datetime_utc_to_local|dayofmonth|dayofweek|dayofyear|endofday|endofmonth|endofweek|endofyear|format_timespan|getmonth|getyear|hourofday|make_datetime|make_timespan|monthofyear|now|startofday|startofmonth|startofweek|startofyear|todatetime|totimespan|week_of_year)(?=\\W*\\()", "name": "support.function.kusto" }] }, "Escapes": { "patterns": [{ "match": `(\\\\['"]|\\\\\\\\)`, "name": "constant.character.escape.kusto" }] }, "Numeric": { "patterns": [{ "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*+)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?(?=\\b|\\w)", "name": "constant.numeric.kusto" }] }, "Strings": { "patterns": [{ "begin": '([@h]?")', "beginCaptures": { "1": { "name": "punctuation.definition.string.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.kusto" } }, "name": "string.quoted.double.kusto", "patterns": [{ "include": "#Escapes" }] }, { "begin": "([@h]?')", "beginCaptures": { "1": { "name": "punctuation.definition.string.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.kusto" } }, "name": "string.quoted.single.kusto", "patterns": [{ "include": "#Escapes" }] }] }, "TimeSpanLiterals": { "patterns": [{ "comment": "timespan literals: https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types/timespan#timespan-literals", "match": "[+-]?(?:\\d*\\.)?\\d+(?:microseconds?|ticks?|seconds?|ms|d|h|m|s)\\b", "name": "constant.numeric.kusto" }] } }, "scopeName": "source.kusto", "aliases": ["kql"] });
1
+ const lang = Object.freeze({ "displayName": "Kusto", "fileTypes": ["csl", "kusto", "kql"], "name": "kusto", "patterns": [{ "comment": "Tabular operators: common helper operators", "match": "\\b(by|from|of|to|step|with)\\b", "name": "keyword.other.operator.kusto" }, { "comment": "Query statements: https://docs.microsoft.com/en-us/azure/kusto/query/statements", "match": "\\b(let|set|alias|declare|pattern|query_parameters|restrict|access|set)\\b", "name": "keyword.control.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatypes-string-operators", "match": "\\b(and|or|has_all|has_any|matches|regex)\\b", "name": "keyword.other.operator.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#Strings" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/clusterfunction", "match": "\\b(cluster|database)(?:\\s*\\(\\s*(.+?)\\s*\\))?(?!\\w)", "name": "meta.special.database.kusto" }, { "comment": "Special functions: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/tablefunction", "match": "\\b(external_table|materialized_view|materialize|table|toscalar)\\b", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/betweenoperator", "match": "(?<!\\w)(!?between)\\b", "name": "keyword.other.operator.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binoperators", "match": "\\b(binary_and|binary_or|binary_shift_left|binary_shift_right|binary_xor)(?:\\s*\\(\\s*(\\w+)\\s*,\\s*(\\w+)\\s*\\))?(?!\\w)", "name": "meta.scalar.bitwise.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binary-notfunction", "match": "\\b(binary_not|bitset_count_ones)(?:\\s*\\(\\s*(\\w+)\\s*\\))?(?!\\w)", "name": "meta.scalar.bitwise.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/in-cs-operator", "match": "(?<!\\w)(!?in~?)(?!\\w)", "name": "keyword.other.operator.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatypes-string-operators", "match": "(?<!\\w)(!?(?:contains|endswith|hasprefix|hassuffix|has|startswith)(?:_cs)?)(?!\\w)", "name": "keyword.other.operator.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "3": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "4": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/rangefunction", "match": "\\b(range)\\s*\\((?:\\s*(\\w+(?:\\(.*?\\))?)\\s*,\\s*(\\w+(?:\\(.*?\\))?)\\s*,?(?:\\s*)?(\\w+(?:\\(.*?\\))?)?\\s*\\))?(?!\\w)", "name": "meta.scalar.function.range.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalarfunctions", "match": "\\b(abs|acos|around|array_concat|array_iff|array_index_of|array_length|array_reverse|array_rotate_left|array_rotate_right|array_shift_left|array_shift_right|array_slice|array_sort_asc|array_sort_desc|array_split|array_sum|asin|assert|atan2|atan|bag_has_key|bag_keys|bag_merge|bag_remove_keys|base64_decode_toarray|base64_decode_tostring|base64_decode_toguid|base64_encode_fromarray|base64_encode_tostring|base64_encode_fromguid|beta_cdf|beta_inv|beta_pdf|bin_at|bin_auto|case|ceiling|coalesce|column_ifexists|convert_angle|convert_energy|convert_force|convert_length|convert_mass|convert_speed|convert_temperature|convert_volume|cos|cot|countof|current_cluster_endpoint|current_database|current_principal_details|current_principal_is_member_of|current_principal|cursor_after|cursor_before_or_at|cursor_current|current_cursor|dcount_hll|degrees|dynamic_to_json|estimate_data_size|exp10|exp2|exp|extent_id|extent_tags|extract_all|extract_json|extractjson|extract|floor|format_bytes|format_ipv4_mask|format_ipv4|gamma|gettype|gzip_compress_to_base64_string|gzip_decompress_from_base64_string|has_any_index|has_any_ipv4_prefix|has_any_ipv4|has_ipv4_prefix|has_ipv4|hash_combine|hash_many|hash_md5|hash_sha1|hash_sha256|hash_xxhash64|hash|iff|iif|indexof_regex|indexof|ingestion_time|ipv4_compare|ipv4_is_in_range|ipv4_is_in_any_range|ipv4_is_match|ipv4_is_private|ipv4_netmask_suffix|ipv6_compare|ipv6_is_match|isascii|isempty|isfinite|isinf|isnan|isnotempty|notempty|isnotnull|notnull|isnull|isutf8|jaccard_index|log10|log2|loggamma|log|make_string|max_of|min_of|new_guid|not|bag_pack|pack_all|pack_array|pack_dictionary|pack|parse_command_line|parse_csv|parse_ipv4_mask|parse_ipv4|parse_ipv6_mask|parse_ipv6|parse_path|parse_urlquery|parse_url|parse_user_agent|parse_version|parse_xml|percentile_tdigest|percentile_array_tdigest|percentrank_tdigest|pi|pow|radians|rand|rank_tdigest|regex_quote|repeat|replace_regex|replace_string|reverse|round|set_difference|set_has_element|set_intersect|set_union|sign|sin|split|sqrt|strcat_array|strcat_delim|strcmp|strcat|string_size|strlen|strrep|substring|tan|to_utf8|tobool|todecimal|todouble|toreal|toguid|tohex|toint|tolong|tolower|tostring|toupper|translate|treepath|trim_end|trim_start|trim|unixtime_microseconds_todatetime|unixtime_milliseconds_todatetime|unixtime_nanoseconds_todatetime|unixtime_seconds_todatetime|url_decode|url_encode_component|url_encode|welch_test|zip|zlib_compress_to_base64_string|zlib_decompress_from_base64_string)\\b", "name": "support.function.kusto" }, { "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "3": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/binfunction", "match": "\\b(bin)(?:\\s*\\(\\s*(.+?)\\s*,\\s*(.+?)\\s*\\))?(?!\\w)", "name": "meta.scalar.function.bin.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/count-aggfunction", "match": "\\b(count)\\s*\\(\\s*\\)(?!\\w)", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/aggregation-functions", "match": "\\b(arg_max|arg_min|avgif|avg|binary_all_and|binary_all_or|binary_all_xor|buildschema|countif|dcount|dcountif|hll|hll_merge|make_bag_if|make_bag|make_list_with_nulls|make_list_if|make_list|make_set_if|make_set|maxif|max|minif|min|percentilesw_array|percentiles_array|percentilesw|percentilew|percentiles|percentile|stdevif|stdevp|stdev|sumif|sum|take_anyif|take_any|tdigest_merge|merge_tdigest|tdigest|varianceif|variancep|variance)\\b", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/geospatial-grid-systems", "match": "\\b(geo_distance_2points|geo_distance_point_to_line|geo_distance_point_to_polygon|geo_intersects_2lines|geo_intersects_2polygons|geo_intersects_line_with_polygon|geo_intersection_2lines|geo_intersection_2polygons|geo_intersection_line_with_polygon|geo_line_centroid|geo_line_densify|geo_line_length|geo_line_simplify|geo_polygon_area|geo_polygon_centroid|geo_polygon_densify|geo_polygon_perimeter|geo_polygon_simplify|geo_polygon_to_s2cells|geo_point_in_circle|geo_point_in_polygon|geo_point_to_geohash|geo_point_to_h3cell|geo_point_to_s2cell|geo_geohash_to_central_point|geo_geohash_neighbors|geo_geohash_to_polygon|geo_s2cell_to_central_point|geo_s2cell_neighbors|geo_s2cell_to_polygon|geo_h3cell_to_central_point|geo_h3cell_neighbors|geo_h3cell_to_polygon|geo_h3cell_parent|geo_h3cell_children|geo_h3cell_level|geo_h3cell_rings|geo_simplify_polygons_array|geo_union_lines_array|geo_union_polygons_array)\\b", "name": "support.function.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/windowsfunctions", "match": "\\b(next|prev|row_cumsum|row_number|row_rank|row_window_session)\\b", "name": "support.function.kusto" }, { "comment": "User-defined functions: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions", "match": "\\.(create-or-alter|replace)", "name": "keyword.control.kusto" }, { "comment": "User-defined functions: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions", "match": "(?<=let ).+(?=\\W*=)", "name": "entity.function.name.lambda.kusto" }, { "comment": "User-defined functions: https://docs.microsoft.com/en-us/azure/kusto/query/functions/user-defined-functions", "match": "\\b(folder|docstring|skipvalidation)\\b", "name": "keyword.other.operator.kusto" }, { "match": "\\b(function)\\b", "name": "storage.type.kusto" }, { "comment": "Data types: https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types", "match": "\\b(bool|decimal|dynamic|guid|int|long|real|string)\\b", "name": "storage.type.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "variable.other.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/asoperator", "match": "\\b(as)\\s+(\\w+)\\b", "name": "meta.query.as.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/datatableoperator", "match": "\\b(datatable)(?=\\W*\\()", "name": "keyword.other.query.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "keyword.other.operator.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/facetoperator", "match": "\\b(facet)(?:\\s+(by))?\\b", "name": "meta.query.facet.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "entity.name.function.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/invokeoperator", "match": "\\b(invoke)(?:\\s+(\\w+))?\\b", "name": "meta.query.invoke.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "keyword.other.operator.kusto" }, "3": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/orderoperator", "match": "\\b(order)(?:\\s+(by)\\s+(\\w+))?\\b", "name": "meta.query.order.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "variable.other.column.kusto" }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "5": { "name": "keyword.other.operator.kusto" }, "6": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] }, "7": { "name": "keyword.other.operator.kusto" }, "8": { "patterns": [{ "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/rangeoperator", "match": "\\b(range)\\s+(\\w+)\\s+(from)\\s+(\\w+(?:\\(\\w*\\))?)\\s+(to)\\s+(\\w+(?:\\(\\w*\\))?)\\s+(step)\\s+(\\w+(?:\\(\\w*\\))?)\\b", "name": "meta.query.range.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sampleoperator", "match": "\\b(sample)(?:\\s+(\\d+))?(?![\\w-])", "name": "meta.query.sample.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sampledistinctoperator", "match": "\\b(sample-distinct)(?:\\s+(\\d+)\\s+(of)\\s+(\\w+))?\\b", "name": "meta.query.sample-distinct.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "name": "keyword.other.operator.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/sortoperator", "match": "\\b(sort)(?:\\s+(by))?\\b", "name": "meta.query.sort.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/takeoperator", "match": "\\b(take|limit)(?:\\s+(\\d+))\\b", "name": "meta.query.take.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/topoperator", "match": "\\b(top)(?:\\s+(\\d+)\\s+(by)\\s+(\\w+))?(?![\\w-])\\b", "name": "meta.query.top.kusto" }, { "captures": { "1": { "name": "keyword.other.query.kusto" }, "2": { "patterns": [{ "include": "#Numeric" }] }, "3": { "name": "keyword.other.operator.kusto" }, "4": { "name": "variable.other.column.kusto" }, "5": { "name": "keyword.other.operator.kusto" }, "6": { "name": "variable.other.column.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/tophittersoperator", "match": "\\b(top-hitters)(?:\\s+(\\d+)\\s+(of)\\s+(\\w+)(?:\\s+(by)\\s+(\\w+))?)?\\b", "name": "meta.query.top-hitters.kusto" }, { "comment": "Tabular operators: https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/queries", "match": "\\b(consume|count|distinct|evaluate|extend|externaldata|find|fork|getschema|join|lookup|make-series|mv-apply|mv-expand|project-away|project-keep|project-rename|project-reorder|project|parse|parse-where|parse-kv|partition|print|reduce|render|scan|search|serialize|shuffle|summarize|top-nested|union|where)\\b", "name": "keyword.other.query.kusto" }, { "comment": "Tabular operators: evalute (plugins): https://docs.microsoft.com/en-us/azure/kusto/query/evaluateoperator", "match": "\\b(active_users_count|activity_counts_metrics|activity_engagement|new_activity_metrics|activity_metrics|autocluster|azure_digital_twins_query_request|bag_unpack|basket|cosmosdb_sql_request|dcount_intersect|diffpatterns|funnel_sequence_completion|funnel_sequence|http_request_post|http_request|infer_storage_schema|ipv4_lookup|mysql_request|narrow|pivot|preview|rolling_percentile|rows_near|schema_merge|session_count|sequence_detect|sliding_window_counts|sql_request)\\b", "name": "support.function.kusto" }, { "comment": "Tabular operators: join: https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator", "match": "\\b(on|kind|hint\\.remote|hint\\.strategy)\\b", "name": "keyword.other.operator.kusto" }, { "comment": "Tabular operators: join ($left, $right): https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator", "match": "(\\$left|\\$right)\\b", "name": "keyword.other.kusto" }, { "comment": "Tabular operators: join (kinds, strategies): https://docs.microsoft.com/en-us/azure/kusto/query/joinoperator", "match": "\\b(innerunique|inner|leftouter|rightouter|fullouter|leftanti|anti|leftantisemi|rightanti|rightantisemi|leftsemi|rightsemi|broadcast)\\b", "name": "keyword.other.kusto" }, { "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/machine-learning-and-tsa", "match": "\\b(series_abs|series_acos|series_add|series_asin|series_atan|series_cos|series_decompose|series_decompose_anomalies|series_decompose_forecast|series_divide|series_equals|series_exp|series_fft|series_fill_backward|series_fill_const|series_fill_forward|series_fill_linear|series_fir|series_fit_2lines_dynamic|series_fit_2lines|series_fit_line_dynamic|series_fit_line|series_fit_poly|series_greater_equals|series_greater|series_ifft|series_iir|series_less_equals|series_less|series_multiply|series_not_equals|series_outliers|series_pearson_correlation|series_periods_detect|series_periods_validate|series_pow|series_seasonal|series_sign|series_sin|series_stats|series_stats_dynamic|series_subtract|series_tan)\\b", "name": "support.function.kusto" }, { "comment": "Tabular operators: mv-expand (bagexpand options): https://docs.microsoft.com/en-us/azure/kusto/query/mvexpandoperator", "match": "\\b(bag|array)\\b", "name": "keyword.other.operator.kusto" }, { "comment": "Tabular operators: order: https://docs.microsoft.com/en-us/azure/kusto/query/orderoperator", "match": "\\b(asc|desc|nulls first|nulls last)\\b", "name": "keyword.other.kusto" }, { "comment": "Tabular operators: parse: https://docs.microsoft.com/en-us/azure/kusto/query/parseoperator", "match": "\\b(regex|simple|relaxed)\\b", "name": "keyword.other.kusto" }, { "match": "\\b(anomalychart|areachart|barchart|card|columnchart|ladderchart|linechart|piechart|pivotchart|scatterchart|stackedareachart|timechart|timepivot)\\b", "name": "support.function.kusto" }, { "include": "#Strings" }, { "match": "\\{.*?\\}", "name": "string.other.kusto" }, { "comment": "Comments", "match": "//.*", "name": "comment.line.kusto" }, { "include": "#TimeSpanLiterals" }, { "include": "#DateTimeTimeSpanFunctions" }, { "include": "#DateTimeTimeSpanDataTypes" }, { "include": "#Numeric" }, { "match": "\\b(true|false|null)\\b", "name": "constant.language.kusto" }, { "comment": "Deprecated functions", "match": "\\b(anyif|any|array_strcat|base64_decodestring|base64_encodestring|make_dictionary|makelist|makeset|mvexpand|todynamic|parse_json|replace|weekofyear)(?=\\W*\\(|\\b)", "name": "invalid.deprecated.kusto" }], "repository": { "DateTimeTimeSpanDataTypes": { "patterns": [{ "match": "\\b(datetime|timespan|time)\\b", "name": "storage.type.kusto" }] }, "DateTimeTimeSpanFunctions": { "patterns": [{ "captures": { "1": { "name": "support.function.kusto" }, "2": { "patterns": [{ "include": "#DateTimeTimeSpanDataTypes" }] }, "3": { "patterns": [{ "include": "#Strings" }] } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/format-datetimefunction", "match": `\\b(format_datetime)(?:\\s*\\(\\s*(.+?)\\s*,\\s*(['"].*?['"])\\s*\\))?(?!\\w)`, "name": "meta.scalar.function.format_datetime.kusto" }, { "comment": "Scalar function: DateTime/Timespan Functions: https://docs.microsoft.com/en-us/azure/kusto/query/scalarfunctions#datetimetimespan-functions", "match": "\\b(ago|datetime_add|datetime_diff|datetime_local_to_utc|datetime_part|datetime_utc_to_local|dayofmonth|dayofweek|dayofyear|endofday|endofmonth|endofweek|endofyear|format_timespan|getmonth|getyear|hourofday|make_datetime|make_timespan|monthofyear|now|startofday|startofmonth|startofweek|startofyear|todatetime|totimespan|week_of_year)(?=\\W*\\()", "name": "support.function.kusto" }] }, "Escapes": { "patterns": [{ "match": `(\\\\['"]|\\\\\\\\)`, "name": "constant.character.escape.kusto" }] }, "Numeric": { "patterns": [{ "match": "\\b((0(x|X)[0-9a-fA-F]*)|(([0-9]+\\.?[0-9]*+)|(\\.[0-9]+))((e|E)(\\+|-)?[0-9]+)?)(L|l|UL|ul|u|U|F|f|ll|LL|ull|ULL)?(?=\\b|\\w)", "name": "constant.numeric.kusto" }] }, "Strings": { "patterns": [{ "begin": '([@h]?")', "beginCaptures": { "1": { "name": "punctuation.definition.string.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string", "end": '"', "endCaptures": { "0": { "name": "punctuation.definition.string.kusto" } }, "name": "string.quoted.double.kusto", "patterns": [{ "include": "#Escapes" }] }, { "begin": "([@h]?')", "beginCaptures": { "1": { "name": "punctuation.definition.string.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string", "end": "'", "endCaptures": { "0": { "name": "punctuation.definition.string.kusto" } }, "name": "string.quoted.single.kusto", "patterns": [{ "include": "#Escapes" }] }, { "begin": "([@h]?```)", "beginCaptures": { "1": { "name": "punctuation.definition.string.kusto" } }, "comment": "https://learn.microsoft.com/en-us/azure/data-explorer/kusto/query/scalar-data-types/string#multi-line-string-literals", "end": "```", "endCaptures": { "0": { "name": "punctuation.definition.string.kusto" } }, "name": "string.quoted.multi.kusto", "patterns": [{ "include": "#Escapes" }] }] }, "TimeSpanLiterals": { "patterns": [{ "comment": "timespan literals: https://docs.microsoft.com/en-us/azure/kusto/query/scalar-data-types/timespan#timespan-literals", "match": "[+-]?(?:\\d*\\.)?\\d+(?:microseconds?|ticks?|seconds?|ms|d|h|m|s)\\b", "name": "constant.numeric.kusto" }] } }, "scopeName": "source.kusto", "aliases": ["kql"] });
2
2
  var kusto = [
3
3
  lang
4
4
  ];