Skip to content
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

Cache early validation diagnostics #1347

Closed
dbanck opened this issue Aug 4, 2023 · 2 comments
Closed

Cache early validation diagnostics #1347

dbanck opened this issue Aug 4, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request needs-research performance Gotta go fast

Comments

@dbanck
Copy link
Member

dbanck commented Aug 4, 2023

Language Server Version

v0.31.4

Problem Statement

With the current early validation implementation, we validate and publish diagnostics for all files in a module whenever we detect a change to the module. However, it's likely that only a single file has changed (e.g., the file a user is editing), so the schema-based diagnostics for the other files are still the same.

So in an ideal world, we would revalidate the single file and use the cached diagnostics for the other files.


Part of hashicorp/vscode-terraform#720

Proposal

  • Investigate how to cache diagnostics for a file
    • How to invalidate the cache
    • How to know which file diagnostics need to be updated
  • Idea
    • Introduce a method for validating a single file in hcl-lang
    • Plumb the file change through the DocumentChanged handler to the validation job (parameter? context?)
    • Validate the whole module on didOpen, validate the single file on didChange

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@dbanck
Copy link
Member Author

dbanck commented Sep 12, 2023

#1370 implements the outlined idea and I don't need we need any more caching for now.

@dbanck dbanck closed this as completed Sep 12, 2023
@github-actions
Copy link

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.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 13, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request needs-research performance Gotta go fast
Projects
None yet
Development

No branches or pull requests

1 participant