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

Support provider-defined functions syntax #98

Closed
2 tasks done
dbanck opened this issue Feb 6, 2024 · 0 comments · Fixed by #99
Closed
2 tasks done

Support provider-defined functions syntax #98

dbanck opened this issue Feb 6, 2024 · 0 comments · Fixed by #99
Assignees
Labels
enhancement New feature or request

Comments

@dbanck
Copy link
Member

dbanck commented Feb 6, 2024

Background

We currently only have a static list of valid function names in the Terraform grammar. Provider-defined functions introduce a new syntax for function calls, provider::aws::noop(). Also, it's impossible to compile all function names as a static list in the grammar, so we'll just assume that any function call with this new snytax is valid.

Proposal

  • Update Terraforms functions grammar block, e.g.
  functions:
    begin: ([:\w]+)(\()
    name: meta.function-call.hcl
    comment: Built-in and provider defined function calls
    beginCaptures:
      "1":
        patterns:
          - match: \b(abs|abspath|...|zipmap)\b
            name: support.function.builtin.terraform
          - match: \b(provider::\w+::\w+)\b
            name: support.function.provider
      "2":
        name: punctuation.section.parens.begin.hcl
    end: \)
  • Add some tests for the new syntax
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants