tree-sitter-grammars / tree-sitter-hcl

HCL grammar for tree-sitter
https://tree-sitter-grammars.github.io/tree-sitter-hcl/
Apache License 2.0
92 stars 20 forks source link

Support provider defined functions #50

Closed TomTucka closed 2 months ago

TomTucka commented 2 months ago

Is your feature request related to a problem? Please describe. Terraform added support for provider defined functions, tree-sitter should correctly highlight them

Describe the solution you'd like tree-sitter should correctly highlight provider defined functions within a terraform block

Describe alternatives you've considered HashiCorp Maintain https://github.com/hashicorp/syntax which added support in https://github.com/hashicorp/syntax/pull/110

output "test" {
  value = provider::time::rfc3339_parse("2023-07-25T23:43:16Z")
}

Error:

config_file [0, 0] - [4, 0])
  body [0, 0] - [4, 0])
    block [0, 0] - [4, 0])
      identifier [0, 0] - [0, 6])
      string_lit [0, 7] - [0, 13])
        quoted_template_start [0, 7] - [0, 8])
        template_literal [0, 8] - [0, 12])
        quoted_template_end [0, 12] - [0, 13])
      block_start [0, 14] - [0, 15])
      body [1, 2] - [1, 52])
        attribute [1, 2] - [1, 52])
          identifier [1, 2] - [1, 7])
          ERROR [1, 10] - [1, 40])
            expression [1, 10] - [1, 18])
              variable_expr [1, 10] - [1, 18])
                identifier [1, 10] - [1, 18])
            heredoc_identifier [1, 20] - [1, 24])
          expression [1, 40] - [1, 52])
            literal_value [1, 40] - [1, 52])
              string_lit [1, 40] - [1, 52])
                quoted_template_start [1, 40] - [1, 41])
                template_literal [1, 41] - [1, 51])
                quoted_template_end [1, 51] - [1, 52])
      ERROR [1, 52] - [2, 1])
      block_end [4, 0] - [4, 0])
        MISSING } [4, 0] - [4, 0])