QScintilla/TypingCompleters/__init__.py

Wed, 05 Jan 2011 16:21:11 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 05 Jan 2011 16:21:11 +0100
branch
5_0_x
changeset 809
0f19e2fdce8f
parent 792
a13346916170
child 945
8cd4d08fa9f6
child 1510
e75ecf2bd9dd
permissions
-rw-r--r--

Fixed an issue with the editor not activating the correct typing completer in some situations.

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

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

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

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"]:
            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