Skip to content

refactor(oxfmt/lsp): pass LanguageId to run_format#19286

Merged
graphite-app[bot] merged 1 commit intomainfrom
02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_
Feb 17, 2026
Merged

refactor(oxfmt/lsp): pass LanguageId to run_format#19286
graphite-app[bot] merged 1 commit intomainfrom
02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Feb 11, 2026

related oxc-project/oxc-vscode#25

This PR updates the language server formatting pipeline so that a document’s LanguageId (from textDocument/didOpen) is propagated down into tool formatting hooks, enabling formatters to make decisions even when file extensions are missing.

Copy link
Member Author

Sysix commented Feb 11, 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 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.

@github-actions github-actions bot added A-cli Area - CLI A-editor Area - Editor and Language Server A-formatter Area - Formatter labels Feb 11, 2026
@Sysix Sysix changed the title refacor(oxfmt/lsp) pass LanguageId to run_format refactor(oxfmt/lsp): pass LanguageId to run_format Feb 11, 2026
@github-actions github-actions bot added the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Feb 11, 2026
@codspeed-hq
Copy link

codspeed-hq bot commented Feb 11, 2026

Merging this PR will not alter performance

✅ 47 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ (5d5aa58) with 02-11-chore_lsp_introduce_languageid_enum (ec95217)2

Open in CodSpeed

Footnotes

  1. 3 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on 02-11-chore_lsp_introduce_languageid_enum (ec95217) during the generation of this report, so 0d3bc77 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Sysix Sysix force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from 66bb3a7 to 4c9346f Compare February 12, 2026 22:05
@Sysix Sysix force-pushed the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch 2 times, most recently from a9b1aca to 10b8c79 Compare February 12, 2026 22:44
@Sysix Sysix force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from 598a1c1 to a67ac66 Compare February 12, 2026 22:44
@Sysix Sysix requested a review from Copilot February 12, 2026 22:48
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 updates the language server formatting pipeline so that a document’s LanguageId (from textDocument/didOpen) is propagated down into tool formatting hooks, enabling formatters to make decisions even when file extensions are missing.

Changes:

  • Extend the Tool::run_format hook to accept &LanguageId.
  • Thread LanguageId through Backend::formattingWorkspaceWorker::format_fileTool::run_format.
  • Update the oxfmt LSP formatter tool implementation to match the new trait signature.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
crates/oxc_language_server/src/tool.rs Extends Tool::run_format to accept a LanguageId parameter.
crates/oxc_language_server/src/worker.rs Updates format_file to forward LanguageId into run_format.
crates/oxc_language_server/src/backend.rs Fetches (LanguageId, content) from the in-memory FS and passes both into format_file.
apps/oxfmt/src/lsp/server_formatter.rs Adjusts ServerFormatter’s run_format signature to match the updated trait.

@Sysix Sysix force-pushed the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch from 10b8c79 to bfe263c Compare February 12, 2026 23:24
@Sysix Sysix force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from a67ac66 to 76c4be8 Compare February 12, 2026 23:24
@Sysix Sysix marked this pull request as ready for review February 12, 2026 23:28
@Sysix Sysix requested a review from camc314 as a code owner February 12, 2026 23:28
@Sysix Sysix force-pushed the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch from bfe263c to e4fa5ef Compare February 14, 2026 13:16
@Sysix Sysix force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from 76c4be8 to 23751ee Compare February 14, 2026 13:16
@Sysix Sysix force-pushed the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch from e4fa5ef to 001e002 Compare February 14, 2026 16:23
@Sysix Sysix force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from 23751ee to 7ac6368 Compare February 14, 2026 16:23
@Sysix Sysix force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from 7ac6368 to ec95217 Compare February 16, 2026 18:37
@Sysix Sysix force-pushed the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch from 001e002 to 5d5aa58 Compare February 16, 2026 18:37
@graphite-app graphite-app bot added the 0-merge Merge with Graphite Merge Queue label Feb 17, 2026
@graphite-app
Copy link
Contributor

graphite-app bot commented Feb 17, 2026

Merge activity

related oxc-project/oxc-vscode#25

> This PR updates the language server formatting pipeline so that a document’s `LanguageId` (from `textDocument/didOpen`) is propagated down into tool formatting hooks, enabling formatters to make decisions even when file extensions are missing.
@graphite-app graphite-app bot force-pushed the 02-11-chore_lsp_introduce_languageid_enum branch from ec95217 to 88ec03e Compare February 17, 2026 01:49
@graphite-app graphite-app bot force-pushed the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch from 5d5aa58 to 0eb9a2d Compare February 17, 2026 01:50
Base automatically changed from 02-11-chore_lsp_introduce_languageid_enum to main February 17, 2026 02:12
@graphite-app graphite-app bot merged commit 0eb9a2d into main Feb 17, 2026
22 checks passed
@graphite-app graphite-app bot deleted the 02-11-refacor_oxfmt_lsp_pass_languageid_to_run_format_ branch February 17, 2026 02:13
@graphite-app graphite-app bot removed 0-merge Merge with Graphite Merge Queue labels Feb 17, 2026
OskarLebuda pushed a commit to OskarLebuda/oxc that referenced this pull request Feb 17, 2026
…9286)

related oxc-project/oxc-vscode#25

> This PR updates the language server formatting pipeline so that a document’s `LanguageId` (from `textDocument/didOpen`) is propagated down into tool formatting hooks, enabling formatters to make decisions even when file extensions are missing.
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 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

Comments