Skip to content

Conversation

bfredl
Copy link
Member

@bfredl bfredl commented Mar 11, 2016

For neovim/pynvim#183

Eventually I would also like to reduce the need for :UpdateRemotePlugins. The python-client already recalculates the specs everytime a plugin is actually used, it could send them back to neovim, and neovim could check if the specs changed and in that case update init.vim-rplugin in place. For that we should change that file to a machine-readable format like JSON. In the long run we should detect all rplugin update event kinds so :URP never is strictly needed (it can save an extra nvim restart but nvim should be fine without it after a restart or two)

Repo synchronization: neovim/pynvim#183 requires this, but this patch works without that one (:UpdateRemotePlugins gets uglier but it still works)

\ function('provider#pythonx#Require'))
call remote#host#Register('python3', '*.py',
call remote#host#Register('python3', '*',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These 2 lines are the only real change here, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unlet! specs is very real. The others are real as well if we don't want misleading messages.

@justinmk
Copy link
Member

I would also like to reduce the need for :UpdateRemotePlugins

👍 I'd like to completely remove the need for exposing users to it. It should only be something that plug managers do. (In fact, we could hook into :helptags so that even pathogen would have "support" for rplugins...).

update init.vim-rplugin in place. For that we should change that file to a machine-readable format like JSON.

init.vim-rplugin existed before 'shada' was merged. @ZyX-I designed shada to be extensible. We should extend shada to contain rplugin information. No need for a separate file nor a new machine-readable scheme.

@justinmk
Copy link
Member

BTW, LGTM, please merge if RDY.

bfredl added a commit that referenced this pull request Mar 11, 2016
rplugin: let the python host identify packages
@bfredl bfredl merged commit 26d189e into neovim:master Mar 11, 2016
@jszakmeister jszakmeister removed the RFC label Mar 11, 2016
@bfredl
Copy link
Member Author

bfredl commented Mar 11, 2016

Thanks, merged.

And by :UpdateRemotePlugins looking ugly until neovim/pynvim#183 I mean really ugly. Please check that an rplugin is actually broken before reporting an issue.

@bfredl
Copy link
Member Author

bfredl commented Mar 11, 2016

We should extend shada

True, I thoght JSON to make it human readable but we already have an edit plugin for shada... Would it be fine to :wshada behind the users back or could one "commit" a specific section only or maybe we should have a separate rplugin.shada file.

@justinmk
Copy link
Member

Would it be fine to :wshada behind the users back or could one "commit" a specific section only or maybe we should have a separate rplugin.shada file.

It would be fine to write only the rplugin section (unless there is some technical reason I am not aware of). The fact that it's all contained in the same file is a feature. Most users have no idea that init.vim-rplugin exists, nor do they want to learn about a new file name/location/concept--nor should they.

The rplugin section of the shada file would not be "optional" however, any more than we would make init.vim-rplugin optional. We will continue to respect the relevant parts of 'shada' option flags, but this is separate from that.

If user uses nvim -i NONE then they will not get rplugin information, and/or they will need to wait for :UpdateRemotePlugins (or whatever replaces it in the future). This seems reasonable, no? (And, also, this may be considered a feature: ability to tell nvim not to look for init.vim-rplugin file)

@bfredl
Copy link
Member Author

bfredl commented Mar 11, 2016

Sure, I'm not suggesting that we should continue to keep generated data in XDG_CONFIG_HOME : )

This seems reasonable, no?

👍

endfor
echomsg printf("remote/host: %s host registered plugins %s",
\ a:host, string(map(copy(paths), "fnamemodify(v:val, ':t')")))
\ a:host, string(map(registered, "fnamemodify(v:val, ':t')")))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

map() modifies list in-place. It is a good practice to not use copy(list) or list[:] only when you need in-place modification in :call or when you need super optimization, not when it is harmless in the current state of code because it is only harmless in the current state, not outside of :call because it is hard to mention side-effects otherwise and not when your goal is something other then making code that is called really often run a bit faster (I needed such optimizations only for a few thousand calls).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants