Skip to content

Commit 47be3cc

Browse files
committed
fix command palette support
1 parent d6a3f56 commit 47be3cc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/notebooks/deepnote/sqlCellStatusBarProvider.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,39 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
6868
// Register command to update SQL variable name
6969
this.disposables.push(
7070
commands.registerCommand('deepnote.updateSqlVariableName', async (cell?: NotebookCell) => {
71+
if (!cell) {
72+
// Fall back to the active notebook cell
73+
const activeEditor = window.activeNotebookEditor;
74+
if (activeEditor && activeEditor.selection) {
75+
cell = activeEditor.notebook.cellAt(activeEditor.selection.start);
76+
}
77+
}
78+
7179
if (!cell) {
7280
void window.showErrorMessage(l10n.t('No active notebook cell'));
7381
return;
7482
}
83+
7584
await this.updateVariableName(cell);
7685
})
7786
);
7887

7988
// Register command to switch SQL integration
8089
this.disposables.push(
8190
commands.registerCommand('deepnote.switchSqlIntegration', async (cell?: NotebookCell) => {
91+
if (!cell) {
92+
// Fall back to the active notebook cell
93+
const activeEditor = window.activeNotebookEditor;
94+
if (activeEditor && activeEditor.selection) {
95+
cell = activeEditor.notebook.cellAt(activeEditor.selection.start);
96+
}
97+
}
98+
8299
if (!cell) {
83100
void window.showErrorMessage(l10n.t('No active notebook cell'));
84101
return;
85102
}
103+
86104
await this.switchIntegration(cell);
87105
})
88106
);

0 commit comments

Comments
 (0)