Repository navigation
Fix formatting of locationless related diagnostics - #65592
Open
Ishaan Gautam (TheNightCoder21) wants to merge 1 commit into
Open
Ishaan Gautam (TheNightCoder21) wants to merge 1 commit into
Ishaan Gautam (TheNightCoder21) wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues were identified in the change to preserve related diagnostic messages without source locations.
No open issues 🎉
What changed in this PR
Fixes #65087 in the native TypeScript API by preserving related diagnostic messages even when they lack source locations.
Changes:
- Emits related message text independently of location headings and source context.
- Preserves indentation for nested related message chains.
- Adds regression coverage for located, locationless, and partial-location diagnostics, LF/CRLF newlines, and absent related information.
| File | Description |
|---|---|
packages/typescript/test/diagnosticFormatter.test.ts |
Adds regression coverage for related diagnostic formatting and edge cases. |
packages/typescript/src/api/diagnosticFormatter.ts |
Separates related message output from location checks and carries base indentation through nested messages. |
Review effort: Balanced
Author
|
@microsoft-github-policy-service agree |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #65087.
formatDiagnosticsWithColorAndContextcurrently formats related diagnostic messages only when the related diagnostic has both a file name and a start position. Consequently, related messages without source locations, including their nested message chains, are silently omitted.This change:
Testing
npx hereby validate --allnpx hereby tidygit diff --checkAll listed checks passed.
The regression test covers both the existing located-diagnostic behavior and the previously missing locationless-diagnostic behavior.