Exemplo n.º 1
0
    def on_query_completions(self, view, prefix, locations):
        """
        Extend autocomplete results with ctags
        """
        # skip non-python files
        if not view.match_selector(0, "source.python"):
            return []

        # check ctags is exists
        ctags_file = self.get_ctags_file(view.file_name())
        if ctags_file is None or not os.path.exists(ctags_file):
            return []

        # check ctags is prepared - prepare if needed
        global ctags
        if ctags is None:
            ctags = CTags(tags_file=ctags_file, debug=is_debug)

        # pt = locations[0] - len(prefix) - 1
        # ch = view.substr(sublime.Region(pt, pt + 1))
        # is_dot = (ch == '.')

        # do autocomplete work
        return ctags.autocomplete(prefix)