Skip to content

Conversation

@Sysix
Copy link
Member

@Sysix Sysix commented Apr 30, 2025

The respect now each workspace-folder as an own workspace and lint like the user will expect it.

@github-actions github-actions bot added the A-editor Area - Editor and Language Server label Apr 30, 2025
Copy link
Member Author

Sysix commented Apr 30, 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-test Category - Testing. Code is missing test cases, or a PR is adding them label Apr 30, 2025
@codspeed-hq
Copy link

codspeed-hq bot commented Apr 30, 2025

CodSpeed Instrumentation Performance Report

Merging #10730 will not alter performance

Comparing 04-30-test_language_server_refactor_tester_to_use_workspaceworker (9ebf3d4) with main (5a709ad)

Summary

✅ 36 untouched benchmarks

@Sysix Sysix force-pushed the 04-30-test_language_server_refactor_tester_to_use_workspaceworker branch 3 times, most recently from 8ded402 to 8e91c38 Compare April 30, 2025 19:16
@Sysix Sysix marked this pull request as ready for review April 30, 2025 19:24
@Sysix Sysix force-pushed the 04-30-test_language_server_refactor_tester_to_use_workspaceworker branch from 8e91c38 to 4cd629a Compare April 30, 2025 22:24
@graphite-app graphite-app bot changed the base branch from 04-30-test_language_server_add_test_for_init_nested_configs_ to graphite-base/10730 April 30, 2025 22:27
@Sysix
Copy link
Member Author

Sysix commented Apr 30, 2025

Just aligned the filenames to the fixture's directory.
Friendlier to look up snapshots

@Sysix Sysix added the 0-merge Merge with Graphite Merge Queue label Apr 30, 2025
Copy link
Member Author

Sysix commented Apr 30, 2025

Merge activity

  • Apr 30, 6:27 PM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Apr 30, 6:27 PM EDT: Sysix added this pull request to the Graphite merge queue.
  • Apr 30, 10:32 PM UTC: The Graphite merge queue couldn't merge this PR because it had conflicts with the trunk branch.
  • Apr 30, 8:38 PM EDT: The merge label '0-merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Apr 30, 8:38 PM EDT: Sysix added this pull request to the Graphite merge queue.
  • Apr 30, 8:42 PM EDT: Merged by the Graphite merge queue.

@graphite-app graphite-app bot changed the base branch from graphite-base/10730 to main April 30, 2025 22:31
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Apr 30, 2025
@Sysix Sysix force-pushed the 04-30-test_language_server_refactor_tester_to_use_workspaceworker branch from 4cd629a to 6ddfc78 Compare May 1, 2025 00:12
@coderabbitai
Copy link

coderabbitai bot commented May 1, 2025

Walkthrough

This set of changes refactors the testing infrastructure and configuration handling in the oxc_language_server crate. Several new linter configuration files (.oxlintrc.json) are introduced in different fixture directories, each specifying distinct linting rules such as enabling the no-console rule, disabling correctness checks, or turning off unused variables warnings. A new JavaScript fixture file is added for testing purposes. The ServerLinter::new constructor and the tester module guarded by #[cfg(test)] are removed from the linter crate, simplifying test-related code. The Tester struct is reworked to remove direct references to ServerLinter and snapshot suffixes, instead using relative directory paths and optional configuration options, and it now performs asynchronous linting via a new WorkspaceWorker. Test code is simplified by eliminating manual linter and configuration setup. Additionally, import statements in the main module are reorganized, and a test module named tester is conditionally added. The test import path in worker.rs is also updated. These changes collectively streamline and modernize the testing and linting setup.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6ddfc78 and 9ebf3d4.

⛔ Files ignored due to path filters (15)
  • crates/oxc_language_server/src/linter/snapshots/fixtures_linter_cross_module_nested_config_dep-a.ts.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/linter/snapshots/fixtures_linter_hello_world.js@no_errors.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/fixtures_linter_cross_module_nested_config@folder_folder-dep-a.ts.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/fixtures_linter_deny_no_console@hello_world.js.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/fixtures_linter_no_errors@hello_world.js.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
📒 Files selected for processing (9)
  • crates/oxc_language_server/fixtures/linter/deny_no_console/.oxlintrc.json (1 hunks)
  • crates/oxc_language_server/fixtures/linter/no_errors/.oxlintrc.json (1 hunks)
  • crates/oxc_language_server/fixtures/linter/no_errors/hello_world.js (1 hunks)
  • crates/oxc_language_server/fixtures/linter/regexp_feature/.oxlintrc.json (1 hunks)
  • crates/oxc_language_server/src/linter/mod.rs (0 hunks)
  • crates/oxc_language_server/src/linter/server_linter.rs (1 hunks)
  • crates/oxc_language_server/src/main.rs (1 hunks)
  • crates/oxc_language_server/src/tester.rs (2 hunks)
  • crates/oxc_language_server/src/worker.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • crates/oxc_language_server/src/linter/mod.rs
