Closed zth closed 4 months ago
cc @cometkim
Cc @cristianoc
What's the perf difference in practice?
It seems to vary wildly depending on how the system handles frequently spawning child processes. For me, there's no noticeable difference, but for for example @cometkim and @jonoprest, there's a pretty massive difference at times.
In case we're worried about things changing infrequently such as compiler version, one possibility would be to refresh the data from time to time (e.g. based on an interval). Which should have no impact on latency.
Yeah this is a good approach. I think what I want us to do soon is what you mentioned in another thread - figure out and write down all of the inputs that might change which the LS needs to react to, and then figure out which of those are worth caring about, and what then to do about them.
Anything else to pay attention to in this PR?
Not really no, this should be fairly straight forward.
I certainly experience delays. I've increased my lsp timeout to 5 seconds and still often hit timeouts with rescript ls. It could be a configuration or setup issue but I don't get these delays on other lsps. Rust analyzer for eg also has to index a project before it can be used with the editor (which can take minutes) but it doesn't freeze the editor or hit any timeouts.
@JonoPrest did you try with the VSIX of this PR? https://github.com/rescript-lang/rescript-vscode/actions/runs/9397264258
@JonoPrest did you try with the VSIX of this PR?
https://github.com/rescript-lang/rescript-vscode/actions/runs/9397264258
I did yes 👍🏼 we've been discussing it on discord. I think there was an improvement but I haven't been able to try the project cache configuration yet.
This reduces latency in the language server by caching a few project config related things, so that we most often don't need to do any potentially expensive lookups before we call the analysis, or invoke incremental typechecking.
Known issues with this approach: We need to recompute the ReScript version if it changes. I however don't believe we're watching anything already that can help us figure out when to recompute it. Will need to think a bit about how to do that. It's not a big problem though, because changing the ReScript version in a project does not happen often. And a restart of the language server (or closing all project files) will fix it.