Skip to content

Add setting to disable opening saved query results#22062

Merged
aasimkhan30 merged 3 commits into
mainfrom
aasim/fix/22059
May 7, 2026
Merged

Add setting to disable opening saved query results#22062
aasimkhan30 merged 3 commits into
mainfrom
aasim/fix/22059

Conversation

@aasimkhan30
Copy link
Copy Markdown
Contributor

Summary

  • add mssql.results.openAfterSave to control whether Query Results exports open after save
  • keep existing auto-open behavior by default for CSV, JSON, INSERT, and Excel
  • add unit coverage for default behavior, disabled behavior, failed saves, and canceled save dialogs

Fixes #22059

Validation

  • npm run build:extension
  • npx eslint --quiet src/models/resultsSerializer.ts test/unit/saveResults.test.ts
  • npx vscode-test --label "Unit Tests" --run out/test/unit/saveResults.test.js

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 adds a new mssql.results.openAfterSave setting to control whether exported query result files are automatically opened after a successful save, while preserving the current auto-open behavior by default.

Changes:

  • Added mssql.results.openAfterSave setting (default: true) with localized description.
  • Updated results export flow to conditionally open the saved file only when the setting is enabled.
  • Expanded unit tests to cover default behavior, disabled behavior, failure cases, and canceled save dialogs.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
localization/xliff/vscode-mssql.xlf Adds localized string entry for the new setting description.
extensions/mssql/test/unit/saveResults.test.ts Adds/updates unit tests to validate conditional auto-open behavior and related edge cases.
extensions/mssql/src/models/resultsSerializer.ts Introduces shouldOpenSavedFile() and gates openSavedFile() behind the new setting.
extensions/mssql/src/constants/constants.ts Adds a constant key for results.openAfterSave.
extensions/mssql/package.nls.json Adds the English description string for the new setting.
extensions/mssql/package.json Contributes the new boolean setting with default true and resource scope.

Comment thread extensions/mssql/src/models/resultsSerializer.ts Outdated
Comment on lines 96 to 99
return saveResults.onSaveResults(testFile, 0, 0, format, undefined).then(() => {
expect(vscodeWrapper.showInformationMessage).to.have.been.calledOnce;
expect(openSavedFileStub).to.have.been.calledOnceWith(fileUri.fsPath, format);
});
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 6, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 78061 KB 78061 KB ⚪ 0 KB ( 0% )
sql-database-projects VSIX 6309 KB 6309 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )
keymap VSIX 7 KB 7 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 6, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.95%. Comparing base (b4542ac) to head (2344d68).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #22062      +/-   ##
==========================================
- Coverage   74.95%   74.95%   -0.01%     
==========================================
  Files         393      393              
  Lines      119869   119880      +11     
  Branches     7161     7163       +2     
==========================================
+ Hits        89847    89854       +7     
- Misses      30022    30026       +4     
Flag Coverage Δ
data-workspace 77.10% <ø> (ø)
mssql 74.64% <100.00%> (-0.01%) ⬇️
sqlproj 77.36% <ø> (ø)

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

Files with missing lines Coverage Δ
extensions/mssql/src/constants/constants.ts 100.00% <100.00%> (ø)
extensions/mssql/src/models/resultsSerializer.ts 93.10% <100.00%> (-0.98%) ⬇️
🚀 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.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 6, 2026 23:43
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.

Comment thread extensions/mssql/test/unit/saveResults.test.ts
Comment thread extensions/mssql/test/unit/saveResults.test.ts
Comment thread extensions/mssql/test/unit/saveResults.test.ts
Comment thread extensions/mssql/test/unit/saveResults.test.ts
@aasimkhan30 aasimkhan30 merged commit 335af02 into main May 7, 2026
7 checks passed
@aasimkhan30 aasimkhan30 deleted the aasim/fix/22059 branch May 7, 2026 00:04
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.

[Feature Request]: Do not open excel doc after exporting data to xlsx

4 participants