Repository: incubator-zeppelin Updated Branches: refs/heads/master 7eb97c081 -> cf9541f8d
ZEPPELIN-141: Show only the Interpreters suggestions. Move the 'local⦠â¦' suggestions to the bottom of the list Author: tzolov <[email protected]> Closes #181 from tzolov/ZEPPELIN-141 and squashes the following commits: a7202a7 [tzolov] ZEPPELIN-141: resolve ACE auto-completion pop-up menu wrong z-index 78117e6 [tzolov] ZEPPELIN-141: (Re)set the correct ACE editor mode on auto-completion event (Ctrl+.) f9ff609 [tzolov] ZEPPELIN-141: Add the default langToos (keyWord,snippet,text)Completers after the Interpter one 114756c [tzolov] ZEPPELIN-141: Show only the Interpreters suggestions. Move the 'local' suggestions to the bottom of the list Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/cf9541f8 Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/cf9541f8 Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/cf9541f8 Branch: refs/heads/master Commit: cf9541f8d62a4fdcc79d9092ed7c2359ba03da00 Parents: 7eb97c0 Author: tzolov <[email protected]> Authored: Sat Aug 8 21:28:18 2015 +0200 Committer: Lee moon soo <[email protected]> Committed: Mon Aug 10 13:18:38 2015 -0700 ---------------------------------------------------------------------- .../notebook/paragraph/paragraph.controller.js | 38 ++++++++++++-------- zeppelin-web/src/index.html | 6 ++++ 2 files changed, 29 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/cf9541f8/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js index 7091e28..3d83d78 100644 --- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js +++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js @@ -415,17 +415,27 @@ angular.module('zeppelinWebApp') // not applying emacs key binding while the binding override Ctrl-v. default behavior of paste text on windows. } - $scope.editor.setOptions({ - enableBasicAutocompletion: true, - enableSnippets: false, - enableLiveAutocompletion:false - }); + var sqlModeTest = /^%(\w*\.)?\wql/; + + $scope.setParagraphMode = function(session, paragraphText) { + if (sqlModeTest.test(String(paragraphText))) { + session.setMode(editorMode.sql); + } else if ( String(paragraphText).startsWith('%md')) { + session.setMode(editorMode.markdown); + } else { + session.setMode(editorMode.scala); + } + } + var remoteCompleter = { getCompletions : function(editor, session, pos, prefix, callback) { if (!$scope.editor.isFocused() ){ return;} var pos = session.getTextRange(new Range(0, 0, pos.row, pos.column)).length; var buf = session.getValue(); + + // ensure the correct mode is set + $scope.setParagraphMode(session, buf); websocketMsgSrv.completion($scope.paragraph.id, buf, pos); @@ -445,8 +455,14 @@ angular.module('zeppelinWebApp') }); } }; - langTools.addCompleter(remoteCompleter); + + langTools.setCompleters([remoteCompleter, langTools.keyWordCompleter, langTools.snippetCompleter, langTools.textCompleter]); + $scope.editor.setOptions({ + enableBasicAutocompletion: true, + enableSnippets: false, + enableLiveAutocompletion:false + }); $scope.handleFocus = function(value) { $scope.paragraphFocused = value; @@ -472,15 +488,7 @@ angular.module('zeppelinWebApp') $scope.editor.resize(); }); - var sqlModeTest = /^%(\w*\.)?\wql/; - var code = $scope.editor.getSession().getValue(); - if (sqlModeTest.test(String(code))) { - $scope.editor.getSession().setMode(editorMode.sql); - } else if ( String(code).startsWith('%md')) { - $scope.editor.getSession().setMode(editorMode.markdown); - } else { - $scope.editor.getSession().setMode(editorMode.scala); - } + $scope.setParagraphMode($scope.editor.getSession(), $scope.editor.getSession().getValue()); $scope.editor.commands.addCommand({ name: 'run', http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/cf9541f8/zeppelin-web/src/index.html ---------------------------------------------------------------------- diff --git a/zeppelin-web/src/index.html b/zeppelin-web/src/index.html index a65c944..a4e2f89 100644 --- a/zeppelin-web/src/index.html +++ b/zeppelin-web/src/index.html @@ -27,6 +27,12 @@ limitations under the License. <meta name="description" content=""> <meta name="viewport" content="width=device-width"> + + <!-- ACE CSS autocomplition issue workarounds --> + <style type="text/css"> + div.ace_editor.ace_autocomplete .ace_marker-layer .ace_active-line { z-index: -1 !important; } + </style> + <!-- Place favicon.ico and apple-touch-icon.png in the root directory --> <!-- build:css(.) styles/vendor.css --> <!-- bower:css -->
