Skip to content

Commit 77b47b6

Browse files
committed
If all the previous line characters are tab, don't show autocomplete on tab
1 parent 46f612a commit 77b47b6

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -866,11 +866,13 @@ function ParagraphCtrl ($scope, $rootScope, $route, $window, $routeParams, $loca
866866
sender: 'editor|cli'
867867
},
868868
exec: function(env, args, request) {
869-
let iColumnPosition = $scope.editor.selection.getCursor().column
869+
let iCursor = $scope.editor.getCursorPosition()
870+
let currentLine = $scope.editor.session.getLine(iCursor.row)
871+
let isAllTabs = currentLine.split('').every(function(char) { return (char === '\t' || char === ' ') })
870872

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

0 commit comments

Comments
 (0)