Skip to content

Commit ffe7681

Browse files
committed
trim var name input
1 parent 52ac99f commit ffe7681

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/notebooks/deepnote/sqlCellStatusBarProvider.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff 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-zA-Z_][a-zA-Z0-9_]*$/.test(value)) {
218+
if (!/^[a-zA-Z_][a-zA-Z0-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
}

0 commit comments

Comments
 (0)