Browse Source

HUE-5694 [editor] Improve re-open timings for autocompletion of ‘? FROM db.table’

Johan Ahlen 8 years ago
parent
commit
ca18e91
1 changed files with 6 additions and 1 deletions
  1. 6 1
      desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

+ 6 - 1
desktop/core/src/desktop/static/desktop/js/ko.hue-bindings.js

@@ -3798,7 +3798,12 @@
           window.clearTimeout(autocompleteThrottle);
           autocompleteThrottle = window.setTimeout(function () {
             var textBeforeCursor = editor.getTextBeforeCursor();
-            var questionMarkMatch = textBeforeCursor.match(/select \? from \S+[^.]$/i);
+            var questionMarkMatch;
+            if ($('.hue-ace-autocompleter').length > 0) {
+              questionMarkMatch = textBeforeCursor.match(/select \? from \S+[^.]\s$/i);
+            } else {
+              questionMarkMatch = textBeforeCursor.match(/select \? from \S+[^.]$/i);
+            }
             if (questionMarkMatch && $('.ace_autocomplete:visible').length === 0) {
               editor.moveCursorTo(editor.getCursorPosition().row, editor.getCursorPosition().column - questionMarkMatch[0].length + 8);
               editor.removeTextBeforeCursor(1);