Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Oct 20, 2025

No description provided.

Copy link
Member Author

Sysix commented Oct 20, 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 changed the base branch from 10-18-feat_language_server_able_to_set_off_for_run_configuration to graphite-base/14830 October 20, 2025 20:21
@Sysix Sysix requested a review from Copilot October 20, 2025 20:23
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 diagnostic management in the language server by moving the Diagnostics map from ServerLinter to WorkspaceWorker. This change centralizes diagnostic storage at the workspace level and removes async requirements from several diagnostic-related methods.

Key Changes:

  • Introduced WorkerDiagnostics struct to manage diagnostic maps at the workspace level
  • Removed ServerLinterDiagnostics from ServerLinter and associated diagnostic management methods
  • Converted async diagnostic methods to synchronous ones where possible

Reviewed Changes

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

File Description
crates/oxc_language_server/src/worker.rs Added WorkerDiagnostics struct and integrated it into WorkspaceWorker; moved diagnostic management methods from ServerLinter; converted several async methods to sync
crates/oxc_language_server/src/linter/server_linter.rs Removed ServerLinterDiagnostics struct and its methods; updated run_single and revalidate_diagnostics to accept WorkerDiagnostics parameter; moved test case to worker.rs
crates/oxc_language_server/src/backend.rs Updated method calls to use synchronous versions of get_clear_diagnostics and remove_diagnostics

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.


let mut files = Vec::with_capacity(isolated_files.len() + tsgo_files.len());
files.extend(isolated_files);
files.extend(tsgo_files);
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The dedup() method only removes consecutive duplicates from a sorted vector. If a file exists in both isolated_files and tsgo_files but they are not adjacent after extending, duplicates will remain. Consider sorting before calling dedup(), or use a HashSet to ensure all duplicates are removed: files.sort(); files.dedup();

Suggested change
files.extend(tsgo_files);
files.extend(tsgo_files);
files.sort();

Copilot uses AI. Check for mistakes.
if let Some(linter_files) = linter_files {
diagnostics = Some(self.revalidate_diagnostics(linter_files).await);
}
diagnostics = Some(self.revalidate_diagnostics(linter_files).await);
Copy link

Copilot AI Oct 20, 2025

Choose a reason for hiding this comment

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

The conditional check if let Some(linter_files) = linter_files was removed, but linter_files is now a Vec<Uri> that is always returned (never Option). This changes the behavior: when the linter was previously None, no revalidation occurred. Now get_cached_files_of_diagnostics() returns an empty vector, and revalidate_diagnostics is called with that empty vector. While functionally similar, this adds an unnecessary function call. Consider adding back a check: if !linter_files.is_empty() { diagnostics = Some(self.revalidate_diagnostics(linter_files).await); }

Suggested change
diagnostics = Some(self.revalidate_diagnostics(linter_files).await);
if !linter_files.is_empty() {
diagnostics = Some(self.revalidate_diagnostics(linter_files).await);
}

Copilot uses AI. Check for mistakes.
@Sysix
Copy link
Member Author

Sysix commented Oct 21, 2025

This is the wrong approach, you can open files while no new diagnostics are added/removed.

@Sysix Sysix closed this Oct 21, 2025
@Sysix Sysix deleted the 10-20-refactor_language_server_move_diagnostics-map_to_workspaceworker_ branch November 6, 2025 21:26
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