Exemplo n.º 1
0
    def gather_candidates(self, context):
        pos = self.vim.eval('getpos(".")')
        try:
            candidates = self.vim.eval(
                "call(&l:omnifunc, [0, '{0}'])"
                .format(escape(context['complete_str'])))
        except:
            self.vim.command(
                'call deoplete#util#print_error('
                + '"Error occurred calling omnifunction: "'
                + '. &l:omnifunc)')

            candidates = []
        finally:
            if pos != self.vim.eval('getpos(".")'):
                self.vim.command(
                    'call deoplete#util#print_error('
                    + '"omnifunction: "'
                    + '. &l:omnifunc . " moves cursor!")')
                self.vim.command(
                    'call deoplete#util#print_error('
                    + '"Deoplete cannot support it in omni source. "'
                    + '. "You should use g:deoplete#omni_patterns.")')

        return candidates
Exemplo n.º 2
0
    def gather_candidates(self, context):
        pos = self.vim.eval('getpos(".")')
        try:
            candidates = self.vim.eval(
                "call(&l:omnifunc, [0, '{0}'])"
                .format(escape(context['complete_str'])))
        except:
            self.vim.command(
                'call deoplete#util#print_error('
                + '"Error occurred calling omnifunction: "'
                + '. &l:omnifunc)')
            self.vim.command(
                'call deoplete#util#print_error(v:throwpoint)')
            self.vim.command(
                'call deoplete#util#print_error(v:exception)')

            candidates = []
        finally:
            if pos != self.vim.eval('getpos(".")'):
                self.vim.command(
                    'call setpos(".", {0})'.format(str(pos)))

        return candidates