Open u9g opened 1 month ago
Here's an example patch of what I'm suggesting: https://github.com/u9g/gleam/commit/577e8e641ed51d319c49387af6b55f7e928bc3ae
I might be missing something though as the comment here specifically mentions clearing the caches for LSP https://github.com/gleam-lang/gleam/blob/2c59b9c3f9b00fe0c35726e00e97f7843eff5c1f/compiler-core/src/build/project_compiler.rs#L153
Ah! I'm not very fresh on this code so I'm not sure what the consequences are here. What is it that happens due to forgetting to reset this?
The project compiler empties the stale tracker immediately when compiling
https://github.com/gleam-lang/gleam/blob/2c59b9c3f9b00fe0c35726e00e97f7843eff5c1f/compiler-core/src/build/project_compiler.rs#L154
However, when calling package_compiler.rs's compile() via the LSP, we don't empty the stale_tracker because we sidestep the
ProjectCompiler
by compiling using theLspProjectCompiler
, which does not clear the stale tracker.I think the line that we should empty the stale tracker would be right above here https://github.com/gleam-lang/gleam/blob/2c59b9c3f9b00fe0c35726e00e97f7843eff5c1f/compiler-core/src/language_server/compiler.rs#L102