-
Notifications
You must be signed in to change notification settings - Fork 137
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
Validate configuration and publish diagnostics #27
Comments
I don't know that it really changes anything about what you described here, but I just wanted to note that I don't know if it would help given the rest of the constraints here, but I'd be open to considering fixing that bug to be part of the solution to this issue, if that's helpful. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. |
Currently the language server ignores any potential errors or warnings.
In order for completion (and other future features) to work this is essential as we need to expect user will want to use LS features in incomplete and otherwise invalid configs and HCL has the ability to deal with such scenarios.
That said the user would benefit from having a feedback in the form of errors/warnings when their config is not up to scratch.
As part of this we need to assess what diagnostics and when to publish.
What
terraform validate
may run - perhaps consider even running that directlyterraform validate
terraform validate
can parse config and provide this data in JSON readable format (via-json
flag).The only caveat is that it also reports what could be interpreted as false negatives in the context of the language server.
This is because the command was originally designed to test preparedness for
plan
/apply
and as such it will also report missing required variables that could be provided as ENV variables in CI or elsewhere - generally somewhere outside the context of an editor and language server.For these reasons we may need to suppress such errors, or just find a different way of validating configs.
Relatedly integrating
validate
at this point would be setting a new precedent of Terraform actually parsing the config and Terraform's parsing logic may differ (hopefully doesn't though) from how the language server one. It is therefore important to integrate validation with this in mind.When
textDocument/didChange
textDocument/didSave
,textDocument/willSave
ortextDocument/willSaveWaitUntil
Generally for when I think that some user testing/surveying should happen so we know when users expect their configs to be valid and when do they expect to receive feedback if it is not valid.
The text was updated successfully, but these errors were encountered: