Cannot declare functions when there is "import" statement
This is my rplugin (actually I just copied from the prototype example)
function MyPlugin(plugin) {
this.plugin = plugin;
plugin.registerFunction('MyFunc', [this, MyPlugin.prototype.func]);
}
MyPlugin.prototype.func = function() {
this.plugin.nvim.setLine('A line, for your troubles');
};
export default MyPlugin;
If I save it to ~/.config/nvim/rplugin/node/myplugin/index.js then run :UpdateRemotePlugins | !cat ~/.local/share/nvim/rplugin.vim, then the result show that the function MyFunc has been registered. But if I just add this line to the top of the file index.js
import { abort } from "process";
Running :UpdateRemotePlugins | !cat ~/.local/share/nvim/rplugin.vim again and it show that the function MyFunc is not registered
Try adding logging in here to see if there are hints about what's failing: https://github.com/neovim/neovim/blob/772f1966a348eb26bc9cb17d45bbdb739642ccdb/runtime/autoload/provider/node.vim#L132
I think it uses cli.js to invoke the remote plugin, the details are not clear because that code is too convoluted.
All of this will be much simpler after https://github.com/neovim/node-client/pull/344