neovim/node-host

Refactor node-host/node-client

billyvg opened this issue · 2 comments

I've been working on refactoring these packages the last few days and wanted to get feedback. Here's what I'm thinking/been doing:

node-host becomes just a vim plugin that closely resembles the ruby/py providers: https://github.com/billyvg/node-host/blob/refactor-neovim-host-package/autoload/provider/node.vim

node-client is a required package handled by npm that installs a binary neovim-node-host that node-host checks for. We can also add health checks for this package.

node-client then becomes more similar to the related python/ruby neovim client packages that handle being the host as well as providing API bindings. I know decorators are going through issues in the spec, but shrugs we have babel. We can have an API similar to the python library for plugin definitions:

import { Plugin, Function, AutoCommand } from 'neovim-client/plugin';

@Plugin
export default class JestPlugin {
  constructor(nvim) {
    this.nvim = nvim;
  }

  @Function('_jest_load')
  init(nvim, args, done) {
    console.log('jest load');
  }

  @Function('_jest_test', { sync: true })
  test2(nvim, args) {
    console.log('jest_test2', args);
  }
}

This way we don't need to inject a global plugin variable.

I was thinking something similar! Kind of felt odd that python's bindings were so much more user friendly than the node-host.

Another idea, after checking out the python implementation would be to create a PR to neovim proper. This way, node-host would become obsolete. The host would be part of the of nvim, just like python and ruby.

node-host becomes just a vim plugin that closely resembles the ruby/py providers: https://github.com/billyvg/node-host/blob/refactor-neovim-host-package/autoload/provider/node.vim

Yes, that's needed. Just a matter of someone sending the patch.

node-client then becomes more similar to the related python/ruby neovim client packages that handle being the host as well as providing API bindings

👍