Example #1
0
    def __init__(self, parent):
        """Initializes the autocompletion service
        @param parent: parent of this service object

        """
        object.__init__(self)

        # Attributes
        self._buffer = parent
        self._completer = None
        self._simpleCompleter = simplecomp.Completer(self._buffer)
Example #2
0
    def __call__(mcs, base, buff):
        """Modify the base class with our new methods at time of
        instantiation.

        """
        obj = type.__call__(mcs, base, buff)

        # Set/override attributes on the new completer object.
        setattr(obj, 'BaseGetAutoCompList', obj.GetAutoCompList)
        setattr(obj, 'GetAutoCompList', lambda cmd: GetAutoCompList(obj, cmd))
        setattr(obj, 'scomp', simplecomp.Completer(buff))

        # Return the new augmented completer
        return obj
Example #3
0
    def GetCompleter(buff):
        lex_value = buff.GetLexer()
        if lex_value == stc.STC_LEX_PYTHON:
            import pycomp
            completer = pycomp.Completer(buff)
        elif lex_value in (stc.STC_LEX_HTML, stc.STC_LEX_XML):
            import htmlcomp
            completer = htmlcomp.Completer(buff)
        elif lex_value == stc.STC_LEX_CSS:
            import csscomp
            completer = csscomp.Completer(buff)
        else:
            import simplecomp
            completer = simplecomp.Completer(buff)

        return completer
Example #4
0
    def GetCompleter(buff, extended=False):
        """Get the appropriate completer object for the given buffer.
        @todo: implement dynamic loading mechanism for each comp class

        """
        lex_value = buff.GetLexer()
        if lex_value == stc.STC_LEX_PYTHON:
            import pycomp
            compl = pycomp.Completer
        elif lex_value in (stc.STC_LEX_HTML, stc.STC_LEX_XML):
            import htmlcomp
            compl = htmlcomp.Completer
        elif lex_value == stc.STC_LEX_CSS:
            import csscomp
            compl = csscomp.Completer
        else:
            return simplecomp.Completer(buff)

        if extended:
            compl = CompleterFactory(compl, buff)
        else:
            compl = compl(buff)

        return compl