Skip to content

Document use of grammars in template/expression context #68

@radeksimko

Description

@radeksimko

History

The main context in which we expect HCL/Terraform grammars to be used is to highlight whole HCL "bodies". For example

attr = "foobar"
block "label" {
  another = 42
}
ref = data.aws_instance.foo.tags["noot"]

The "expression" on the RHS after the = is part of the existing grammars and we happen to treat standalone expressions, such as

42
"foobar"
data.aws_instance.foo.tags["noot"]

The decision to treat standalone expressions as valid was mostly pragmatic, where it was easier to do it than not to, due to the way TextMate grammars and nesting inside works.

To date however, this was a rather "hidden feature".

Potential

There are context in which this can be genuinely useful. For example:

Proposal

  • Ensure we have this use case covered by tests
  • Document this use case clearly in the Readme

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions