Ejemplo n.º 1
0
    def get_completions(self, document, complete_event):
        editor = self._editor_ref()
        location = self._editor_buffer_ref().location or '.txt'

        # Select completer.
        if location.endswith('.py') and editor.enable_jedi:
            completer = PythonCompleter(lambda: globals(), lambda: {})
        else:
            completer = DocumentWordsCompleter()

        # Call completer.
        return completer.get_completions(document, complete_event)
Ejemplo n.º 2
0
    def get_completions(self, document, complete_event):
        editor = self._editor_ref()
        location = self._editor_buffer_ref().location or '.txt'

        # Select completer.
        if location.endswith('.py') and editor.enable_jedi:
            completer = PythonCompleter(lambda: globals(), lambda: {})
        else:
            completer = DocumentWordsCompleter()

        # Call completer.
        return completer.get_completions(document, complete_event)
Ejemplo n.º 3
0
class myCompleter(Completer):
    def __init__(self, bot):
        self.pythoncompleter = PythonCompleter(globals, locals)
        self.bot = bot

    def get_completions(self, document, complete_event):
        if document.text.startswith("#"):
            return WordCompleter(chain(self.bot.commands,
                                       self.bot.aliases)).get_completions(
                                           document, complete_event)
        else:
            return self.pythoncompleter.get_completions(
                document, complete_event)