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

Document use of grammars in template/expression context #68

Open
2 tasks
radeksimko opened this issue Mar 23, 2023 · 0 comments
Open
2 tasks

Document use of grammars in template/expression context #68

radeksimko opened this issue Mar 23, 2023 · 0 comments
Labels
documentation Improvements or additions to documentation

Comments

@radeksimko
Copy link
Member

radeksimko commented Mar 23, 2023

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
@radeksimko radeksimko added the documentation Improvements or additions to documentation label Mar 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

1 participant