zeppelin-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject incubator-zeppelin git commit: ZEPPELIN-485 ] Bug Fixed Paragraph Spark Completion
Date Wed, 09 Dec 2015 11:39:32 GMT
Repository: incubator-zeppelin
Updated Branches:
  refs/heads/master 6c23c909e -> 3fbca2666


ZEPPELIN-485 ] Bug Fixed Paragraph Spark Completion

https://issues.apache.org/jira/browse/ZEPPELIN-485

![3333](https://cloud.githubusercontent.com/assets/10525473/11585603/9dc79398-9ab0-11e5-823d-968807798e81.gif)

----
issue
When you press the Shift + Ctrl + Space key.
Code auto-completion feature, it must work.
But it does not operate normally,
Only the first line of action.

---
### cause.

When the operation by the user to request a code completion,
Front web Autocomplete target code is not properly transmitted.

Therefore, **Frontweb of Paragraph - Fixed Completion parts.**

Author: CloverHearts <estail7s@gmail.com>

Closes #514 from cloverhearts/bug_fix/spark_scala_completion and squashes the following commits:

2426314 [CloverHearts] Fixed Paragraph Spark Completion


Project: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/commit/3fbca266
Tree: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/tree/3fbca266
Diff: http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/diff/3fbca266

Branch: refs/heads/master
Commit: 3fbca26666c178c5a4235e5fa8b5202779f1ff16
Parents: 6c23c90
Author: CloverHearts <estail7s@gmail.com>
Authored: Fri Dec 4 17:06:12 2015 +0900
Committer: Lee moon soo <moon@apache.org>
Committed: Wed Dec 9 20:40:41 2015 +0900

----------------------------------------------------------------------
 .../notebook/paragraph/paragraph.controller.js  | 29 +++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-zeppelin/blob/3fbca266/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 4edb1a3..3c15715 100644
--- a/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
+++ b/zeppelin-web/src/app/notebook/paragraph/paragraph.controller.js
@@ -535,8 +535,35 @@ angular.module('zeppelinWebApp')
 
           pos = session.getTextRange(new Range(0, 0, pos.row, pos.column)).length;
           var buf = session.getValue();
+          var completionString = buf;
 
-          websocketMsgSrv.completion($scope.paragraph.id, buf, pos);
+          if (pos > 0) {
+            var completionStartPosition = pos;
+            var completionSeqCharaters = [' ', '\n'];
+
+            // replace \r\n or \n\r other to \n
+            var reverseCompletionString = buf.replace(/\r?\n|\r/g, '\n').substr(0, pos).split('').reverse();
+            for (var seqCharacterIndex in completionSeqCharaters) {
+              var indexOfReverseSeqPostion = reverseCompletionString.indexOf(completionSeqCharaters[seqCharacterIndex]);
+
+              if (indexOfReverseSeqPostion < completionStartPosition && indexOfReverseSeqPostion
> 0) {
+                completionStartPosition = indexOfReverseSeqPostion;
+              }
+            }
+
+            if (completionStartPosition === pos) {
+              completionStartPosition = 0;
+            }
+            else
+            {
+              completionStartPosition = pos - completionStartPosition;
+            }
+
+            completionString = buf.substr( completionStartPosition , pos);
+            pos = completionString.length -1;
+          }
+
+          websocketMsgSrv.completion($scope.paragraph.id, completionString, pos);
 
           $scope.$on('completionList', function(event, data) {
             if (data.completions) {


Mime
View raw message