Skip to content

Commit 087189d

Browse files
committed
add handling for no cell being selected
1 parent a54ad0c commit 087189d

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/notebooks/deepnote/sqlCellStatusBarProvider.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,22 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
5050

5151
// Register command to update SQL variable name
5252
this.disposables.push(
53-
commands.registerCommand('deepnote.updateSqlVariableName', async (cell: NotebookCell) => {
53+
commands.registerCommand('deepnote.updateSqlVariableName', async (cell?: NotebookCell) => {
54+
if (!cell) {
55+
void window.showErrorMessage(l10n.t('No active notebook cell'));
56+
return;
57+
}
5458
await this.updateVariableName(cell);
5559
})
5660
);
5761

5862
// Register command to switch SQL integration
5963
this.disposables.push(
60-
commands.registerCommand('deepnote.switchSqlIntegration', async (cell: NotebookCell) => {
64+
commands.registerCommand('deepnote.switchSqlIntegration', async (cell?: NotebookCell) => {
65+
if (!cell) {
66+
void window.showErrorMessage(l10n.t('No active notebook cell'));
67+
return;
68+
}
6169
await this.switchIntegration(cell);
6270
})
6371
);

0 commit comments

Comments
 (0)