🚧 Files skipped from review as they are similar to previous changes (6)
  • crates/oxc_language_server/fixtures/linter/no_errors/.oxlintrc.json
  • crates/oxc_language_server/src/worker.rs
  • crates/oxc_language_server/fixtures/linter/no_errors/hello_world.js
  • crates/oxc_language_server/fixtures/linter/deny_no_console/.oxlintrc.json
  • crates/oxc_language_server/fixtures/linter/regexp_feature/.oxlintrc.json
  • crates/oxc_language_server/src/main.rs
🧰 Additional context used
🧬 Code Graph Analysis (1)
crates/oxc_language_server/src/tester.rs (1)
crates/oxc_language_server/src/worker.rs (1)
  • new (40-56)
⏰ Context from checks skipped due to timeout of 90000ms (9)
  • GitHub Check: Clippy
  • GitHub Check: Test (ubuntu-latest)
  • GitHub Check: Test (macos-latest)
  • GitHub Check: Benchmark (semantic)
  • GitHub Check: Benchmark (formatter)
  • GitHub Check: Benchmark (codegen)
  • GitHub Check: Benchmark (minifier)
  • GitHub Check: Benchmark (transformer)
  • GitHub Check: Build Linter Benchmark
🔇 Additional comments (18)
crates/oxc_language_server/src/linter/server_linter.rs (12)

31-31: Import updated to reference the new tester module location

The import has been updated to use crate::tester::Tester, reflecting the reorganization of the testing infrastructure. This is part of the refactoring to centralize test utilities in a dedicated module.


35-36: Test refactored to use the new Tester API

The test now uses the new Tester API with explicit fixture directory path and None for optional parameters, which improves code clarity and maintainability.


41-42: Test updated to use dedicated fixture with specific linting rules

Test now uses the "deny_no_console" fixture directory, which contains configuration to enable the no-console rule specifically for this test case.


48-48: Test for issue 9958 updated to use the new Tester API

The test has been updated to use the new Tester API with a dedicated fixture directory for the specific issue.


54-55: Test for regular expressions updated to use the new Tester API

Test now correctly specifies the fixture directory path and uses the new API with None for optional parameters.


60-63: Framework tests refactored to use separate fixture directories

Each framework test now uses its own dedicated fixture directory, which better isolates testing environments and makes the test structure more modular.


65-65: TODO comment updated with more context

The TODO comment now clarifies that the Tester should be updated to work only with URIs without accessing the file system directly, which is a valuable improvement suggestion.


70-71: Invalid syntax test updated to use the new Tester API

Test for invalid syntax now uses a dedicated fixture directory with the new Tester API pattern.


76-77: Cross module debugger test updated to use the new Tester API

Cross module test has been updated to use the new test structure with explicit fixture directory.


82-82: Cross module no-cycle test updated to use the new Tester API

Test has been correctly updated to use the new Tester pattern with an explicit fixture path.


87-90: Nested config test expanded with additional test cases

Test now covers both the root level and nested folder configurations, providing better coverage of the configuration inheritance behavior.


95-96: Extended config test updated to use the new Tester API

Test for extended configurations has been updated to use the new Tester API with the appropriate fixture path.

crates/oxc_language_server/src/tester.rs (6)

8-10: Imports updated to reflect new dependencies

Imports have been updated to use the WorkspaceWorker and Options from the crate root, and DiagnosticReport is now imported using super to reflect the module structure changes.


87-88: Tester struct refactored with clearer fields

The Tester struct now uses a more explicit approach with relative_root_dir to specify the fixture location and optional options parameter, improving clarity and flexibility.


92-94: Constructor simplified with more explicit parameters

The constructor now takes a clear relative_root_dir path and optional options, which makes test setup more straightforward.


96-102: New helper method to create WorkspaceWorker

The create_workspace_worker method encapsulates the logic for creating a WorkspaceWorker instance with the appropriate URI and options, which follows good separation of concerns.


121-121: Improved snapshot naming using relative directory path

Snapshot naming now uses the relative root directory with normalized path separators, which makes test snapshots more organized and maintainable.


125-128: Enhanced snapshot file path handling

Input file path for snapshots is now set from the URI's file path when available, and the snapshot suffix uses the normalized relative file path, improving snapshot organization.

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

♻️ Duplicate comments (1)
crates/oxc_language_server/src/linter/server_linter.rs (1)

31-31: Matches visibility issue flagged in main.rs

use crate::tester::Tester; relies on the tester module being public.
Ensure the fix proposed in main.rs is applied; otherwise this import will not resolve.

🧹 Nitpick comments (2)
crates/oxc_language_server/src/main.rs (1)

19-19: Remove stray “// #” placeholder comment

The comment does not convey any useful context and clutters the import section.
Consider deleting it to keep the header clean.

-// #
crates/oxc_language_server/src/tester.rs (1)

96-103: Prefer PathBuf::join over manual format! for cross-platform safety

Using string concatenation risks introducing mixed separators on Windows vs Unix.
Since you already convert the root directory to a PathBuf, join the file component there.

