Xi-editor: watch plugin dir for new files, load/reload new or changed plugins

Created on 7 Nov 2018  路  5Comments  路  Source: xi-editor/xi-editor

This is not high priority, but would be nice to have.

enhancement help wanted plugins

All 5 comments

Could you please elaborate on this issue? I would love to work on this one :+1:

@daubaris sure!

We have a mechanism whereby we can watch certain directories and files to receive notifications when they change. You can take a look at how this currently works by starting in tabs.rs, with the handle_fs_events function. Basically we register to receive notifications for some group of files/directories, and for each registration we associate a token; then we get a callback with that token when something changes in the watched files, and then we can go and see what's changed and behave accordingly.

The trickier part is that our current plugin support is _very_ hacky, so the actual loading/reloading will be inelegant; but you should poke around at how we currently load plugins, and get a feel for that, and that will give you some idea of how you can procede?

@cmyr sure! I'll sniff around first.

Also, I want to find out more about the expected end goal of this task as the title is a bit confusing (sorry about the inconvenience):
watch plugin dir for new files - (not quite sure what is expected)
load/reload new or changed plugins - think about how to load and reload the plugins?

Yea, this is a bit vague. Basically:

  • if a new directory gets added to the plugin folder, try to load it as a plugin.
  • if a file _changes_ in the plugin folder, figure out if it's part of an existing plugin; if it is, we want to shutdown that plugin if it is running, and then launch it again.

@cmyr It seems this has been implemented in 02b865393c785a77ef6beaced0c15c54e697f674 if I am not mistaken.

Was this page helpful?
0 / 5 - 0 ratings