hashicorp / terraform-ls

Terraform Language Server
Mozilla Public License 2.0
987 stars 129 forks source link

Diagnostics updated for all files on changes #1603

Open rchl opened 7 months ago

rchl commented 7 months ago

Language Server Version

v0.32.6

Terraform Version

Terraform v1.0.4 on darwin_arm64

Client Version

Sublime LSP 1.28.0

Behavior

I don't know if this causes any performance issue but I've noticed this non-ideal behavior when checking out some slowness...

I've noticed that the server reports diagnostics for all files in the workspace on every change, even if the diagnostic state doesn't change for given files.

Screenshot 2024-01-29 at 12 12 45

I think that there is a potential for optimization here - it could keep the state of diagnostics internally and only report when there are any changes since the last update.

Steps to Reproduce

Terraform Configuration

No response

Project Structure

No response

Gist

No response

References

No response

Community Note

dbanck commented 7 months ago

Hi @rchl!

Thanks for the report. I agree, it's not ideal and can be improved. In my tests I only saw diagnostics for files of the same module (directory), not the whole workspace.

I can't see the full paths in your screenshot, but I assume this is a module with many files?

rchl commented 7 months ago

It might be that it's just the module (directory). We have just a flat structure with all files in the same directory.

Also seems like diagnostics are only reported when at least one file has some diagnostic reported. As soon as none of the files have any reported diagnostics then no diagnostics are published on changes.