Search in sources :

Example 11 with InterpreterCompletion

use of org.apache.zeppelin.interpreter.thrift.InterpreterCompletion in project zeppelin by apache.

the class DepInterpreter method completion.

@Override
public List<InterpreterCompletion> completion(String buf, int cursor) {
    if (Utils.isScala2_10()) {
        ScalaCompleter c = (ScalaCompleter) Utils.invokeMethod(completer, "completer");
        Candidates ret = c.complete(buf, cursor);
        List<String> candidates = WrapAsJava$.MODULE$.seqAsJavaList(ret.candidates());
        List<InterpreterCompletion> completions = new LinkedList<>();
        for (String candidate : candidates) {
            completions.add(new InterpreterCompletion(candidate, candidate));
        }
        return completions;
    } else {
        return new LinkedList<>();
    }
}
Also used : Candidates(scala.tools.nsc.interpreter.Completion.Candidates) InterpreterCompletion(org.apache.zeppelin.interpreter.thrift.InterpreterCompletion) ScalaCompleter(scala.tools.nsc.interpreter.Completion.ScalaCompleter) LinkedList(java.util.LinkedList)

Aggregations

InterpreterCompletion (org.apache.zeppelin.interpreter.thrift.InterpreterCompletion)11 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Properties (java.util.Properties)2 Test (org.junit.Test)2 Candidates (scala.tools.nsc.interpreter.Completion.Candidates)2 ScalaCompleter (scala.tools.nsc.interpreter.Completion.ScalaCompleter)2 Gson (com.google.gson.Gson)1 InterpreterException (org.apache.zeppelin.interpreter.InterpreterException)1 InterpreterResult (org.apache.zeppelin.interpreter.InterpreterResult)1 InterpreterResultMessage (org.apache.zeppelin.interpreter.InterpreterResultMessage)1 Note (org.apache.zeppelin.notebook.Note)1 Message (org.apache.zeppelin.notebook.socket.Message)1 WatcherMessage (org.apache.zeppelin.notebook.socket.WatcherMessage)1 Theory (org.junit.experimental.theories.Theory)1