Skip to content

Commit 63d69e1

Browse files
committed
Merge branch 'ZEPPELIN-277' of github.com:malayhm/zeppelin into ZEPPELIN-277
# Conflicts: # zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
2 parents a75f0fe + 2ec879d commit 63d69e1

File tree

4 files changed

+32
-8
lines changed

4 files changed

+32
-8
lines changed

docs/development/writing_zeppelin_interpreter.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ Here is an example of `interpreter-setting.json` on your own interpreter.
7474
},
7575
"editor": {
7676
"language": "your-syntax-highlight-language",
77-
"editOnDblClick": false
77+
"editOnDblClick": false,
78+
"completionKey": "TAB"
7879
}
7980
},
8081
{
@@ -128,6 +129,19 @@ If your interpreter uses mark-up language such as markdown or HTML, set `editOnD
128129
"editOnDblClick": false
129130
}
130131
```
132+
133+
### Completion key (Optional)
134+
By default, `Ctrl+dot(.)` brings autocompletion list in the editor.
135+
Through `completionKey`, each interpreter can configure autocompletion key.
136+
Currently `TAB` is only available option.
137+
138+
```
139+
"editor": {
140+
"completionKey": "TAB"
141+
}
142+
```
143+
144+
131145
## Install your interpreter binary
132146

133147
Once you have built your interpreter, you can place it under the interpreter directory with all its dependencies.

python/src/main/resources/interpreter-setting.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
},
4545
"editor": {
4646
"language": "python",
47-
"editOnDblClick": false
47+
"editOnDblClick": false,
48+
"completionKey": "TAB"
4849
}
4950
},
5051
{

spark/src/main/resources/interpreter-setting.json

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
},
7272
"editor": {
7373
"language": "scala",
74-
"editOnDblClick": false
74+
"editOnDblClick": false,
75+
"completionKey": "TAB"
7576
}
7677
},
7778
{
@@ -110,7 +111,8 @@
110111
},
111112
"editor": {
112113
"language": "sql",
113-
"editOnDblClick": false
114+
"editOnDblClick": false,
115+
"completionKey": "TAB"
114116
}
115117
},
116118
{
@@ -135,7 +137,8 @@
135137
},
136138
"editor": {
137139
"language": "scala",
138-
"editOnDblClick": false
140+
"editOnDblClick": false,
141+
"completionKey": "TAB"
139142
}
140143
},
141144
{
@@ -160,7 +163,8 @@
160163
},
161164
"editor": {
162165
"language": "python",
163-
"editOnDblClick": false
166+
"editOnDblClick": false,
167+
"completionKey": "TAB"
164168
}
165169
},
166170
{

zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,11 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
185185
}
186186
}
187187

188+
const isTabCompletion = function() {
189+
const completionKey = $scope.paragraph.config.editorSetting.completionKey
190+
return completionKey === 'TAB'
191+
}
192+
188193
$scope.$on('updateParagraphOutput', function (event, data) {
189194
if ($scope.paragraph.id === data.paragraphId) {
190195
if (!$scope.paragraph.results) {
@@ -870,9 +875,9 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
870875
let currentLine = $scope.editor.session.getLine(iCursor.row)
871876
let isAllTabs = currentLine.substring(0, iCursor.column - 1).split('').every(function(char) { return (char === '\t' || char === ' ') })
872877

873-
// If user has pressed tab on first line char or if editor mode is %md, keep existing behavior
878+
// If user has pressed tab on first line char or if isTabCompletion() is false, keep existing behavior
874879
// If user has pressed tab anywhere in between and editor mode is not %md, show autocomplete
875-
if (!isAllTabs && iCursor.column && $scope.paragraph.config.editorMode !== 'ace/mode/markdown') {
880+
if (!isAllTabs && iCursor.column && isTabCompletion()) {
876881
$scope.editor.execCommand('startAutocomplete')
877882
} else {
878883
ace.config.loadModule('ace/ext/language_tools', function () {

0 commit comments

Comments
 (0)