Skip to content
Merged
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
16 changes: 15 additions & 1 deletion docs/development/writing_zeppelin_interpreter.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ Here is an example of `interpreter-setting.json` on your own interpreter.
},
"editor": {
"language": "your-syntax-highlight-language",
"editOnDblClick": false
"editOnDblClick": false,
"completionKey": "TAB"
}
},
{
Expand Down Expand Up @@ -128,6 +129,19 @@ If your interpreter uses mark-up language such as markdown or HTML, set `editOnD
"editOnDblClick": false
}
```

### Completion key (Optional)
By default, `Ctrl+dot(.)` brings autocompletion list in the editor.
Through `completionKey`, each interpreter can configure autocompletion key.
Currently `TAB` is only available option.

```
"editor": {
"completionKey": "TAB"
}
```


## Install your interpreter binary

Once you have built your interpreter, you can place it under the interpreter directory with all its dependencies.
Expand Down
3 changes: 2 additions & 1 deletion python/src/main/resources/interpreter-setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
},
"editor": {
"language": "python",
"editOnDblClick": false
"editOnDblClick": false,
"completionKey": "TAB"
}
},
{
Expand Down
12 changes: 8 additions & 4 deletions spark/src/main/resources/interpreter-setting.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@
},
"editor": {
"language": "scala",
"editOnDblClick": false
"editOnDblClick": false,
"completionKey": "TAB"
}
},
{
Expand Down Expand Up @@ -110,7 +111,8 @@
},
"editor": {
"language": "sql",
"editOnDblClick": false
"editOnDblClick": false,
"completionKey": "TAB"
}
},
{
Expand All @@ -135,7 +137,8 @@
},
"editor": {
"language": "scala",
"editOnDblClick": false
"editOnDblClick": false,
"completionKey": "TAB"
}
},
{
Expand All @@ -153,7 +156,8 @@
},
"editor": {
"language": "python",
"editOnDblClick": false
"editOnDblClick": false,
"completionKey": "TAB"
}
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,11 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
}
}

const isTabCompletion = function() {
const completionKey = $scope.paragraph.config.editorSetting.completionKey
return completionKey === 'TAB'
}

$scope.$on('updateParagraphOutput', function (event, data) {
if ($scope.paragraph.id === data.paragraphId) {
if (!$scope.paragraph.results) {
Expand Down Expand Up @@ -843,9 +848,9 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
let currentLine = $scope.editor.session.getLine(iCursor.row)
let isAllTabs = currentLine.split('').every(function(char) { return (char === '\t' || char === ' ') })

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