Skip to content

Support tsserver offset diagnostics in simulation validation#316878

Open
AsaZhou923 wants to merge 2 commits into
microsoft:mainfrom
AsaZhou923:fix/tsserver-diagnostic-line-position
Open

Support tsserver offset diagnostics in simulation validation#316878
AsaZhou923 wants to merge 2 commits into
microsoft:mainfrom
AsaZhou923:fix/tsserver-diagnostic-line-position

Conversation

@AsaZhou923
Copy link
Copy Markdown

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 positions
  • DiagnosticWithLinePosition, which contains offset/length plus line-position metadata

The provider now maps either shape into ITestDiagnosticLocation instead of throwing when tsserver returns offset-based diagnostics.

Testing:

  • git diff --check
  • npm --prefix extensions/copilot run typecheck
  • npm --prefix extensions/copilot run lint
  • npm --prefix extensions/copilot run compile
  • npm --prefix extensions/copilot run test:unit
  • npm --prefix extensions/copilot run simulate-ci
  • npm --prefix extensions/copilot run test:prompt

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.
Copilot AI review requested due to automatic review settings May 17, 2026 14:25
@AsaZhou923
Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Copilot simulation TSC diagnostics provider fails on DiagnosticWithLinePosition

3 participants