Search in sources :

Example 1 with PythonConsoleLexer

use of com.jetbrains.python.console.parsing.PythonConsoleLexer in project intellij-community by JetBrains.

the class PyFileElementType method createConsoleLexer.

@Nullable
private Lexer createConsoleLexer(ASTNode node, PythonConsoleData consoleData) {
    if (consoleData.isIPythonEnabled()) {
        return new PythonConsoleLexer();
    } else {
        final ParserDefinition parserDefinition = LanguageParserDefinitions.INSTANCE.forLanguage(getLanguage());
        if (parserDefinition == null) {
            return null;
        }
        final PsiElement psi = node.getPsi();
        if (psi == null) {
            return null;
        }
        final Project project = psi.getProject();
        return parserDefinition.createLexer(project);
    }
}
Also used : Project(com.intellij.openapi.project.Project) PythonConsoleLexer(com.jetbrains.python.console.parsing.PythonConsoleLexer) PsiElement(com.intellij.psi.PsiElement) Nullable(org.jetbrains.annotations.Nullable)

Aggregations

Project (com.intellij.openapi.project.Project)1 PsiElement (com.intellij.psi.PsiElement)1 PythonConsoleLexer (com.jetbrains.python.console.parsing.PythonConsoleLexer)1 Nullable (org.jetbrains.annotations.Nullable)1