-
-
Notifications
You must be signed in to change notification settings - Fork 719
refactor(language_server): make tools inside WorkspaceWorker more generic
#15505
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
base: 11-10-perf_language_servr_pass_file_content_as_a_referenced_string_
Are you sure you want to change the base?
Conversation
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
5fc79d4 to
c254688
Compare
c5c8a8d to
4abc114
Compare
c254688 to
99ca5f3
Compare
4abc114 to
25d577e
Compare
99ca5f3 to
5af7f64
Compare
5af7f64 to
0df28ca
Compare
4c97e71 to
2eed4b7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR refactors the language server to use a trait-based architecture, replacing individual server_linter and server_formatter fields with a unified Vec<Box<dyn Tool>> collection. This enables more flexible tool management and reduces code duplication.
Key changes:
- Modified
Tooltrait to be object-safe withSend + Syncbounds and added aname()method - Changed
ToolRestartChangesfrom a generic struct to useBox<dyn Tool>for dynamic dispatch - Refactored
WorkspaceWorkerto iterate over tools instead of handling each tool separately
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 9 comments.
Show a summary per file
| File | Description |
|---|---|
| crates/oxc_language_server/src/tool.rs | Made Tool trait object-safe and changed ToolRestartChanges to use boxed trait objects |
| crates/oxc_language_server/src/worker.rs | Replaced separate tool fields with unified vector, refactored all methods to iterate over tools |
| crates/oxc_language_server/src/linter/server_linter.rs | Implemented name() method and updated return types to use boxed trait objects |
| crates/oxc_language_server/src/formatter/server_formatter.rs | Implemented name() method and updated return types to use boxed trait objects |
| crates/oxc_language_server/src/formatter/mod.rs | Removed ServerFormatter from public exports as it's no longer directly referenced |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| let mut new_formatter = None; | ||
| if let Some(formatter) = self.server_formatter.read().await.as_ref() { | ||
| let format_change = formatter.handle_configuration_change( | ||
| for tool in self.tools.write().await.iter_mut() { |
Copilot
AI
Nov 9, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Acquiring a write lock for the entire iteration means all tools are locked for writing even though each tool is updated independently. This blocks concurrent reads during the entire operation. Consider collecting necessary updates first with a read lock, then acquiring write lock only when mutations are needed, or process tools in parallel where possible.
2eed4b7 to
33b342d
Compare
33b342d to
1b72aac
Compare
54ff8d1 to
ccfd935
Compare
1b72aac to
9797e29
Compare
9797e29 to
0aecf04
Compare
0aecf04 to
57f4b63
Compare
57f4b63 to
b440960
Compare
32d2937 to
c486039
Compare
b440960 to
70b6c56
Compare
WorkspaceWorker more generic
WorkspaceWorker more genericWorkspaceWorker more generic
70b6c56 to
ad5dbc6
Compare
c486039 to
de9fe05
Compare
de9fe05 to
f0f0063
Compare
ad5dbc6 to
1c2c060
Compare
No description provided.