use of org.apache.zeppelin.interpreter.thrift.InterpreterCompletion in project zeppelin by apache.
the class JupyterKernelInterpreter method completion.
@Override
public List<InterpreterCompletion> completion(String buf, int cursor, InterpreterContext interpreterContext) {
LOGGER.debug("Call completion for: {}, cursor: {}", buf, cursor);
List<InterpreterCompletion> completions = new ArrayList<>();
CompletionResponse response = jupyterKernelClient.complete(CompletionRequest.getDefaultInstance().newBuilder().setCode(buf).setCursor(cursor).build());
for (int i = 0; i < response.getMatchesCount(); i++) {
String match = response.getMatches(i);
int lastIndexOfDot = match.lastIndexOf(".");
if (lastIndexOfDot != -1) {
match = match.substring(lastIndexOfDot + 1);
}
LOGGER.debug("Candidate completion: {}", match);
completions.add(new InterpreterCompletion(match, match, ""));
}
return completions;
}
use of org.apache.zeppelin.interpreter.thrift.InterpreterCompletion in project SSM by Intel-bigdata.
the class Paragraph method getInterpreterCompletion.
public List<InterpreterCompletion> getInterpreterCompletion() {
List<InterpreterCompletion> completion = new LinkedList();
for (InterpreterSetting intp : interpreterSettingManager.getInterpreterSettings(note.getId())) {
List<InterpreterInfo> intInfo = intp.getInterpreterInfos();
if (intInfo.size() > 1) {
for (InterpreterInfo info : intInfo) {
String name = intp.getName() + "." + info.getName();
completion.add(new InterpreterCompletion(name, name));
}
} else {
completion.add(new InterpreterCompletion(intp.getName(), intp.getName()));
}
}
return completion;
}
Aggregations