Skip to content

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented May 13, 2017

Currently works only in the following scenario: when the user starts the host by calling some already registered plugin, or starts a not started plugin in a running host, the host is allowed to send back updated specs, for all or some subset of already registered plugins, which updates the registration file and takes effect in real time.

goals, not necessarily in this PR, but should be made possible to implement in a forward compatible fashion with out breaking compatibility either way:

  • nvim at startup detecting specs are out of date and start the host and asks for updated specs
  • even if the host is already running, if a new plugin is installed, ask the host to load it and return specs for the new plugin
  • the host can take initiative to reload an already running plugin, and update its specs
  • use timestamps in the registration file so old specs don't overwrite new (reuse shada logic?)
  • Figure out the right time points load errors should be shown to the user.
  • nvim should do what the user asks it, never reply with confusing error messages like "host x is already running", "plugin x is already registered"

There is probably some relevant discussion from 2015 to reread...

python-client branch

@bfredl
Copy link
Member Author

bfredl commented May 13, 2017

I wonder if there should be some versioning of the nvim <-> host interface. Or perhaps nvim can ask the host for a list of capabilities (same as request names in most cases) rpcrequest(host, "capabilities") -> ["plugin_change_notify", "add_plugin", "try_reload_plugin", ...]

@bfredl
Copy link
Member Author

bfredl commented May 13, 2017

refs #5532 #4439 #4438

@justinmk
Copy link
Member

Or perhaps nvim can ask the host for a list of capabilities (same as request names in most cases)

More generally, some convention which identifies each channel (host, UI, or any other client) with at least a client name (like a user agent string) would be valuable. At least for error reporting, maybe also for UI configuration.

@bfredl
Copy link
Member Author

bfredl commented May 13, 2017

Yes, something like nvim_get_api_info, but in reverse.

@justinmk
Copy link
Member

The simplest thing might be to add a voluntary API function, e.g. nvim_set_channel_info. Then, even clients that aren't prepared to receive requests can still provide info.

We could also have a field in the nvim_ui_attach options that invites this info for UI clients.

@bfredl
Copy link
Member Author

bfredl commented May 14, 2017

That could work to implement this and be compatible with existing hosts. To still be able to get rid off "poll" #5856 and do it all async, we would need some kind of callback or autocommand, i e replace the poll command with

exe "autocmd OnChannelInfo "..host.channel.." call RegisterHostInfo("..host.name..")"

@bfredl bfredl changed the title [WIP] let remote plugins update their specs [WIP] let remote hosts update their specs May 14, 2017
@Shougo
Copy link
Contributor

Shougo commented May 15, 2017

The feature also works for delayed loading plugins?

@bfredl
Copy link
Member Author

bfredl commented May 15, 2017

You mean not load all plugins in the host at once? The PR doesn't do it, but it is forward compatible with either nvim or the host doing it later.

@Shougo
Copy link
Contributor

Shougo commented May 15, 2017

You mean not load all plugins in the host at once?

Yes.

@bfredl
Copy link
Member Author

bfredl commented May 25, 2017

updated on top of #6743

@dundargoc dundargoc removed the WIP label Feb 7, 2023
@zeertzjq zeertzjq added the remote-plugin plugins as RPC coprocesses (node.js, python, etc) label Mar 20, 2023
@dundargoc dundargoc changed the title [WIP] let remote hosts update their specs let remote hosts update their specs Apr 2, 2023
@justinmk
Copy link
Member

justinmk commented Mar 20, 2024

Yes, something like nvim_get_api_info, but in reverse.

We can avoid that by simply requiring remote plugins to ship a lua/foo.lua file which defines commands/functions that call to the plugin's remote plugins. If that's too cumbersome, let's make it not cumbersome by enhancing the Lua stdlib once instead of adding tons of redundant code in every "remote plugin host". Then API clients can be much, much simpler.

@justinmk justinmk closed this Mar 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
remote-plugin plugins as RPC coprocesses (node.js, python, etc)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants