eric6/QScintilla/TypingCompleters/__init__.py

Wed, 13 Jul 2022 15:34:50 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jul 2022 15:34:50 +0200
branch
with_python2
changeset 9225
bf799f79455c
parent 7178
43e994af5ee0
child 7229
53054eb5b15a
permissions
-rw-r--r--

Revisions <no_multi_processing, Variables Viewer, with_python2> closed.

# -*- coding: utf-8 -*-

# Copyright (c) 2007 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Package implementing lexers for the various supported programming languages.
"""


from __future__ import unicode_literals


def getCompleter(language, editor, parent=None):
    """
    Module function to instantiate a lexer object for a given language.
    
    @param language language of the lexer (string)
    @param editor reference to the editor object (QScintilla.Editor)
    @param parent reference to the parent object (QObject)
    @return reference to the instanciated lexer object (QsciLexer)
    """
    try:
        if language in ["Python", "Python2", "Python3", "MicroPython"]:
            from .CompleterPython import CompleterPython
            return CompleterPython(editor, parent)
        elif language == "Ruby":
            from .CompleterRuby import CompleterRuby
            return CompleterRuby(editor, parent)
        else:
            return None
    except ImportError:
        return None

eric ide

mercurial