コード例 #1
0
    def gather_candidates(self, context):
        if self.__use_previous_result(context):
            return self.__prev_candidates

        try:
            candidates = self.vim.call(
                self.__omnifunc, 0, context['complete_str'])
            if candidates is dict:
                candidates = candidates['words']
            elif candidates is int:
                candidates = []
        except:
            error_vim(self.vim,
                      'Error occurred calling omnifunction: ' +
                      self.__omnifunc)
            candidates = []

        candidates = convert2candidates(candidates)

        for candidate in candidates:
            candidate['dup'] = 1

        self.__prev_linenr = context['position'][1]
        self.__prev_pos = context['complete_position']
        self.__prev_input = context['input']
        self.__prev_candidates = candidates

        return candidates
コード例 #2
0
    def get_complete_position(self, context):
        if self.__use_previous_result(context):
            return self.__prev_pos

        current_ft = self.vim.eval('&filetype')
        for filetype in context['filetypes']:
            for omnifunc in convert2list(
                    get_buffer_config(context, filetype,
                                      'deoplete_omni_functions',
                                      'deoplete#omni#functions',
                                      {'_': ''})):
                if omnifunc == '' and (filetype == current_ft or
                                       filetype in ['css', 'javascript']):
                    omnifunc = context['omni__omnifunc']
                if omnifunc == '' or not self.vim.call(
                            'deoplete#util#exists_omnifunc', omnifunc):
                    continue
                self.__omnifunc = omnifunc
                for input_pattern in convert2list(
                    get_buffer_config(context, filetype,
                                      'deoplete_omni_input_patterns',
                                      'deoplete#omni#input_patterns',
                                      self.__input_patterns)):

                    m = re.search('(' + input_pattern + ')$', context['input'])
                    # self.debug(filetype)
                    # self.debug(input_pattern)
                    if input_pattern == '' or (context['event'] !=
                                               'Manual' and m is None):
                        continue

                    if filetype == current_ft and self.__omnifunc in [
                            'ccomplete#Complete',
                            'htmlcomplete#CompleteTags',
                            'phpcomplete#CompletePHP']:
                        # In the blacklist
                        error(self.vim,
                              'omni source does not support: ' +
                              self.__omnifunc)
                        error(self.vim,
                              'You must use g:deoplete#omni_patterns' +
                              ' instead.')
                        return -1
                    try:
                        complete_pos = self.vim.call(self.__omnifunc, 1, '')
                    except:
                        error_vim(self.vim,
                                  'Error occurred calling omnifunction: ' +
                                  self.__omnifunc)
                        return -1
                    return complete_pos
        return -1
コード例 #3
0
ファイル: omni.py プロジェクト: plotnikovanton/dotfiles
    def get_complete_position(self, context):
        if self.__use_previous_result(context):
            return self.__prev_pos

        current_ft = self.vim.eval('&filetype')
        for filetype in context['filetypes']:
            for omnifunc in convert2list(
                    get_buffer_config(context, filetype,
                                      'deoplete_omni_functions',
                                      'deoplete#omni#functions',
                                      {'_': ''})):
                if omnifunc == '' and filetype == current_ft:
                    omnifunc = context['omni__omnifunc']
                if omnifunc == '' or not self.vim.call(
                            'deoplete#util#exists_omnifunc', omnifunc):
                    continue
                self.__omnifunc = omnifunc
                for input_pattern in convert2list(
                    get_buffer_config(context, filetype,
                                      'deoplete_omni_input_patterns',
                                      'deoplete#omni#input_patterns',
                                      self.__input_patterns)):

                    m = re.search('(' + input_pattern + ')$', context['input'])
                    # self.debug(filetype)
                    # self.debug(input_pattern)
                    if input_pattern == '' or (context['event'] !=
                                               'Manual' and m is None):
                        continue

                    if self.__omnifunc in [
                            'ccomplete#Complete',
                            'htmlcomplete#CompleteTags',
                            'phpcomplete#CompletePHP']:
                        # In the blacklist
                        error(self.vim,
                              'omni source does not support: ' +
                              self.__omnifunc)
                        error(self.vim,
                              'You must use g:deoplete#omni_patterns' +
                              ' instead.')
                        return -1
                    try:
                        complete_pos = self.vim.call(self.__omnifunc, 1, '')
                    except:
                        error_vim(self.vim,
                                  'Error occurred calling omnifunction: ' +
                                  self.__omnifunc)
                        return -1
                    return complete_pos
        return -1
