Remove duplicate status bar connect button#21458
Conversation
There was a problem hiding this comment.
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-cellscheme checks inSqlDocumentService.onDidOpenTextDocument()andonDidChangeActiveTextEditor()to skip notebook cell documents, preventing duplicate status bar items and unwanted auto-connect attempts. - Updated
SqlNotebookController.updateStatusBar()to use sharedStatusBar.disconnectedLabelandStatusBar.notConnectedTooltipconstants (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.
PR Changes
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ 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
🚀 New features to boost your workflow:
|
Description
This PR closes #21334
Before - two connect buttons appear in the status bar when a SQL notebook is open:

After - only one connect button appears:

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
npm run test)Reviewers: Please read our reviewer guidelines