Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional core prefix to Terraform functions #111

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ repository:
beginCaptures:
"1":
patterns:
- match: \b(abs|abspath|alltrue|anytrue|base64decode|base64encode|base64gzip|base64sha256|base64sha512|basename|bcrypt|can|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|cidrsubnets|coalesce|coalescelist|compact|concat|contains|csvdecode|dirname|distinct|element|endswith|file|filebase64|filebase64sha256|filebase64sha512|fileexists|filemd5|fileset|filesha1|filesha256|filesha512|flatten|floor|format|formatdate|formatlist|indent|index|join|jsondecode|jsonencode|keys|length|log|lookup|lower|matchkeys|max|md5|merge|min|nonsensitive|one|parseint|pathexpand|plantimestamp|pow|range|regex|regexall|replace|reverse|rsadecrypt|sensitive|setintersection|setproduct|setsubtract|setunion|sha1|sha256|sha512|signum|slice|sort|split|startswith|strcontains|strrev|substr|sum|templatefile|textdecodebase64|textencodebase64|timeadd|timecmp|timestamp|title|tobool|tolist|tomap|tonumber|toset|tostring|transpose|trim|trimprefix|trimspace|trimsuffix|try|upper|urlencode|uuid|uuidv5|values|yamldecode|yamlencode|zipmap)\b
- match: \b(core::)?(abs|abspath|alltrue|anytrue|base64decode|base64encode|base64gzip|base64sha256|base64sha512|basename|bcrypt|can|ceil|chomp|chunklist|cidrhost|cidrnetmask|cidrsubnet|cidrsubnets|coalesce|coalescelist|compact|concat|contains|csvdecode|dirname|distinct|element|endswith|file|filebase64|filebase64sha256|filebase64sha512|fileexists|filemd5|fileset|filesha1|filesha256|filesha512|flatten|floor|format|formatdate|formatlist|indent|index|join|jsondecode|jsonencode|keys|length|log|lookup|lower|matchkeys|max|md5|merge|min|nonsensitive|one|parseint|pathexpand|plantimestamp|pow|range|regex|regexall|replace|reverse|rsadecrypt|sensitive|setintersection|setproduct|setsubtract|setunion|sha1|sha256|sha512|signum|slice|sort|split|startswith|strcontains|strrev|substr|sum|templatefile|textdecodebase64|textencodebase64|timeadd|timecmp|timestamp|title|tobool|tolist|tomap|tonumber|toset|tostring|transpose|trim|trimprefix|trimspace|trimsuffix|try|upper|urlencode|uuid|uuidv5|values|yamldecode|yamlencode|zipmap)\b
name: support.function.builtin.terraform
- match: \bprovider::[[:alpha:]][\w_-]*::[[:alpha:]][\w_-]*\b
name: support.function.provider
name: support.function.provider.terraform
"2":
name: punctuation.section.parens.begin.hcl
end: \)
Expand Down
4 changes: 2 additions & 2 deletions syntaxes/terraform.tmGrammar.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions tests/snapshot/terraform/expressions_functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,8 @@ foo("bar")

provider::framework::example("hi")
invalid::namespaced::function("bye")

provider::aws::abs(4)
core::abs(4)

provider::local::direxists("/path")
22 changes: 20 additions & 2 deletions tests/snapshot/terraform/expressions_functions.tf.snap
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.hcl.terraform comment.line.number-sign.hcl
>
>provider::framework::example("hi")
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.hcl.terraform meta.function-call.hcl support.function.provider
#^^^^^^^^^^^^^^^^^^^^^^^^^^^^ source.hcl.terraform meta.function-call.hcl support.function.provider.terraform
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl
Expand All @@ -375,4 +375,22 @@
# ^^^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl
# ^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.end.hcl
>
>
>provider::aws::abs(4)
#^^^^^^^^^^^^^^^^^^ source.hcl.terraform meta.function-call.hcl support.function.provider.terraform
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^ source.hcl.terraform meta.function-call.hcl constant.numeric.integer.hcl
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.end.hcl
>core::abs(4)
#^^^^^^^^^ source.hcl.terraform meta.function-call.hcl support.function.builtin.terraform
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^ source.hcl.terraform meta.function-call.hcl constant.numeric.integer.hcl
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.end.hcl
>
>provider::local::direxists("/path")
#^^^^^^^^^^^^^^^^^^^^^^^^^^ source.hcl.terraform meta.function-call.hcl support.function.provider.terraform
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.begin.hcl
# ^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.begin.hcl
# ^^^^^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl
# ^ source.hcl.terraform meta.function-call.hcl string.quoted.double.hcl punctuation.definition.string.end.hcl
# ^ source.hcl.terraform meta.function-call.hcl punctuation.section.parens.end.hcl
Loading