Skip to content

Commit

Permalink
fix(sql lab): add quotes when autocompleting table names with spaces …
Browse files Browse the repository at this point in the history
…in the editor (#19311)
  • Loading branch information
diegomedina248 committed Apr 15, 2022
1 parent bbe0af3 commit 8d4a52c
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -227,11 +227,15 @@ class AceEditorWrapper extends React.PureComponent<Props, State> {
this.props.queryEditor.schema,
);
}

let { caption } = data;
if (data.meta === 'table' && caption.includes(' ')) {
caption = `"${caption}"`;
}

// executing https://github.com/thlorenz/brace/blob/3a00c5d59777f9d826841178e1eb36694177f5e6/ext/language_tools.js#L1448
editor.completer.insertMatch(
`${data.caption}${
['function', 'schema'].includes(data.meta) ? '' : ' '
}`,
`${caption}${['function', 'schema'].includes(data.meta) ? '' : ' '}`,
);
},
};
Expand Down

0 comments on commit 8d4a52c

Please sign in to comment.