File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff 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 ) ;
You can’t perform that action at this time.
0 commit comments