Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ZEPPELIN-141: Show only the Interpreters suggestions. Move the 'local… #181

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 23 additions & 15 deletions zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand All @@ -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',
Expand Down
6 changes: 6 additions & 0 deletions zeppelin-web/src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@

<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 -->
Expand Down