Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Nov 8, 2025

No description provided.

Copy link
Member Author

Sysix commented Nov 8, 2025

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.
Learn more


How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent hot fixes, skip the queue and merge this PR next

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.

@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 5fc79d4 to c254688 Compare November 9, 2025 00:36
@Sysix Sysix force-pushed the 11-08-perf_language_server_execute_tools_in_parallel branch from c5c8a8d to 4abc114 Compare November 9, 2025 00:36
@graphite-app graphite-app bot changed the base branch from 11-08-perf_language_server_execute_tools_in_parallel to graphite-base/15505 November 9, 2025 00:42
@graphite-app graphite-app bot force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from c254688 to 99ca5f3 Compare November 9, 2025 00:47
@graphite-app graphite-app bot force-pushed the graphite-base/15505 branch from 4abc114 to 25d577e Compare November 9, 2025 00:47
@graphite-app graphite-app bot changed the base branch from graphite-base/15505 to main November 9, 2025 00:47
@graphite-app graphite-app bot force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 99ca5f3 to 5af7f64 Compare November 9, 2025 00:48
@Sysix Sysix changed the base branch from main to graphite-base/15505 November 9, 2025 14:29
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 5af7f64 to 0df28ca Compare November 9, 2025 14:29
@Sysix Sysix changed the base branch from graphite-base/15505 to 11-09-perf_language_server_avoid_mutex_in_serverlinter_ November 9, 2025 14:29
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch 2 times, most recently from 4c97e71 to 2eed4b7 Compare November 9, 2025 15:15
@Sysix Sysix requested a review from Copilot November 9, 2025 15:28
Copy link
Contributor

Copilot AI left a 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 Tool trait to be object-safe with Send + Sync bounds and added a name() method
  • Changed ToolRestartChanges from a generic struct to use Box<dyn Tool> for dynamic dispatch
  • Refactored WorkspaceWorker to 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() {
Copy link

Copilot AI Nov 9, 2025

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.

Copilot uses AI. Check for mistakes.
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 2eed4b7 to 33b342d Compare November 9, 2025 15:58
@Sysix Sysix changed the base branch from 11-09-perf_language_server_avoid_mutex_in_serverlinter_ to graphite-base/15505 November 10, 2025 17:06
@graphite-app graphite-app bot force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 33b342d to 1b72aac Compare November 10, 2025 17:51
@graphite-app graphite-app bot force-pushed the graphite-base/15505 branch from 54ff8d1 to ccfd935 Compare November 10, 2025 17:51
@graphite-app graphite-app bot changed the base branch from graphite-base/15505 to main November 10, 2025 17:52
@graphite-app graphite-app bot force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 1b72aac to 9797e29 Compare November 10, 2025 17:52
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 9797e29 to 0aecf04 Compare November 10, 2025 18:03
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 0aecf04 to 57f4b63 Compare November 10, 2025 19:32
@Sysix Sysix changed the base branch from main to graphite-base/15505 November 10, 2025 21:53
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 57f4b63 to b440960 Compare November 10, 2025 21:53
@Sysix Sysix changed the base branch from graphite-base/15505 to 11-10-perf_language_servr_pass_file_content_as_a_referenced_string_ November 10, 2025 21:54
@Sysix Sysix force-pushed the 11-10-perf_language_servr_pass_file_content_as_a_referenced_string_ branch from 32d2937 to c486039 Compare November 10, 2025 22:01
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from b440960 to 70b6c56 Compare November 10, 2025 22:01
@Sysix Sysix changed the title refactor(language_server): make tools more generic refactor(language_server): make tools inside WorkspaceWorker more generic Nov 10, 2025
@Sysix Sysix marked this pull request as ready for review November 10, 2025 22:02
@Sysix Sysix requested a review from camc314 as a code owner November 10, 2025 22:02
@Sysix Sysix changed the title refactor(language_server): make tools inside WorkspaceWorker more generic refactor(language_server): make tools inside WorkspaceWorker more generic Nov 10, 2025
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from 70b6c56 to ad5dbc6 Compare November 11, 2025 17:27
@Sysix Sysix force-pushed the 11-10-perf_language_servr_pass_file_content_as_a_referenced_string_ branch from c486039 to de9fe05 Compare November 11, 2025 17:27
@Sysix Sysix requested a review from camc314 November 11, 2025 17:29
@Sysix Sysix force-pushed the 11-10-perf_language_servr_pass_file_content_as_a_referenced_string_ branch from de9fe05 to f0f0063 Compare November 11, 2025 20:19
@Sysix Sysix force-pushed the 11-08-refactor_language_server_make_tools_more_generic branch from ad5dbc6 to 1c2c060 Compare November 11, 2025 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants