perf(linter): Implement streaming diagnostics for tsgolint instead of waiting for output to finish#13098
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. |
apps/oxlint/src/tsgolint.rs:126.b6213e6 to
951a70b
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR implements streaming diagnostics for the tsgolint integration, allowing users to see diagnostics as they are emitted rather than waiting for the entire process to complete. This addresses the TODO comment and improves responsiveness for large codebases.
- Replaces blocking
wait_with_output()with streaming stdout reading in a separate thread - Implements incremental message parsing using existing binary protocol parser
- Maintains backward compatibility while providing faster user feedback
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Merge activity
|
… waiting for output to finish (#13098) This PR resolves the TODO comment at line 126 in `apps/oxlint/src/tsgolint.rs` by implementing streaming diagnostics for tsgolint instead of waiting for the entire process to complete. ## Problem Previously, the tsgolint integration would: 1. Spawn the tsgolint process 2. Wait for the entire process to complete using `child.wait_with_output()` 3. Parse all output at once 4. Send all diagnostics to the diagnostic service This approach meant users had to wait for tsgolint to process all files before seeing any feedback, which could be slow for large codebases. ## Solution The implementation now streams diagnostics as they are emitted: 1. **Streaming stdout reader**: Reads from the tsgolint process stdout in 4KB chunks as data becomes available 2. **Incremental message parsing**: Uses the existing binary protocol parser to process complete messages as they arrive in the buffer 3. **Immediate diagnostic sending**: Sends diagnostics to the diagnostic service via the `error_sender` channel as soon as they are parsed 4. **Proper buffering**: Keeps incomplete messages in the buffer for the next iteration to handle message boundaries correctly ## Key Changes - Replaced `child.wait_with_output()` with streaming stdout reading in a separate thread - Added incremental buffer processing that identifies complete messages using the binary protocol format - Maintained backward compatibility - all existing tests pass - Removed unused `parse_tsgolint_output()` function since parsing now happens incrementally - Added proper error handling for both process exit status and stdout processing ## Benefits - **Faster feedback**: Users see diagnostics as soon as tsgolint emits them, rather than waiting for completion - **Better user experience**: Especially beneficial for large codebases where tsgolint processing takes significant time - **Same reliability**: All existing functionality and error handling is preserved - **No breaking changes**: The API and behavior remain the same from the user's perspective The streaming implementation provides a more responsive experience while maintaining full compatibility with existing tsgolint integration. <!-- START COPILOT CODING AGENT TIPS --> --- 💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click [here](https://survey.alchemer.com/s3/8343779/Copilot-Coding-agent) to start the survey.
951a70b to
3bfb235
Compare
This PR resolves the TODO comment at line 126 in
apps/oxlint/src/tsgolint.rsby implementing streaming diagnostics for tsgolint instead of waiting for the entire process to complete.Problem
Previously, the tsgolint integration would:
child.wait_with_output()This approach meant users had to wait for tsgolint to process all files before seeing any feedback, which could be slow for large codebases.
Solution
The implementation now streams diagnostics as they are emitted:
error_senderchannel as soon as they are parsedKey Changes
child.wait_with_output()with streaming stdout reading in a separate threadparse_tsgolint_output()function since parsing now happens incrementallyBenefits
The streaming implementation provides a more responsive experience while maintaining full compatibility with existing tsgolint integration.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.