Skip to content

Comments

refactor(oxlint/lsp): use fs as param in TsGoLintState, instead of source text#16667

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-09-refactor_linter_use_file_system_as_param_instead_of_source_text
Dec 13, 2025
Merged

refactor(oxlint/lsp): use fs as param in TsGoLintState, instead of source text#16667
graphite-app[bot] merged 1 commit intomainfrom
12-09-refactor_linter_use_file_system_as_param_instead_of_source_text

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Dec 9, 2025

In the future, the language server wants to lint multiple files at the same time.
Refactored the code to accept the RuntimeFS (like the CLI tool) for reading the source text.

@github-actions github-actions bot added A-linter Area - Linter A-editor Area - Editor and Language Server labels Dec 9, 2025
Copy link
Member Author

Sysix commented Dec 9, 2025


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 the C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior label Dec 9, 2025
@Sysix Sysix changed the title refactor(oxlint/linter): use fs as param in TsGoLintState, instead of source text refactor(oxlint/lsp): use fs as param in TsGoLintState, instead of source text Dec 9, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Dec 9, 2025

CodSpeed Performance Report

Merging #16667 will not alter performance

Comparing 12-09-refactor_linter_use_file_system_as_param_instead_of_source_text (dd22b62) with main (0740016)1

Summary

✅ 4 untouched
⏩ 41 skipped2

Footnotes

  1. No successful run was found on 12-09-refactor_oxlint_lsp_isolatedlinthandlerfilesystem_is_now_a_fxhasmap_ (0e13f34) during the generation of this report, so main (0740016) was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

  2. 41 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.

@camc314 camc314 self-assigned this Dec 10, 2025
@Sysix Sysix force-pushed the 12-09-refactor_linter_use_file_system_as_param_instead_of_source_text branch from 17dd958 to aee5bc6 Compare December 10, 2025 21:44
@Sysix Sysix force-pushed the 12-09-refactor_oxlint_lsp_isolatedlinthandlerfilesystem_is_now_a_fxhasmap_ branch from 72cc184 to 4e370b1 Compare December 10, 2025 21:44
@Sysix Sysix requested a review from Copilot December 10, 2025 21:47
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 TsGoLintState::lint_source method and its caller LintRunner::run_source to accept a file system parameter instead of source text. This change aligns the API design by delegating file reading responsibility to the function itself rather than requiring callers to provide the source text.

Key changes:

  • Modified TsGoLintState::lint_source to accept file_system parameter instead of source_text parameter
  • Updated LintRunner::run_source signature to remove source_text parameter
  • Updated IsolatedLintHandler to call run_source without passing source text

Reviewed changes

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

File Description
crates/oxc_linter/src/tsgolint.rs Refactored lint_source to accept file system parameter and read file internally using arena allocator, then convert to owned String
crates/oxc_linter/src/lint_runner.rs Removed source_text parameter from run_source signature and updated call to lint_source
crates/oxc_language_server/src/linter/isolated_lint_handler.rs Updated caller to remove source_text argument from run_source call

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

@Sysix Sysix force-pushed the 12-09-refactor_oxlint_lsp_isolatedlinthandlerfilesystem_is_now_a_fxhasmap_ branch from 4e370b1 to 0e13f34 Compare December 10, 2025 22:46
@Sysix Sysix force-pushed the 12-09-refactor_linter_use_file_system_as_param_instead_of_source_text branch from aee5bc6 to dd22b62 Compare December 10, 2025 22:46
@Sysix Sysix marked this pull request as ready for review December 12, 2025 18:41
@Sysix Sysix requested a review from camc314 as a code owner December 12, 2025 18:41
Copy link

@charliecreates charliecreates bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The refactor is directionally good, but TsGoLintState::lint_source now does extra allocations (Allocator + to_string() + cloning) and loses useful error context by not including the underlying read error. Also, the pipeline likely reads the same file twice (regular + type-aware lint), which can become a real performance issue when scaling to multi-file linting.

Summary of changes

Summary of changes

  • Refactored the language-server lint flow to pass a RuntimeFileSystem into linting instead of passing source_text through the API.
  • Updated LintRunner::run_source to remove the source_text: String parameter and forward the file_system to the type-aware linter.
  • Updated TsGoLintState::lint_source to read the source from file_system via read_to_arena_str (using oxc_allocator::Allocator) and to use an owned String (source_text_owned) inside the spawned thread.

@charliecreates charliecreates bot removed the request for review from CharlieHelps December 12, 2025 18:49
@graphite-app graphite-app bot changed the base branch from 12-09-refactor_oxlint_lsp_isolatedlinthandlerfilesystem_is_now_a_fxhasmap_ to graphite-base/16667 December 13, 2025 12:33
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 13, 2025
Copy link
Contributor

camc314 commented Dec 13, 2025

Merge activity

@graphite-app graphite-app bot changed the base branch from graphite-base/16667 to main December 13, 2025 12:38
…urce text (#16667)

In the future, the language server wants to lint multiple files at the same time.
Refactored the code to accept the RuntimeFS (like the CLI tool) for reading the source text.
@graphite-app graphite-app bot force-pushed the 12-09-refactor_linter_use_file_system_as_param_instead_of_source_text branch from dd22b62 to 73da317 Compare December 13, 2025 12:39
@graphite-app graphite-app bot merged commit 73da317 into main Dec 13, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 12-09-refactor_linter_use_file_system_as_param_instead_of_source_text branch December 13, 2025 12:43
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 13, 2025
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 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.

2 participants