PsiPolyVariantReference (@NotNull PyReferenceExpression element, @NotNull PyResolveContext context) { PsiFile file = element.getContainingFile(); if (file != null) { final ConsoleCommunication communication = file.getCopyableUserData(PydevConsoleRunner.CONSOLE_COMMUNICATION_KEY); if (communication != null && PyConsoleOptions.getInstance(element.getProject()).isRuntimeCodeCompletion()) { PyExpression qualifier = element.getQualifier(); final String prefix = qualifier == null ? "" : qualifier.getText() + "."; return new PydevConsoleReference(element, communication, prefix, context.allowRemote()); } if (communication instanceof PythonDebugConsoleCommunication comm) { comm.setContext(); } } return null; }