grammars/source.terraform.json in github-linguist-5.0.8 vs grammars/source.terraform.json in github-linguist-5.0.9

- old
+ new

@@ -68,11 +68,13 @@ }, "8": { "name": "punctuation.definition.tag.terraform" } }, - "match": "(resource|data)\\s+(\")?(\\w+)(\")?\\s+(\")?([\\w-]+)(\")?\\s+({)", + "foldingStartMarker": "\\{\\s*$", + "foldingStopMarker": "^\\s*\\}", + "match": "(resource|data)\\s+(\")?(\\w+)(\")?\\s+(\")?([\\w\\-]+)(\")?\\s+({)", "name": "meta.resource.terraform" }, { "captures": { "1": { @@ -89,11 +91,13 @@ }, "5": { "name": "punctuation.definition.tag.terraform" } }, - "match": "(provider|provisioner|variable|output|module|atlas)\\s+(\")?([\\w-]+)(\")?\\s+({)" + "foldingStartMarker": "\\{\\s*$", + "foldingStopMarker": "^\\s*\\}", + "match": "(provider|provisioner|variable|output|module|atlas)\\s+(\")?([\\w\\-]+)(\")?\\s+({)" }, { "captures": { "1": { "name": "variable.other.assignment.terraform" @@ -134,29 +138,11 @@ }, "comment": "Maps", "match": "([\\w\\-_]+)\\s+({)" }, { - "begin": "\\\"", - "beginCaptures": { - "0": { - "name": "string.terraform punctuation.definition.string.begin.terraform" - } - }, - "comment": "Strings", - "end": "\\\"", - "endCaptures": { - "0": { - "name": "string.terraform punctuation.definition.string.end.terraform" - } - }, - "name": "string.quoted.double.terraform", - "patterns": [ - { - "include": "#string_interpolation" - } - ] + "include": "#strings" }, { "begin": "(?>\\s*<<(\\w+))", "beginCaptures": { "0": { @@ -167,11 +153,11 @@ } }, "end": "^\\1$", "endCaptures": { "0": { - "name": "keyword.operator.heredoc.terraform" + "name": "punctuation.definition.string.end.terraform keyword.operator.heredoc.terraform" } }, "name": "string.unquoted.heredoc.terraform" } ], @@ -180,32 +166,99 @@ "patterns": [ { "begin": "\\$\\{", "beginCaptures": { "0": { - "name": "punctuation.section.embedded.end.terraform" + "name": "entity.tag.embedded.start.terraform" } }, "end": "\\}", "endCaptures": { "0": { - "name": "punctuation.section.embedded.end.terraform" + "name": "entity.tag.embedded.end.terraform" } }, "name": "source.terraform.embedded.source", "patterns": [ { + "include": "$self" + }, + { + "include": "#string_interpolation_functions" + }, + { + "include": "#string_interpolation_keywords" + }, + { "captures": { "0": { "name": "keyword.control.period.terraform" } }, "match": "(\\.)" }, { - "include": "#string_interpolation" + "include": "#strings" } ] + } + ] + }, + "string_interpolation_functions": { + "begin": "(base64decode|base64encode|base64sha256|ceil|cidrnetmask|compact|distinct|file|floor|keys|length|lower|md5|pathexpand|replace|sha1|sha256|signum|sort|timestamp|title|trimspace|upper|uuid|values|cidrhost|cidrsubnet|coalesce|concat|element|format|formatlist|from|index|join|jsonencode|length|list|lookup|map|max|merge|min|slice|split|substr|zipmap)(\\()", + "beginCaptures": { + "1": { + "name": "keyword.other.function.inline.terraform" + }, + "2": { + "name": "keyword.other.section.begin.terraform" + } + }, + "comment": "Builtin functions", + "end": "(\\))", + "endCaptures": { + "1": { + "name": "keyword.other.section.end.terraform" + } + }, + "patterns": [ + { + "include": "$self" + }, + { + "include": "#string_interpolation_keywords" + } + ] + }, + "string_interpolation_keywords": { + "captures": { + "0": { + "name": "entity.other.attribute-name.terraform" + } + }, + "match": "(terraform|var|self|count|module|path|data)(\\.[\\w\\*]+)+" + }, + "strings": { + "begin": "\\\"", + "beginCaptures": { + "0": { + "name": "string.terraform punctuation.definition.string.begin.terraform" + } + }, + "comment": "Strings", + "end": "\\\"", + "endCaptures": { + "0": { + "name": "string.terraform punctuation.definition.string.end.terraform" + } + }, + "patterns": [ + { + "include": "#string_interpolation" + }, + { + "match": "([\\w\\-\\/\\._\\\\%]+)", + "name": "string.quoted.double.terraform" } ] } }, "scopeName": "source.terraform", \ No newline at end of file