Open
Description
Background
The existing validation logic currently aids users by reporting references to undeclared variables, such as below.
There can be different reasons behind an "orphaned" reference (reference without corresponding declaration). It could be a result of an intentional removal. But it can also be because the user started using variable reference before declaring it.
The server could help in the latter case by generating the local value declaration for the user.
For example, user may start with:
output "example" {
value = local.foo
}
and want to end up with:
locals {
foo = "value"
}
output "example" {
value = local.foo
}
Proposal
- Provide
quickfix
code action for any undeclaredlocal.*
references which will generatelocals
entry with the empty value based on constraints surrounding the reference