Skip to content

refactor(lsp): accept only one Tool & ToolBuilder#20840

Merged
graphite-app[bot] merged 1 commit intomainfrom
03-29-refactor_lsp_accept_only_one_tool_toolbuilder
Mar 29, 2026
Merged

refactor(lsp): accept only one Tool & ToolBuilder#20840
graphite-app[bot] merged 1 commit intomainfrom
03-29-refactor_lsp_accept_only_one_tool_toolbuilder

Conversation

@Sysix
Copy link
Copy Markdown
Member

@Sysix Sysix commented Mar 29, 2026

Pull request overview

Refactors the oxc_language_server LSP implementation to operate with a single Tool/ToolBuilder instead of managing multiple tools per workspace, simplifying worker creation and capability wiring.

Copy link
Copy Markdown
Member Author

Sysix commented Mar 29, 2026


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 changes, fast-track this PR to the front of 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.

@github-actions github-actions bot added A-linter Area - Linter A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior labels Mar 29, 2026
@Sysix Sysix requested a review from Copilot March 29, 2026 15:03
Copy link
Copy Markdown
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

Refactors the oxc_language_server LSP implementation to operate with a single Tool/ToolBuilder instead of managing multiple tools per workspace, simplifying worker creation and capability wiring.

Changes:

  • Replaced tool/builder collections with single tool + builder in WorkspaceWorker and WorkerManager.
  • Updated Backend/run_server APIs and call sites to pass a single ToolBuilder.
  • Adjusted LSP and worker tests to construct and pass a single FakeToolBuilder.

Reviewed changes

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

Show a summary per file
File Description
crates/oxc_language_server/src/worker_manager.rs Stores a single shared tool builder and passes it into new workers; updates tests accordingly.
crates/oxc_language_server/src/worker.rs Switches from Vec<Tool> to a single optional tool and updates all tool interactions/shutdown/watchers.
crates/oxc_language_server/src/backend.rs Uses the single tool builder to contribute server capabilities; Backend::new now accepts one builder.
crates/oxc_language_server/src/lib.rs run_server signature updated to accept a single ToolBuilder.
crates/oxc_language_server/src/tests.rs Updates integration-style tests to construct Backend with a single FakeToolBuilder.
apps/oxlint/src/lsp/mod.rs Updates oxlint LSP entrypoint to pass one builder.
apps/oxfmt/src/lsp/mod.rs Updates oxfmt LSP entrypoint to pass one builder.
Comments suppressed due to low confidence (1)

crates/oxc_language_server/src/worker.rs:189

  • format_file still has logic/comments that assume multiple tools (e.g. “continue to the next tool”), but the worker now holds only one tool. Simplifying this to a single-tool flow (and updating the comment accordingly) would reduce confusion and make the intent clearer.
        for tool in self.tool.read().await.iter() {
            let edits = tool.run_format(document)?;
            // If no edits are made, continue to the next tool
            if edits.is_empty() {
                continue;
            }

@Sysix Sysix force-pushed the 03-29-refactor_lsp_accept_only_one_tool_toolbuilder branch 2 times, most recently from 0278e72 to 58519df Compare March 29, 2026 15:31
@Sysix Sysix requested a review from Copilot March 29, 2026 15:32
Copy link
Copy Markdown
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

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

@Sysix Sysix marked this pull request as ready for review March 29, 2026 15:37
@Sysix Sysix requested a review from camc314 as a code owner March 29, 2026 15:37
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
@camc314 camc314 self-assigned this Mar 29, 2026
Copy link
Copy Markdown
Contributor

camc314 commented Mar 29, 2026

Merge activity

> ## Pull request overview
>
> Refactors the `oxc_language_server` LSP implementation to operate with a single `Tool`/`ToolBuilder` instead of managing multiple tools per workspace, simplifying worker creation and capability wiring.
@graphite-app graphite-app bot force-pushed the 03-29-refactor_lsp_accept_only_one_tool_toolbuilder branch from 58519df to 58012db Compare March 29, 2026 16:21
@graphite-app graphite-app bot merged commit 58012db into main Mar 29, 2026
26 checks passed
@graphite-app graphite-app bot deleted the 03-29-refactor_lsp_accept_only_one_tool_toolbuilder branch March 29, 2026 16:25
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Mar 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter A-linter Area - Linter 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