Exemple #1
0
    def gather_candidates(self, context):

        if context['event'] == 'interactive':
            self.on_close(context)

            if (len(context['input']) < self.vars['min_interactive_pattern']):
                return []

            context['__patterns'] = context['input'].split()

        if context['__proc']:
            return self.__async_gather_candidates(context,
                                                  context['async_timeout'])

        if not context['__patterns']:
            return []

        args = ['es.exe']
        args += context['__arguments']
        args += self.vars['default_opts']
        args += ['-n', str(self.vars['max_results'])]
        args += context['__directory']
        args += context['__patterns']

        self.print_message(context, args)

        context['__proc'] = process.Process(args, context, context['path'])
        return self.__async_gather_candidates(context, 0.5)
    def gather_candidates(self, context):
        if context['event'] == 'interactive':
            # Update input
            self.on_close(context)

            if not context['input']:
                return []

            context['__patterns'] = [
                '.*'.join(util.split_input(context['input']))
            ]

        if context['__proc']:
            return self._async_gather_candidates(context,
                                                 context['async_timeout'])

        if not context['__patterns']:
            return []

        args = [
            'bundle', 'exec', 'i18n_flow', 'search', '--format=oneline',
            '--nocolor'
        ]
        args += context['__patterns']

        self.print_message(context, args)

        context['__config_base_path'] = self._base_path()

        context['__proc'] = process.Process(args, context, context['path'])
        return self._async_gather_candidates(context, 0.5)
Exemple #3
0
    def gather_candidates(self, context: UserContext) -> Candidates:
        if context['event'] == 'interactive':
            # Update input
            self.on_close(context)

            if (not context['input'] or len(context['input']) <
                    self.vars['min_interactive_pattern']):
                return []

            context['__patterns'] = [
                '.*'.join(util.split_input(context['input']))
            ]

        if context['__proc']:
            return self._async_gather_candidates(context,
                                                 context['async_timeout'])

        if not context['__patterns'] or not self.vars['command']:
            return []

        args = self._init_grep_args(context)
        self.print_message(context, args)

        context['__proc'] = process.Process(args, context, context['path'])
        return self._async_gather_candidates(context, 0.5)
Exemple #4
0
    def gather_candidates(self, context: UserContext) -> Candidates:
        if not context['input']:
            return []

        args = self._init_args(context)
        if args == context['__args'] and context['__proc']:
            return self._async_gather_candidates(context, 0.5)

        context['__args'] = args
        self.print_message(context, str(args))

        context['__proc'] = process.Process(args, context, context['path'])
        return self._async_gather_candidates(context, 0.5)
Exemple #5
0
    def gather_candidates(self, context):
        if context['__proc']:
            return self.__async_gather_candidates(context, 0.03)
        if not context['__root']:
            return []
        args = []
        args += ['git', '--git-dir=' + os.path.join(context['__root'], '.git')]
        args += ['--no-pager', 'log']
        args += self.vars['default_opts']
        if len(context['__file']):
            args += ['--', context['__file']]

        self.print_message(context, ' '.join(args))

        context['__proc'] = process.Process(args, context, context['__root'])
        return self.__async_gather_candidates(context, 0.5)
Exemple #6
0
    def gather_candidates(self, context: UserContext) -> Candidates:
        exe = self.vim.call("denite#memo#executable")
        if not exe:
            return []

        if context["args"] and context["args"][0] == "new":
            return self._is_new(context)

        if self.__proc(context):
            return self.__async_gather_candidates(context,
                                                  context["async_timeout"])

        proc = process.Process(
            [exe, "list", "--format", "{{.Fullpath}}\t{{.File}}\t{{.Title}}"],
            context,
            context["path"],
        )
        self.__set_proc(context, proc)
        return self.__async_gather_candidates(context,
                                              context["async_timeout"])
Exemple #7
0
    def gather_candidates(self, context):
        if context['event'] == 'interactive':
            # Update input
            self.on_close(context)

            if (not context['input'] or len(context['input']) <
                    self.vars['min_interactive_pattern']):
                return []

            context['__patterns'] = [
                '.*'.join(util.split_input(context['input']))
            ]

        if context['__proc']:
            return self._async_gather_candidates(context,
                                                 context['async_timeout'])

        if not context['__patterns'] or not self.vars['command']:
            return []

        args = [util.expand(self.vars['command'][0])]
        args += self.vars['command'][1:]
        args += self.vars['default_opts']
        args += self.vars['recursive_opts']
        args += context['__arguments']
        if self.vars['pattern_opt']:
            for pattern in context['__patterns']:
                args += self.vars['pattern_opt'] + [pattern]
            args += self.vars['separator']
        else:
            args += self.vars['separator']
            args += context['__patterns']
        if context['__paths']:
            args += context['__paths']
        else:
            args += self.vars['final_opts']

        self.print_message(context, args)

        context['__proc'] = process.Process(args, context, context['path'])
        return self._async_gather_candidates(context, 0.5)
Exemple #8
0
    def gather_candidates(self, context):
        if context["event"] == "interactive":
            self.on_close(context)
            context["__query"] = context["input"]

        if context["__proc"]:
            return self._async_gather_candidates(context,
                                                 context["async_timeout"])

        if not self.vars["command"]:
            return [{"word": "No hoogle command configured."}]

        args = [util.expand(self.vars["command"][0])]
        args += self.vars["command"][1:]
        args += self.vars["default_opts"]
        args.append("--")
        if context["__query"]:
            args += util.split_input(context["__query"])

        self.print_message(context, args)

        context["__proc"] = process.Process(args, context, context["path"])
        return self._async_gather_candidates(context, 0.5)