Avoid re-processing files on textDocument/didOpen
if content is the same as on disk
#1375
Labels
textDocument/didOpen
if content is the same as on disk
#1375
Context
Currently we re-process whole module whenever a file gets opened as we cannot be sure that the client isn't sending us modified content along with the open notification. e.g. the IDE may have restored some unsaved changes to the document.
This should not be a very common case (restoring unsaved changes) and our current implementation is somewhat pessimistic to ensure that we always catch any such changes if they come.
This in turn means we do much more work than we possibly need to upon opening every file.
terraform-ls/internal/langserver/handlers/did_open.go
Lines 58 to 65 in fb82217
Proposal
Consider comparing the received file content against the file content on disk to understand if it differs and hence if it's necessary to re-process the module.
Implementation Notes
We could try to calculate and compare checksums, e.g.
The text was updated successfully, but these errors were encountered: