Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Dec 2, 2025

Before:
Linted all files which are not ignored & supported
After:
Lint all files which are got open inside the editor

@github-actions github-actions bot added A-editor Area - Editor and Language Server C-bug Category - Bug labels Dec 2, 2025
Copy link
Member Author

Sysix commented Dec 2, 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.

@Sysix Sysix requested a review from Copilot December 2, 2025 20:13
Copilot finished reviewing on behalf of Sysix December 2, 2025 20:15
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 modifies the language server to revalidate only files currently open in the editor when internal tool restarts occur (such as configuration changes or config file updates), rather than revalidating all files that have previously been linted.

Key changes:

  • Thread LSPFileSystem parameter through tool restart methods to access currently open files
  • Replace cached diagnostics file list with file system keys for revalidation
  • Remove file system entry removal on file save

Reviewed changes

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

Show a summary per file
File Description
crates/oxc_language_server/src/worker.rs Added file_system parameter to did_change_watched_files and did_change_configuration methods; updated test calls to pass LSPFileSystem::default()
crates/oxc_language_server/src/tool.rs Added file_system: &LSPFileSystem parameter to handle_configuration_change and handle_watched_file_change trait methods
crates/oxc_language_server/src/tests.rs Updated FakeTool implementation to accept new file_system parameter
crates/oxc_language_server/src/linter/tester.rs Updated test helper to pass LSPFileSystem::default() to configuration change method
crates/oxc_language_server/src/linter/server_linter.rs Changed revalidation to use file_system.keys() instead of get_cached_files_of_diagnostics() to only revalidate open files
crates/oxc_language_server/src/formatter/tester.rs Updated test helper to pass LSPFileSystem::default() to configuration change method
crates/oxc_language_server/src/formatter/server_formatter.rs Added unused _file_system parameter to trait method implementations
crates/oxc_language_server/src/backend.rs Passed file system reference to worker methods; removed file system entry removal on save

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

@Sysix Sysix marked this pull request as ready for review December 2, 2025 20:18
@Sysix Sysix requested a review from camc314 as a code owner December 2, 2025 20:18
@Sysix Sysix marked this pull request as draft December 2, 2025 20:27
@Sysix Sysix force-pushed the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch 2 times, most recently from 25cdca9 to b2cfd78 Compare December 2, 2025 21:06
@Sysix Sysix changed the base branch from main to graphite-base/16407 December 3, 2025 19:27
@Sysix Sysix force-pushed the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch from b2cfd78 to a377175 Compare December 3, 2025 19:27
@Sysix Sysix changed the base branch from graphite-base/16407 to 12-03-test_lsp_add_tests_for_diagnostics_on_didopen_didchange_didsave_ December 3, 2025 19:27
@Sysix Sysix requested a review from Copilot December 3, 2025 19:28
Copilot finished reviewing on behalf of Sysix December 3, 2025 19:32
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (1)

crates/oxc_language_server/src/backend.rs:511

  • The removal of self.file_system.write().await.remove(uri) from this method can cause stale in-memory content to be used during tool restarts.

If the server's save capability doesn't include includeText: true (meaning params.text will be None), the file is saved to disk but the old content remains in the in-memory file_system. When a tool restart occurs later, the code in worker.rs:312-320 will use this stale in-memory content instead of reading the saved version from disk.

The original behavior of removing the file from the in-memory file system on save ensures that subsequent operations (like tool restarts) will read the up-to-date content from disk. Unless there's a guarantee that params.text is always provided, this removal should be preserved.

        let Some(worker) = workers.iter().find(|worker| worker.is_responsible_for_uri(uri)) else {
            return;
        };

        if let Some(diagnostics) = worker.run_diagnostic_on_save(uri, params.text.as_deref()).await
        {
            self.client.publish_diagnostics(uri.clone(), diagnostics, None).await;
        }
    }

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

@Sysix Sysix force-pushed the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch from a377175 to 5e95306 Compare December 3, 2025 19:40
@Sysix Sysix marked this pull request as ready for review December 3, 2025 19:40
@Sysix Sysix force-pushed the 12-03-test_lsp_add_tests_for_diagnostics_on_didopen_didchange_didsave_ branch from 7fd08de to f6a8a66 Compare December 3, 2025 21:49
@Sysix Sysix force-pushed the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch from 5e95306 to ccc477c Compare December 3, 2025 21:49
@graphite-app graphite-app bot changed the base branch from 12-03-test_lsp_add_tests_for_diagnostics_on_didopen_didchange_didsave_ to graphite-base/16407 December 3, 2025 22:27
@camc314 camc314 added the 0-merge Merge with Graphite Merge Queue label Dec 3, 2025
@camc314 camc314 self-assigned this Dec 3, 2025
Copy link
Contributor

camc314 commented Dec 3, 2025

Merge activity

  • Dec 3, 10:28 PM UTC: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 3, 10:33 PM UTC: Graphite rebased this pull request, because this pull request is set to merge when ready.
  • Dec 3, 10:38 PM UTC: camc314 added this pull request to the Graphite merge queue.
  • Dec 3, 10:44 PM UTC: Merged by the Graphite merge queue.

@camc314 camc314 force-pushed the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch from ccc477c to c5de638 Compare December 3, 2025 22:32
@camc314 camc314 force-pushed the graphite-base/16407 branch from f6a8a66 to 5dfde85 Compare December 3, 2025 22:32
@graphite-app graphite-app bot changed the base branch from graphite-base/16407 to main December 3, 2025 22:33
…16407)

Before:
Linted all files which are not ignored & supported
After:
Lint all files which are got open inside the editor
@graphite-app graphite-app bot force-pushed the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch from c5de638 to 0c14531 Compare December 3, 2025 22:39
@graphite-app graphite-app bot merged commit 0c14531 into main Dec 3, 2025
21 checks passed
@graphite-app graphite-app bot deleted the 12-02-fix_oxlint_lsp_revalidate_all_known_files_after_internal_restart branch December 3, 2025 22:44
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Dec 3, 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 C-bug Category - Bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants