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
Prior to #714 we would only (re)publish diagnostics as part of RPC request handlers, which reduced the chance of publishing outdated diagnostics as we wouldn't respond to the original didChange request until diagnostics were actually published.
For (practical) reasons described in the linked PR however there is now some chance that the user is briefly presented with outdated diagnostics as they get published continuously, as we finish (re)parsing of any file/module.
Use-cases
Reduce the chance of user being presented with outdated diagnostic by letting client drop any diagnostics which are associated with old versions of a document.
Attempted Solutions
Diagnostic publishing coupled with RPC request handling, as mentioned.
Proposal
Obtain last document version before parsing it within parser.ParseModuleFiles() and parser.ParseVariableFiles()
and track it for each diagnostic, possibly by repurposing ast.ModFilename as ast.ModFileVersion and ast.VarsFilename as ast.VarsFileVersion to hold both the filename and version.
Background
Prior to #714 we would only (re)publish diagnostics as part of RPC request handlers, which reduced the chance of publishing outdated diagnostics as we wouldn't respond to the original
didChange
request until diagnostics were actually published.For (practical) reasons described in the linked PR however there is now some chance that the user is briefly presented with outdated diagnostics as they get published continuously, as we finish (re)parsing of any file/module.
Use-cases
Reduce the chance of user being presented with outdated diagnostic by letting client drop any diagnostics which are associated with old versions of a document.
Attempted Solutions
Diagnostic publishing coupled with RPC request handling, as mentioned.
Proposal
Obtain last document version before parsing it within
parser.ParseModuleFiles()
andparser.ParseVariableFiles()
terraform-ls/internal/terraform/parser/module.go
Line 9 in 877dcee
terraform-ls/internal/terraform/parser/variables.go
Line 9 in 877dcee
and track it for each diagnostic, possibly by repurposing
ast.ModFilename
asast.ModFileVersion
andast.VarsFilename
asast.VarsFileVersion
to hold both the filename and version.terraform-ls/internal/terraform/ast/module.go
Line 9 in 877dcee
terraform-ls/internal/terraform/ast/variables.go
Line 9 in 877dcee
That way we might be able to eventually read it from where we eventually publish the diagnostics, i.e.
terraform-ls/internal/langserver/diagnostics/diagnostics.go
Lines 71 to 74 in 877dcee
Pending Questions
validate
diagnostics?The text was updated successfully, but these errors were encountered: