use of org.apache.zeppelin.interpreter.jupyter.proto.CompletionResponse 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;
}
Aggregations