fix: improve diagnostic display for syntax errors and large code ranges#506
fix: improve diagnostic display for syntax errors and large code ranges#506
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the user experience for diagnostic messages by improving how syntax errors and large code ranges are displayed. The changes aim to provide clearer, more concise, and actionable feedback, aligning the output format with familiar tools like TypeScript's compiler for better readability and debugging. Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request significantly improves the diagnostic display, making syntax errors more readable and handling large code ranges gracefully with folding. The changes align well with the goal of providing a cleaner, tsc-like output. The implementation is solid, and the new tests are comprehensive. However, I've identified a critical bug in the code folding logic that results in incorrect output and highlighting. I've provided a detailed comment with a suggested fix to address this.
5f990fb to
6cbcf93
Compare
- Syntax errors: render with code snippets like tsc --pretty, using the same box format as lint rule diagnostics. Introduce SyntacticError type to carry raw ast.Diagnostic for rich rendering in the CLI. - Large code ranges: replace fixed-size array (13) and "Error range is too big" fallback with dynamic allocation and tsc-style folding (first 2 lines + ... + last 2 lines).
6cbcf93 to
6a91c8a
Compare
Summary
--pretty), using the same box format as lint rule diagnostics...+ last 2 lines, so users always see code context.Before / After
1. Syntax errors
Before — dumps entire file source into the error string, repeated for each error:
After — each error rendered with TS code, file location, and code snippet:
2. Large code range (13+ lines)
Before — code snippet skipped entirely:
After — first 2 +
..+ last 2 lines (tsc-style folding):3. Short code range (unchanged, for comparison)
Codebox under 5 lines is displayed in full — same behavior as before.
Related Links
N/A
Checklist