Skip to content

Handle SQL formatter parse failures#22540

Open
caohai wants to merge 2 commits into
mainfrom
hacao/formatter-parse-error-notification
Open

Handle SQL formatter parse failures#22540
caohai wants to merge 2 commits into
mainfrom
hacao/formatter-parse-error-notification

Conversation

@caohai

@caohai caohai commented Jul 24, 2026

Copy link
Copy Markdown
Member

Description

Handles STS formatting-failure notifications by showing an optional parse-error warning with feedback and suppression actions. Also improves formatter setting descriptions and updates STS to 6.0.20260724.3.
image

STS diff: microsoft/sqltoolsservice@6.0.20260722.6...6.0.20260724.3
Screenshot 2026-07-24 at 4 49 55 PM

Code Changes Checklist

  • New or updated unit tests added
  • All existing tests pass (npm run test)
  • Code follows contributing guidelines
  • Telemetry/logging updated if relevant
  • No regressions or UX breakage

Reviewers: Please read our reviewer guidelines

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds client-side handling for SQL Tools Service “formatting failed” notifications so users get an actionable parse-error warning (with feedback + suppression), while also clarifying formatter setting descriptions and bumping the bundled SQL Tools Service version.

Changes:

  • Listen for textDocument/formattingFailed and show a parse-error warning with “Send Feedback” and “Don’t Show Again” actions, gated by a new setting.
  • Add telemetry actions for parse-error notification interactions and a shared feedback URL constant.
  • Improve formatter setting descriptions (Preview vs existing) and add/extend unit tests to validate the new behavior and configuration metadata.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
localization/xliff/vscode-mssql.xlf Adds/updates localized strings for formatter UX and setting descriptions.
extensions/mssql/test/unit/serviceClient.test.ts Adds unit tests covering parse-error notification actions, suppression, and concurrency behavior.
extensions/mssql/test/unit/formatterConfiguration.test.ts Adds tests validating the new setting and that formatter options are labeled for Preview vs existing formatter usage.
extensions/mssql/src/sharedInterfaces/telemetry.ts Introduces new telemetry action IDs for parse-error notification actions.
extensions/mssql/src/models/contracts/languageService.ts Adds the FormattingFailedNotification contract and payload types.
extensions/mssql/src/languageservice/serviceclient.ts Hooks the new notification into the language client and implements the warning/suppression flow.
extensions/mssql/src/constants/locConstants.ts Adds formatter-specific localized strings used by the new warning UI.
extensions/mssql/src/constants/constants.ts Adds a shared feedback URL constant used by the warning action.
extensions/mssql/src/configurations/config.ts Updates SQL Tools Service version to 6.0.20260724.3.
extensions/mssql/package.nls.json Updates setting descriptions (including Preview vs existing formatter labeling) and adds the new parse-error notification setting text.
extensions/mssql/package.json Adds the new configuration setting and switches formatter option descriptions to markdownDescription where needed.
extensions/mssql/l10n/bundle.l10n.json Adds/updates localized strings for the new formatter notification UI.

Comment thread extensions/mssql/src/constants/locConstants.ts Outdated
Comment thread extensions/mssql/src/languageservice/serviceclient.ts
Comment thread extensions/mssql/test/unit/serviceClient.test.ts
Copilot AI review requested due to automatic review settings July 25, 2026 00:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Comment on lines +30 to +38
export type FormattingFailureReason = "ParseError";
export type FormattingRequestType = "Document" | "Range";

export interface FormattingFailedParams {
ownerUri: string;
formatType: FormattingRequestType;
reason: FormattingFailureReason;
parseErrorCount: number;
}
@github-actions

Copy link
Copy Markdown

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 79298 KB 79302 KB ⚪ 4 KB ( 0% )
sql-database-projects VSIX 2950 KB 2950 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 188 KB 188 KB ⚪ 0 KB ( 0% )
keymap VSIX 7 KB 7 KB ⚪ 0 KB ( 0% )

@codecov-commenter

codecov-commenter commented Jul 25, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.36170% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.28%. Comparing base (27cafce) to head (902a92a).

Files with missing lines Patch % Lines
...ensions/mssql/src/languageservice/serviceclient.ts 85.07% 10 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #22540       +/-   ##
===========================================
+ Coverage   75.78%   87.28%   +11.49%     
===========================================
  Files         407      320       -87     
  Lines      130542   115121    -15421     
  Branches     8382      520     -7862     
===========================================
+ Hits        98933   100484     +1551     
+ Misses      31609    14637    -16972     
Flag Coverage Δ
data-workspace 78.37% <ø> (ø)
mssql 88.39% <89.36%> (+12.94%) ⬆️
sqlproj 78.87% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
extensions/mssql/src/constants/locConstants.ts 100.00% <100.00%> (+22.63%) ⬆️
...ions/mssql/src/models/contracts/languageService.ts 100.00% <100.00%> (+6.71%) ⬆️
...ensions/mssql/src/languageservice/serviceclient.ts 63.62% <85.07%> (+1.09%) ⬆️

... and 304 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

3 participants