コード例 #4
0
ファイル: omni.py プロジェクト: holwech/nvim
    def _get_complete_position(self, context, current_ft, filetype):
        for omnifunc in convert2list(
                get_buffer_config(context, filetype,
                                  'deoplete_omni_functions',
                                  'deoplete#omni#functions',
                                  {'_': ''})):
            if omnifunc == '' and (filetype == current_ft or
                                   filetype in ['css', 'javascript']):
                omnifunc = context['omni__omnifunc']
            if omnifunc == '':
                continue
            self.__omnifunc = omnifunc
            for input_pattern in convert2list(
                    get_buffer_config(context, filetype,
                                      'deoplete_omni_input_patterns',
                                      'deoplete#omni#input_patterns',
                                      self._input_patterns)):

                m = re.search('(' + input_pattern + ')$', context['input'])
                # self.debug(filetype)
                # self.debug(input_pattern)
                if input_pattern == '' or (context['event'] !=
                                           'Manual' and m is None):
                    continue

                if filetype == current_ft and self.__omnifunc in [
                        'ccomplete#Complete',
                        'htmlcomplete#CompleteTags',
                        'phpcomplete#CompletePHP']:
                    # In the blacklist
                    error(self.vim,
                          'omni source does not support: ' +
                          self.__omnifunc)
                    error(self.vim,
                          'You must use g:deoplete#omni_patterns' +
                          ' instead.')
                    return -1
                try:
                    complete_pos = self.vim.call(self.__omnifunc, 1, '')
                except:
                    error_vim(self.vim,
                              'Error occurred calling omnifunction: ' +
                              self.__omnifunc)
                    return -1
                return complete_pos
        return -1
コード例 #5
0
    def gather_candidates(self, context):
        try:
            candidates = self.vim.call(self.__omnifunc, 0, '')
            if candidates is dict:
                candidates = candidates['words']
            elif candidates is int:
                candidates = []
        except:
            error_vim(
                self.vim,
                'Error occurred calling omnifunction: ' + self.__omnifunc)
            candidates = []

        candidates = convert2candidates(candidates)

        for candidate in candidates:
            candidate['dup'] = 1

        return candidates
コード例 #6
0
ファイル: omni.py プロジェクト: N0hbdy/.dotfiles
    def gather_candidates(self, context):
        try:
            candidates = self.vim.call(self.__omnifunc, 0, '')
            if candidates is dict:
                candidates = candidates['words']
            elif candidates is int:
                candidates = []
        except:
            error_vim(self.vim,
                      'Error occurred calling omnifunction: ' +
                      self.__omnifunc)
            candidates = []

        candidates = convert2candidates(candidates)

        for candidate in candidates:
            candidate['dup'] = 1

        return candidates
コード例 #7
0
    def get_complete_position(self, context):
        if self.__use_previous_result(context):
            return self.__prev_pos

        for filetype in context['filetypes']:
            for omnifunc in convert2list(
                    get_buffer_config(context, filetype,
                                      'deoplete_omni_functions',
                                      'deoplete#omni#functions', {'_': ''})):
                if omnifunc == '':
                    omnifunc = context['omni__omnifunc']
                if omnifunc in [
                        '', 'ccomplete#Complete', 'htmlcomplete#CompleteTags'
                ] or not self.vim.call('deoplete#util#exists_omnifunc',
                                       omnifunc):
                    continue
                self.__omnifunc = omnifunc
                for input_pattern in convert2list(
                        get_buffer_config(context, filetype,
                                          'deoplete_omni_input_patterns',
                                          'deoplete#omni#input_patterns',
                                          self.__input_patterns)):

                    m = re.search('(' + input_pattern + ')$', context['input'])
                    # self.debug(filetype)
                    # self.debug(input_pattern)
                    if input_pattern == '' or (context['event'] != 'Manual'
                                               and m is None):
                        continue

                    try:
                        complete_pos = self.vim.call(self.__omnifunc, 1, '')
                    except:
                        error_vim(
                            self.vim, 'Error occurred calling omnifunction: ' +
                            self.__omnifunc)
                        return -1
                    return complete_pos
        return -1
コード例 #8
0
ファイル: omni.py プロジェクト: plotnikovanton/dotfiles
    def gather_candidates(self, context):
        if self.__use_previous_result(context):
            return self.__prev_candidates

        try:
            candidates = self.vim.call(
                self.__omnifunc, 0, context['complete_str'])
            if candidates is dict:
                candidates = candidates['words']
            elif candidates is int:
                candidates = []
        except:
            error_vim(self.vim,
                      'Error occurred calling omnifunction: ' +
                      self.__omnifunc)
            candidates = []

        self.__prev_linenr = context['position'][1]
        self.__prev_pos = context['complete_position']
        self.__prev_input = context['input']
        self.__prev_candidates = candidates

        return candidates
コード例 #9
0
ファイル: base.py プロジェクト: s0la/orw_bak
 def print_error(self, expr):
     if not self.is_silent:
         error_vim(self.vim, expr)
コード例 #10
0
 def print_error(self, expr: typing.Any) -> None:
     if not self.is_silent:
         error_vim(self.vim, expr)
コード例 #11
0
ファイル: filter.py プロジェクト: davidberglund/deoplete.nvim
 def print_error(self, expr):
     error_vim(self.vim, expr)
コード例 #12
0
ファイル: base.py プロジェクト: Elv13/Config_Files
 def print_error(self, expr):
     if not self.is_silent:
         error_vim(self.vim, expr)
コード例 #13
0
 def print_error(self, expr: typing.Any) -> None:
     error_vim(self.vim, expr)