sway icon indicating copy to clipboard operation
sway copied to clipboard

Refactor LSP: Centralize Workspace-Level Resources

Open JoshuaBatty opened this issue 8 months ago • 0 comments

Currently, sway-lsp creates separate sessions with duplicated state (like Engines and TokenMap) for each member within a workspace, leading to inefficiency. This issue tracks the effort to refactor the language server to properly handle Sway workspaces by leveraging the existing workspace support within forc-pkg.

Resources like token_map, engines, diagnostics, runnables, and build_plan_cache should be moved from existing within uniqe Session instances per workspace member, into the main ServerState so they can be shared amongst all workspace members. This refactoring will significantly improve performance and reduce memory usage for workspace users and will be implemented incrementally across several pull requests.

JoshuaBatty avatar Apr 24 '25 01:04 JoshuaBatty