You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In #621 (part of 0.22.0+) we introduced parsing of non-autoloaded *.tfvars files (in addition to the autoloaded ones). This worked with the assumption that we only publish diagnostics when any individual file is opened and clear them when it's closed. This would reflect that invalid *.tfvars which are not autoloaded do not affect regular Terraform operations by default.
However we decided to refactor how diagnostics are handled in #714 which generally decoupled diagnostic publishing away from RPC request handlers, which in turn took away the opportunity to easily and quickly distinguish whether a file is opened or not.
As part of that refactoring we decided to avoid publishing diagnostics for these files as that basically aligns with how gopls handles diagnostics in similar cases - Go build tags.
Use-cases
Users should be able to see diagnostics as they edit any variable file (*.tfvars), but these diagnostics should not be distracting them if the file is actually never used.
Attempted Solutions
Publish diagnostics upon file opening and clear them upon closing.
Proposal
We could introduce a config option ExtraVarFiles []string to existing options
However this only solves some scenarios as it assumes this setting would be LS-wide for the whole process.
Ideally we should let the user segment this configuration by folder. It is possible that we could leverage workspace/configuration here, but it's unclear what requirements does that have on the client side and which clients actually implement it and how.
Background
In #621 (part of 0.22.0+) we introduced parsing of non-autoloaded
*.tfvars
files (in addition to the autoloaded ones). This worked with the assumption that we only publish diagnostics when any individual file is opened and clear them when it's closed. This would reflect that invalid*.tfvars
which are not autoloaded do not affect regular Terraform operations by default.However we decided to refactor how diagnostics are handled in #714 which generally decoupled diagnostic publishing away from RPC request handlers, which in turn took away the opportunity to easily and quickly distinguish whether a file is opened or not.
As part of that refactoring we decided to avoid publishing diagnostics for these files as that basically aligns with how gopls handles diagnostics in similar cases - Go build tags.
Use-cases
Users should be able to see diagnostics as they edit any variable file (
*.tfvars
), but these diagnostics should not be distracting them if the file is actually never used.Attempted Solutions
Publish diagnostics upon file opening and clear them upon closing.
Proposal
We could introduce a config option
ExtraVarFiles []string
to existing optionsterraform-ls/internal/settings/settings.go
Lines 18 to 31 in 877dcee
However this only solves some scenarios as it assumes this setting would be LS-wide for the whole process.
Ideally we should let the user segment this configuration by folder. It is possible that we could leverage
workspace/configuration
here, but it's unclear what requirements does that have on the client side and which clients actually implement it and how.Notes
The text was updated successfully, but these errors were encountered: