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

Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Nov 10, 2025

This PR refactors the language server architecture by moving tool definitions (linter and formatter) from individual workers to the Backend. The ToolBuilder trait is redesigned to use a method that returns boxed trait objects, and builder structs are simplified to stateless types.

Now it should be easy to implement something like Backend::new(vec![ServerLinterBuilder]);

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Nov 10, 2025
Copy link
Member Author

Sysix commented Nov 10, 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-10-refactor_language_server_move_tools_definitions_to_backend_ branch from dbf139d to 6fef53d Compare November 10, 2025 19:32
@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 force-pushed the 11-10-refactor_language_server_move_tools_definitions_to_backend_ branch 3 times, most recently from fde861f to 5821976 Compare November 10, 2025 20:43
@Sysix Sysix force-pushed the 11-10-refactor_language_server_move_tools_definitions_to_backend_ branch from 5821976 to f2eef3a Compare 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 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 force-pushed the 11-10-refactor_language_server_move_tools_definitions_to_backend_ branch from f2eef3a to 609101a Compare November 10, 2025 22:01
@Sysix Sysix requested a review from Copilot November 10, 2025 22:02
Copilot finished reviewing on behalf of Sysix November 10, 2025 22:04
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 architecture by moving tool definitions (linter and formatter) from individual workers to the Backend. The ToolBuilder trait is redesigned to use a method that returns boxed trait objects, and builder structs are simplified to stateless types.

  • Redesigned ToolBuilder trait with a build_boxed method that takes parameters by reference
  • Simplified ServerLinterBuilder and ServerFormatterBuilder to stateless structs with static-like build methods
  • Centralized tool builder instantiation in Backend::new() and passed them to workers during initialization

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
crates/oxc_language_server/src/tool.rs Simplified ToolBuilder trait to return boxed trait objects with references
crates/oxc_language_server/src/linter/server_linter.rs Refactored ServerLinterBuilder to a stateless struct with separate build and build_boxed methods
crates/oxc_language_server/src/formatter/server_formatter.rs Refactored ServerFormatterBuilder to a stateless struct with separate build and build_boxed methods
crates/oxc_language_server/src/backend.rs Added tool_builders field and centralized tool builder instantiation
crates/oxc_language_server/src/worker.rs Updated start_worker to accept tool builders as parameters
crates/oxc_language_server/src/linter/tester.rs Updated test code to use new builder pattern
crates/oxc_language_server/src/formatter/tester.rs Updated test code to use new builder pattern

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sysix Sysix force-pushed the 11-10-refactor_language_server_move_tools_definitions_to_backend_ branch from 609101a to 0f0f260 Compare November 11, 2025 17:27
@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-refactor_language_server_move_tools_definitions_to_backend_ branch from 0f0f260 to a8f4156 Compare November 11, 2025 18:05
@Sysix Sysix marked this pull request as ready for review November 11, 2025 18:14
@Sysix Sysix requested a review from camc314 as a code owner November 11, 2025 18:14
@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.

2 participants