Source:
public List<InterpreterCompletion> completion(String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { final List <InterpreterCompletion> completions = LSPUtils. getLspServerComplitions(buf, cursor, getProperty("zeppelin.python.lspHost", "localhost"), Integer.parseInt(getProperty("zeppelin.python.lspPort", "2087")), LSP_LANG_ID); if (!completions.isEmpty()) { return completions; } if (iPythonInterpreter != null) { return iPythonInterpreter.completion(buf, cursor, interpreterContext); } if (buf.length() < cursor) { cursor = buf.length(); } String completionString = getCompletionTargetString(buf, cursor); String completionCommand = "__zeppelin_completion__.getCompletion('" + completionString + "')"; LOGGER.debug("completionCommand: " + completionCommand); pythonInterpretRequest = new PythonInterpretRequest(completionCommand, true); statementOutput = null; synchronized (statementSetNotifier) { statementSetNotifier.notify(); } String[] completionList = null; synchronized (statementFinishedNotifier) { long startTime = System.currentTimeMillis(); while (statementOutput == null && pythonScriptRunning.get()) { try { if (System.currentTimeMillis() - startTime > MAX_TIMEOUT_SEC * 1000) { LOGGER.error("Python completion didn't have response for {}sec.", MAX_TIMEOUT_SEC); break; } statementFinishedNotifier.wait(1000); } catch (InterruptedException e) { LOGGER.info("wait drop"); return new LinkedList<>(); } } if (statementError) { return new LinkedList<>(); } Gson gson = new Gson(); completionList = gson.fromJson(statementOutput, String[].class); } if (completionList == null) { return new LinkedList<>(); } List<InterpreterCompletion> results = new LinkedList<>(); for (String name : completionList) { results.add(new InterpreterCompletion(name, name, StringUtils.EMPTY)); } return results; }

Target:
public List<InterpreterCompletion> completion(String buf, int cursor, InterpreterContext interpreterContext) throws InterpreterException { if (Boolean.parseBoolean(getProperty("zeppelin.python.useLsp", "false"))) { final List<InterpreterCompletion> completions = LSPUtils .getLspServerCompletion(buf, cursor, getProperty("zeppelin.python.lspHost", "localhost"), Integer.parseInt(getProperty("zeppelin.python.lspPort", "2087")), LSP_LANG_ID); if (!completions.isEmpty()) { return completions; } } if (iPythonInterpreter != null) { return iPythonInterpreter.completion(buf, cursor, interpreterContext); } if (buf.length() < cursor) { cursor = buf.length(); } String completionString = getCompletionTargetString(buf, cursor); String completionCommand = "__zeppelin_completion__.getCompletion('" + completionString + "')"; LOGGER.debug("completionCommand: " + completionCommand); pythonInterpretRequest = new PythonInterpretRequest(completionCommand, true); statementOutput = null; synchronized (statementSetNotifier) { statementSetNotifier.notify(); } String[] completionList = null; synchronized (statementFinishedNotifier) { long startTime = System.currentTimeMillis(); while (statementOutput == null && pythonScriptRunning.get()) { try { if (System.currentTimeMillis() - startTime > MAX_TIMEOUT_SEC * 1000) { LOGGER.error("Python completion didn't have response for {}sec.", MAX_TIMEOUT_SEC); break; } statementFinishedNotifier.wait(1000); } catch (InterruptedException e) { LOGGER.info("wait drop"); return new LinkedList<>(); } } if (statementError) { return new LinkedList<>(); } Gson gson = new Gson(); completionList = gson.fromJson(statementOutput, String[].class); } if (completionList == null) { return new LinkedList<>(); } List<InterpreterCompletion> results = new LinkedList<>(); for (String name : completionList) { results.add(new InterpreterCompletion(name, name, StringUtils.EMPTY)); } return results; }