ruff
b76806fb - [ty] Refactor how workspace folder initialization is tracked

Commit
1 day ago
[ty] Refactor how workspace folder initialization is tracked Previously, we only kept a count of the number of workspaces initialized, but we had no way of knowing *which* workspaces were initialized. Knowing which are initialized is useful for avoiding initializing a workspace again. This is relevant because previously we only called `initialize_workspace_folder` at actual initialization time. But soon we're going to want to call it at arbitrary points in response to `workspace/didChangeWorkspaceFolders` notifications. Making initialization a no-op if a workspace is already initialized seems more flexible and harder to misuse. With that said, presumably, LSP clients won't try to re-initialize workspace folders. This does change a couple checks that were previously constant time to be linear over the number of workspace folders. I think this is fine given that the unit of work here is tiny and the number of workspace folders is not expected to be enormous. (The point at which a linear scan over all workspaces is problematic likely means we have much bigger problems.)
Author
Committer
Parents
Loading