neovim / node-client

Nvim Node.js client and plugin host
https://neovim.io/node-client/
MIT License
492 stars 53 forks source link

Extended marks support #170

Closed hoschi closed 10 months ago

hoschi commented 3 years ago

Do I miss something or is the support for extended marks missing? From the Neovim docs I would expect that Buffer gets new methods/properties, e.g. setExtmark().

mhinz commented 3 years ago

Unfortunately, this repo isn't very well maintained at the moment. If you'd like to help out and add support for the latest Nvim features, I'd gladly give you write access.

hoschi commented 3 years ago

Sadly I haven't time either :(

smolck commented 3 years ago

@mhartington Are you familiar with how new APIs like this are generated with this library? I'd like to update this but can't seem to find how that's done.

mhartington commented 3 years ago

APIs from the library have a mapping back to the original nvim API.

so things like nvim_buf_set_extmark(0, g:mark_ns, 0, 0, 2, {})

Would probably be implemented like setLines

https://github.com/neovim/node-client/blob/master/packages/neovim/src/api/Buffer.ts#L103-L125

 setExtMark(nameSpace, line, col, opts = {}) {
    return this.request(`${this.prefix}set_extmark`, [
      this,
      nameSpace,
      line,
      col,
      opts,
    ]);
  }

The main take away is that each method in the classes must map back to an API from neovim.

smolck commented 3 years ago

Right, but are those written by hand and not generated (via reading the output from $ nvim --api-info)?

mhartington commented 3 years ago

Correct, they are written by hand. I'm not sure there was ever a way to generate the API programmatically.

smolck commented 3 years ago

Okay, thank you! I think I might write something to generate them then . . .

billyvg commented 3 years ago

I think there is (or was) a script to generate the TS interfaces.

I haven't had much time to work on this, but I wanted to have some automation to compare against the neovim API and create GH issues for missing methods.

justinmk commented 1 year ago

See https://github.com/neovim/node-client/pull/199#issuecomment-1628814410

Nvim APIs from node-client should be auto-generated. Anything else is not sustainable.

Meanwhile, clients can use neovim.request('nvim_buf_get_extmarks', [...]) and any other :help api function using neovim.request().