node-client icon indicating copy to clipboard operation
node-client copied to clipboard

Extended marks support

Open hoschi opened this issue 3 years ago • 9 comments

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().

hoschi avatar Apr 27 '21 09:04 hoschi

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.

mhinz avatar May 11 '21 13:05 mhinz

Sadly I haven't time either :(

hoschi avatar May 11 '21 13:05 hoschi

@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.

smolck avatar Jun 01 '21 15:06 smolck

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.

mhartington avatar Jun 01 '21 16:06 mhartington

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

smolck avatar Jun 01 '21 16:06 smolck

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

mhartington avatar Jun 01 '21 16:06 mhartington

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

smolck avatar Jun 01 '21 16:06 smolck

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.

billyvg avatar Jun 01 '21 16:06 billyvg

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().

justinmk avatar Jul 10 '23 11:07 justinmk