Skip to content

Remove duplicate status bar connect button#21458

Merged
lewis-sanchez merged 4 commits into
mainfrom
lewissanchez/sql-notebooks/fix-dup-status-bar-connect-btn
Mar 5, 2026
Merged

Remove duplicate status bar connect button#21458
lewis-sanchez merged 4 commits into
mainfrom
lewissanchez/sql-notebooks/fix-dup-status-bar-connect-btn

Conversation

@lewis-sanchez
Copy link
Copy Markdown
Contributor

@lewis-sanchez lewis-sanchez commented Mar 5, 2026

Description

This PR closes #21334

Before - two connect buttons appear in the status bar when a SQL notebook is open:
image

After - only one connect button appears:
image

Provide a clear, concise summary of the changes in this PR. What problem does it solve? Why is it needed? Link any related issues using issue closing keywords.

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

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 fixes a duplicate connect button appearing in the VS Code status bar when a SQL notebook is open (issue #21334). The root cause was that SqlDocumentService was processing notebook cell documents (with vscode-notebook-cell:// scheme) through the same handlers used for regular SQL editors, causing a second "Connect to MSSQL" status bar item to appear alongside the notebook's own connection button. The fix adds early-return guards in two SqlDocumentService event handlers and harmonizes the notebook status bar labels/icons with the regular editor status bar.

Changes:

  • Added vscode-notebook-cell scheme checks in SqlDocumentService.onDidOpenTextDocument() and onDidChangeActiveTextEditor() to skip notebook cell documents, preventing duplicate status bar items and unwanted auto-connect attempts.
  • Updated SqlNotebookController.updateStatusBar() to use shared StatusBar.disconnectedLabel and StatusBar.notConnectedTooltip constants (with $(plug) and $(check) icons) instead of notebook-specific strings, making the notebook status bar visually consistent with the regular editor status bar.
  • Added unit tests covering both new notebook-cell guards.

Reviewed changes

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

File Description
extensions/mssql/src/controllers/sqlDocumentService.ts Added early returns for vscode-notebook-cell documents in onDidOpenTextDocument and onDidChangeActiveTextEditor
extensions/mssql/src/notebooks/sqlNotebookController.ts Changed status bar icon from $(database) to $(check)/$(plug) and switched to shared StatusBar localization constants
extensions/mssql/test/unit/sqlDocumentService.test.ts Added two tests verifying notebook cell documents are skipped in onDidOpenTextDocument and onDidChangeActiveTextEditor

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread extensions/mssql/src/notebooks/sqlNotebookController.ts
Comment thread extensions/mssql/src/controllers/sqlDocumentService.ts Outdated
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

PR Changes

Category Target Branch PR Branch Difference
vscode-mssql VSIX 6400 KB 6398 KB ⚪ -2 KB ( 0% )
sql-database-projects VSIX 7024 KB 7024 KB ⚪ 0 KB ( 0% )
data-workspace VSIX 535 KB 535 KB ⚪ 0 KB ( 0% )

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Mar 5, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.91%. Comparing base (3f0320c) to head (f08bd77).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main   #21458   +/-   ##
=======================================
  Coverage   72.91%   72.91%           
=======================================
  Files         325      325           
  Lines       96667    96685   +18     
  Branches     5415     5419    +4     
=======================================
+ Hits        70483    70501   +18     
  Misses      26184    26184           
Files with missing lines Coverage Δ
extensions/mssql/src/constants/locConstants.ts 76.19% <ø> (-0.02%) ⬇️
...nsions/mssql/src/controllers/sqlDocumentService.ts 91.43% <100.00%> (+0.26%) ⬆️
...sions/mssql/src/notebooks/sqlNotebookController.ts 74.13% <100.00%> (ø)
🚀 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.

Comment thread extensions/mssql/src/controllers/sqlDocumentService.ts Outdated
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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

@lewis-sanchez lewis-sanchez merged commit e66f65a into main Mar 5, 2026
3 checks passed
@lewis-sanchez lewis-sanchez deleted the lewissanchez/sql-notebooks/fix-dup-status-bar-connect-btn branch March 5, 2026 19:42
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.

[Bug]: Notebook has two connect buttons and one doesn't work

4 participants