-        let uri = get_file_uri(&format!("{}/{}", self.relative_root_dir, relative_file_path));
+        let uri = get_file_uri(
+            &std::path::Path::new(self.relative_root_dir)
+                .join(relative_file_path)
+                .to_string_lossy(),
+        );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5a709ad and 6ddfc78.

⛔ Files ignored due to path filters (15)
  • crates/oxc_language_server/src/linter/snapshots/fixtures_linter_cross_module_nested_config_dep-a.ts.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/linter/snapshots/fixtures_linter_hello_world.js@no_errors.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/fixtures_linter_cross_module_nested_config@folder_folder-dep-a.ts.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/fixtures_linter_deny_no_console@hello_world.js.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/fixtures_linter_no_errors@hello_world.js.snap is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
  • crates/oxc_language_server/src/snapshots/[email protected] is excluded by !**/*.snap
📒 Files selected for processing (9)
  • crates/oxc_language_server/fixtures/linter/deny_no_console/.oxlintrc.json (1 hunks)
  • crates/oxc_language_server/fixtures/linter/no_errors/.oxlintrc.json (1 hunks)
  • crates/oxc_language_server/fixtures/linter/no_errors/hello_world.js (1 hunks)
  • crates/oxc_language_server/fixtures/linter/regexp_feature/.oxlintrc.json (1 hunks)
  • crates/oxc_language_server/src/linter/mod.rs (0 hunks)
  • crates/oxc_language_server/src/linter/server_linter.rs (1 hunks)
  • crates/oxc_language_server/src/main.rs (1 hunks)
  • crates/oxc_language_server/src/tester.rs (2 hunks)
  • crates/oxc_language_server/src/worker.rs (1 hunks)
💤 Files with no reviewable changes (1)
  • crates/oxc_language_server/src/linter/mod.rs
🧰 Additional context used
🧬 Code Graph Analysis (1)
crates/oxc_language_server/src/worker.rs (1)
crates/oxc_language_server/src/tester.rs (1)
  • get_file_uri (13-17)
⏰ Context from checks skipped due to timeout of 90000ms (14)
  • GitHub Check: Test (ubuntu-latest)
  • GitHub Check: Test wasm32-wasip1-threads
  • GitHub Check: Test (macos-latest)
  • GitHub Check: Clippy
  • GitHub Check: Benchmark (semantic)
  • GitHub Check: Benchmark (formatter)
  • GitHub Check: Test
  • GitHub Check: Benchmark (minifier)
  • GitHub Check: Benchmark (transformer)
  • GitHub Check: Benchmark (isolated_declarations)
  • GitHub Check: Benchmark (codegen)
  • GitHub Check: Benchmark (parser)
  • GitHub Check: Benchmark (lexer)
  • GitHub Check: Build Linter Benchmark
🔇 Additional comments (5)
crates/oxc_language_server/src/worker.rs (1)

462-462: Update import path for get_file_uri
The test module now correctly imports get_file_uri from the relocated crate::tester module, reflecting the move of the testing utilities out of linter. Make sure the tester module is exposed (e.g., via mod tester; under #[cfg(test)]) so this path resolves.

crates/oxc_language_server/fixtures/linter/no_errors/.oxlintrc.json (1)

1-5: Add .oxlintrc.json disabling correctness rules
This fixture JSON correctly disables the "correctness" category for the no_errors scenario. Structure and syntax are valid and align with the intended test configuration.

crates/oxc_language_server/fixtures/linter/deny_no_console/.oxlintrc.json (1)

1-5: Add .oxlintrc.json enforcing no-console rule
The configuration enables the no-console rule with severity "error", which will properly catch console usage in tests. The JSON is well-formed.

crates/oxc_language_server/fixtures/linter/no_errors/hello_world.js (1)

1-1: Introduce simple JavaScript fixture
A minimal console.log("Hello, world!"); file is appropriate for the no_errors fixture. It fulfills the test requirement under the disabled correctness rules. Optionally, ensure a trailing newline if your linter or formatter enforces it.

crates/oxc_language_server/fixtures/linter/regexp_feature/.oxlintrc.json (1)

3-5: Enable no-unused-vars rule override
The update adds "no-unused-vars": "off" alongside existing regex lint rules. This ensures unused-variable warnings are suppressed in the regex feature tests. JSON formatting is correct.

@Sysix Sysix added the 0-merge Merge with Graphite Merge Queue label May 1, 2025
The respect now each workspace-folder as an own workspace and lint like the user will expect it.
@graphite-app graphite-app bot force-pushed the 04-30-test_language_server_refactor_tester_to_use_workspaceworker branch from 6ddfc78 to 9ebf3d4 Compare May 1, 2025 00:38
@graphite-app graphite-app bot merged commit 9ebf3d4 into main May 1, 2025
27 checks passed
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label May 1, 2025
@graphite-app graphite-app bot deleted the 04-30-test_language_server_refactor_tester_to_use_workspaceworker branch May 1, 2025 00:42
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-test Category - Testing. Code is missing test cases, or a PR is adding them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants