Skip to content

Commit

Permalink
[sql lab] fix alt-enter runs out-of-date SQL (apache#2603)
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch authored Apr 13, 2017
1 parent db02b33 commit 6c68a21
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,16 @@ class AceEditorWrapper extends React.PureComponent {
onBlur() {
this.props.onBlur(this.state.sql);
}
onAltEnter() {
this.props.onBlur(this.state.sql);
this.props.onAltEnter();
}
onEditorLoad(editor) {
editor.commands.addCommand({
name: 'runQuery',
bindKey: { win: 'Alt-enter', mac: 'Alt-enter' },
exec: () => {
this.props.onAltEnter();
this.onAltEnter();
},
});
editor.$blockScrolling = Infinity; // eslint-disable-line no-param-reassign
Expand All @@ -76,6 +80,9 @@ class AceEditorWrapper extends React.PureComponent {
this.props.queryEditor, editor.getSelectedText());
});
}
getCompletions(aceEditor, session, pos, prefix, callback) {
callback(null, this.state.words);
}
setAutoCompleter(props) {
// Loading table and column names as auto-completable words
let words = [];
Expand All @@ -101,9 +108,6 @@ class AceEditorWrapper extends React.PureComponent {
}
});
}
getCompletions(aceEditor, session, pos, prefix, callback) {
callback(null, this.state.words);
}
textChange(text) {
this.setState({ sql: text });
}
Expand Down

0 comments on commit 6c68a21

Please sign in to comment.