Support tsserver offset diagnostics in simulation validation#316878
Open
AsaZhou923 wants to merge 2 commits into
Open
Support tsserver offset diagnostics in simulation validation#316878AsaZhou923 wants to merge 2 commits into
AsaZhou923 wants to merge 2 commits into
Conversation
TSServer can return DiagnosticWithLinePosition for synchronous diagnostic requests. The simulation provider now normalizes both line-position and offset-length forms into cached test diagnostics instead of throwing during validation. Constraint: Copilot simulation PR gate requires cache-only simulation runs to stay deterministic. Rejected: Keep throwing on offset diagnostics | this blocks valid tsserver responses from simulation validation. Confidence: high Scope-risk: narrow Directive: Keep diagnostic normalization compatible with both tsserver protocol diagnostic shapes. Tested: npm --prefix extensions/copilot run typecheck Tested: npm --prefix extensions/copilot run lint Tested: npm --prefix extensions/copilot run compile Tested: npm --prefix extensions/copilot run test:unit Tested: npm --prefix extensions/copilot run simulate-ci Not-tested: VS Code extension/sanity UI tests; this change is limited to simulation diagnostic normalization.
Author
|
@microsoft-github-policy-service agree |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Copilot simulation TypeScript diagnostics provider so it can normalize both regular tsserver diagnostics and offset-based DiagnosticWithLinePosition diagnostics.
Changes:
- Adds diagnostic message/location helpers for both tsserver diagnostic shapes.
- Converts offset/length diagnostics into
ITestDiagnosticLocation. - Tracks file contents by file name for offset-to-position fallback conversion.
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.
Fixes #316877
This updates the Copilot simulation TSC diagnostics provider to normalize both tsserver diagnostic response shapes:
Diagnostic, which already contains line/offset start and end positionsDiagnosticWithLinePosition, which contains offset/length plus line-position metadataThe provider now maps either shape into
ITestDiagnosticLocationinstead of throwing when tsserver returns offset-based diagnostics.Testing:
git diff --checknpm --prefix extensions/copilot run typechecknpm --prefix extensions/copilot run lintnpm --prefix extensions/copilot run compilenpm --prefix extensions/copilot run test:unitnpm --prefix extensions/copilot run simulate-cinpm --prefix extensions/copilot run test:prompt