test(lsp): add tests for diagnostics on didOpen|didChange|didSave#16466
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via the merge queue:
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. |
There was a problem hiding this comment.
Pull request overview
This PR adds comprehensive test coverage for diagnostic functionality in the Language Server Protocol (LSP) implementation, specifically testing diagnostics on didOpen, didChange, and didSave events. The changes include both unit tests for the worker module and integration tests for the backend, along with a bug fix in the did_save handler.
Key Changes
- Added unit tests for
run_diagnostic,run_diagnostic_on_change, andrun_diagnostic_on_savemethods in the worker module - Added integration tests verifying diagnostic publishing on
didOpen,didChange, anddidSaveLSP events - Fixed bug in
did_savehandler to pass actual text content instead ofNonewhen available
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 three unit tests (test_run_diagnostic, test_run_diagnostic_on_change, test_run_diagnostic_on_save) that verify the diagnostic collection methods work correctly with and without content |
| crates/oxc_language_server/src/tests.rs | Added three FakeTool methods for diagnostic testing and three integration tests (test_diagnostic_on_open, test_diagnostic_on_change, test_no_diagnostic_on_save) that verify end-to-end diagnostic publishing behavior |
| crates/oxc_language_server/src/backend.rs | Fixed did_save handler to pass params.text.as_deref() instead of None, ensuring saved file content is available for diagnostics |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ee2e7c4 to
b920607
Compare
b920607 to
7fd08de
Compare
7fd08de to
f6a8a66
Compare
Merge activity
|
…16466) > This PR adds comprehensive test coverage for diagnostic functionality in the Language Server Protocol (LSP) implementation, specifically testing diagnostics on didOpen, didChange, and didSave events. The changes include both unit tests for the worker module and integration tests for the backend > along with a bug fix in the did_save handler. This is not really a bug fix, just a little refactoring to pass the tests. In general, I do not expect that `params.text (didSave)` has changed from `didChange` content
f6a8a66 to
5dfde85
Compare
…xc-project#16466) > This PR adds comprehensive test coverage for diagnostic functionality in the Language Server Protocol (LSP) implementation, specifically testing diagnostics on didOpen, didChange, and didSave events. The changes include both unit tests for the worker module and integration tests for the backend > along with a bug fix in the did_save handler. This is not really a bug fix, just a little refactoring to pass the tests. In general, I do not expect that `params.text (didSave)` has changed from `didChange` content

This is not really a bug fix, just a little refactoring to pass the tests.
In general, I do not expect that
params.text (didSave)has changed fromdidChangecontent