示例#1
0
    class DefxHandlers:

        def __init__(self, vim: vim.Nvim) -> None:
            self._rplugin = Rplugin(vim)

        @vim.function('_defx_init', sync=True)  # type: ignore
        def init_channel(self, args: Args) -> None:
            self._rplugin.init_channel()

        @vim.rpc_export('_defx_start', sync=True)  # type: ignore
        def start(self, args: Args) -> None:
            self._rplugin.start(args)

        @vim.rpc_export('_defx_do_action', sync=True)  # type: ignore
        def do_action(self, args: Args) -> None:
            self._rplugin.do_action(args)

        @vim.rpc_export('_defx_async_action', sync=False)  # type: ignore
        def async_action(self, args: Args) -> None:
            self._rplugin.do_action(args)

        @vim.rpc_export('_defx_get_candidate', sync=True)  # type: ignore
        def get_candidate(self, args: Args
                          ) -> typing.Dict[str, typing.Union[str, bool]]:
            return self._rplugin.get_candidate()

        @vim.rpc_export('_defx_get_context', sync=True)  # type: ignore
        def get_context(self, args: Args) -> typing.Dict[str, typing.Any]:
            return self._rplugin.get_context()
示例#2
0
    class DefxHandlers:
        def __init__(self, vim: vim.Nvim) -> None:
            self._rplugin = Rplugin(vim)

        @vim.function('_defx_init', sync=True)  # type: ignore
        def init_channel(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.init_channel()

        @vim.rpc_export('_defx_start', sync=True)  # type: ignore
        def start(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.start(args)

        @vim.rpc_export('_defx_do_action', sync=True)  # type: ignore
        def do_action(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.do_action(args)

        @vim.rpc_export('_defx_async_action', sync=False)  # type: ignore
        def async_action(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.do_action(args)
示例#3
0
    class DefxHandlers:
        def __init__(self, vim: Nvim) -> None:
            self._rplugin = Rplugin(vim)

        @neovim.function('_defx_init', sync=True)  # type: ignore
        def init_channel(self, args: typing.List) -> None:
            self._rplugin.init_channel()

        @neovim.function('_defx_start', sync=True)  # type: ignore
        def start(self, args: typing.List) -> None:
            self._rplugin.start(args)

        @neovim.function('_defx_do_action', sync=True)  # type: ignore
        def do_action(self, args: typing.List) -> None:
            self._rplugin.do_action(args)
示例#4
0
 def __init__(self, vim: vim.Nvim) -> None:
     self._rplugin = Rplugin(vim)
示例#5
0
        def init_channel(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.init_channel()

        @vim.function('_defx_start', sync=True)  # type: ignore
        def start(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.start(args)

        @vim.function('_defx_do_action', sync=True)  # type: ignore
        def do_action(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.do_action(args)

        @vim.function('_defx_async_action', sync=False)  # type: ignore
        def async_action(self, args: typing.List[typing.Any]) -> None:
            self._rplugin.do_action(args)

if find_spec('yarp'):

    global_defx = Rplugin(vim)

    def _defx_init() -> None:
        pass

    def _defx_start(args: typing.List[typing.Any]) -> None:
        global_defx.start(args)

    def _defx_do_action(args: typing.List[typing.Any]) -> None:
        global_defx.do_action(args)

    def _defx_async_action(args: typing.List[typing.Any]) -> None:
        global_defx.do_action(args)
示例#6
0
        def get_selected_candidates(self,
                                    args: Args) -> typing.List[Candidate]:
            return self._rplugin.get_selected_candidates()

        @vim.rpc_export('_defx_get_context', sync=True)  # type: ignore
        def get_context(self, args: Args) -> typing.Dict[str, typing.Any]:
            return self._rplugin.get_context()

        @vim.rpc_export('_defx_redraw', sync=True)  # type: ignore
        def redraw(self, args: Args) -> None:
            return self._rplugin.redraw(self._rplugin._views)


if find_spec('yarp'):

    global_rplugin = Rplugin(vim)

    def _defx_init() -> None:
        pass

    def _defx_start(args: Args) -> None:
        global_rplugin.start(args)

    def _defx_do_action(args: Args) -> None:
        global_rplugin.do_action(args)

    def _defx_async_action(args: Args) -> None:
        global_rplugin.do_action(args)

    def _defx_get_candidate(args: Args) -> Candidate:
        return global_rplugin.get_candidate()