File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -207,20 +207,22 @@ export class SqlCellStatusBarProvider implements NotebookCellStatusBarItemProvid
207207 private async updateVariableName ( cell : NotebookCell ) : Promise < void > {
208208 const currentVariableName = this . getVariableName ( cell ) ;
209209
210- const newVariableName = await window . showInputBox ( {
210+ const newVariableNameInput = await window . showInputBox ( {
211211 prompt : l10n . t ( 'Enter variable name for SQL query result' ) ,
212212 value : currentVariableName ,
213213 validateInput : ( value ) => {
214- if ( ! value ) {
214+ const trimmed = value . trim ( ) ;
215+ if ( ! trimmed ) {
215216 return l10n . t ( 'Variable name cannot be empty' ) ;
216217 }
217- if ( ! / ^ [ a - z A - Z _ ] [ a - z A - Z 0 - 9 _ ] * $ / . test ( value ) ) {
218+ if ( ! / ^ [ a - z A - Z _ ] [ a - z A - Z 0 - 9 _ ] * $ / . test ( trimmed ) ) {
218219 return l10n . t ( 'Variable name must be a valid Python identifier' ) ;
219220 }
220221 return undefined ;
221222 }
222223 } ) ;
223224
225+ const newVariableName = newVariableNameInput ?. trim ( ) ;
224226 if ( newVariableName === undefined || newVariableName === currentVariableName ) {
225227 return ;
226228 }
You can’t perform that action at this time.
0 commit comments