Skip to content

Refactor: Move SyncWorkspace from Session into ServerState #7166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 37 commits into from
May 19, 2025

Conversation

JoshuaBatty
Copy link
Member

@JoshuaBatty JoshuaBatty commented May 12, 2025

Description

  • Moves SyncWorkspace ownership from individual Session instances to a single, global instance within ServerState.
  • SyncWorkspace is now initialized once when the LSP server starts, creating a single temporary workspace clone.

Also removes the resync function. This was causing the server and the IDE to fall out of sync with each other. For example, if you have 2 panels open and then save a file in one of the tabs but have unsaved changes in the other tab then those changes would not be reflected in the temp memory folder. This meant everything would be out of sync. We already are syncing everything on each keystroke per file so this fn was not necessary in the first place.

This PR is a precursor to #7139
part of #7111

Checklist

  • I have linked to any relevant issues.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have updated the documentation where relevant (API docs, the reference, and the Sway book).
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added (or requested a maintainer to add) the necessary Breaking* or New Feature labels where relevant.
  • I have done my best to ensure that my PR adheres to the Fuel Labs Code Review Standards.
  • I have requested a review from the relevant team or maintainers.

@JoshuaBatty JoshuaBatty requested a review from a team as a code owner May 12, 2025 04:44
@JoshuaBatty JoshuaBatty marked this pull request as draft May 12, 2025 04:45
@JoshuaBatty JoshuaBatty added the language server LSP server label May 12, 2025
@JoshuaBatty JoshuaBatty self-assigned this May 12, 2025
@JoshuaBatty JoshuaBatty force-pushed the josh/workspace_sync branch from 6dabc8c to facf904 Compare May 12, 2025 05:03
Copy link

codspeed-hq bot commented May 12, 2025

CodSpeed Performance Report

Merging #7166 will improve performances by 16.5%

Comparing josh/workspace_sync (2ae531c) with master (0e3d949)

Summary

⚡ 5 improvements
✅ 17 untouched benchmarks
🆕 1 new benchmarks

Benchmarks breakdown

Benchmark BASE HEAD Change
🆕 open_all_example_workspace_members N/A 8.6 s N/A
goto_definition 1.6 ms 1.4 ms +16.05%
inlay_hints 2.2 ms 1.9 ms +12.33%
prepare_rename 1.6 ms 1.4 ms +16.42%
token_at_position 1.6 ms 1.4 ms +16.5%
tokens_for_file 1.7 ms 1.4 ms +16.31%

@JoshuaBatty JoshuaBatty force-pushed the josh/workspace_sync branch from 49bc8cd to edda976 Compare May 16, 2025 01:48
@JoshuaBatty JoshuaBatty force-pushed the josh/workspace_sync branch from 36fffad to 614d331 Compare May 16, 2025 02:49
@JoshuaBatty JoshuaBatty force-pushed the josh/workspace_sync branch from b6e9708 to 0d3c1d9 Compare May 16, 2025 04:23
@JoshuaBatty JoshuaBatty enabled auto-merge (squash) May 19, 2025 05:51
@JoshuaBatty JoshuaBatty merged commit a428376 into master May 19, 2025
43 checks passed
@JoshuaBatty JoshuaBatty deleted the josh/workspace_sync branch May 19, 2025 13:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants