-
Notifications
You must be signed in to change notification settings - Fork 182
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
meta: Support all Terraform expression types #641
Labels
Comments
This was referenced Aug 12, 2021
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
38 tasks
1 task
This was referenced Oct 4, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem Statement
Terraform supports many different expressions via HCL. Some expressions might be more commonly used (e.g. static strings, numbers, booleans, scoped references...) and some less.
Users expect an LS-supported editor such as VS Code extension to provide them completion or hover and highlight arbitrarily complex and nested valid expressions.
Technical Details
The following HCL expressions are already supported in some form or shape:
LiteralValueExpr
ScopeTraversalExpr
ObjectConsExpr
ObjectConsKeyExpr
TupleConsExpr
The following are not yet supported:
AnonSymbolExpr
SplatExpr
ForExpr
TemplateJoinExpr
TemplateExpr
TemplateWrapExpr
BinaryOpExpr
UnaryOpExpr
ParenthesesExpr
ConditionalExpr
FunctionCallExpr
IndexExpr
RelativeTraversalExpr
User Impact
Pretty much all users would benefit from this, some expressions may only be used by more advanced users, but supporting all expressions is pre-requisite for being able to fully and reliably evaluate any expression.
Expected User Experience
Completion
User is provided with relevant completion for and inside any expression.
For example:
attr = HERE
attr = max( HERE )
"${ HERE }"
attr = 3 + HERE
Hover
User can see details about any expression on hover
For example:
attr = max(1, 3)
when hovered overmax
signature of the function and description comes upattr = "hello ${var.person}"
when hovered overvar.person
, type and description of the variable comes upSemantic Highlighting
All expressions are represented as highlightable tokens where appropriate.
For example:
max(1, 3)
-max
is reported as function calltype = list(string)
-list
andstring
is reported as type declarations"hello ${var.person}"
-"hello
is reported as string andvar
&person
as traversal stepsProposal
UX around expression types
resource.
address and_
escaping block in 0.15.4+ terraform-ls#893Local References
Extensions
toBodySchema
hcl-lang#118self.*
references inprovisioner
,connection
andlifecycle
blocks terraform-ls#859count.index
references in blocks w/count
terraform-ls#860each.*
references in blocks w/for_each
terraform-ls#861dynamic
block terraform-ls#530count.index
/count
terraform-ls#1093each.*
/for_each
terraform-ls#1095self.*
inprovisioner
blocks etc. terraform-ls#1096Expression Types Support
type
) terraform-ls#490${...}
template expressions in attribute values terraform-ls#522*
) terraform-ls#526for
-in
-if
expressions terraform-ls#527condition ? true : false
) terraform-ls#528+
,-
,!=
,!
...) and parentheses terraform-ls#529elem[key]
) terraform-ls#531The text was updated successfully, but these errors were encountered: