neovim-java-client
neovim-java-client copied to clipboard
What needs to be done?
I am interested in contributing to this project. Would it be possible to make a list, perhaps a table, in the Wiki that documents what functions need to be implemented to be 100% compatible with the Neovim API? We could check off the one's that you have already completed. This way I (and potentially others) could contribute without duplicating work but more importantly knowing what needs to be done.
Thanks for starting this project.
I believe that most functions are completed except for vim_get_api_info
and vim_get_color_map
(although most are not tested, so adding tests would be nice). Since vim_get_api_info
isn't read by the program, the extension types for Buffer, Window and TabPage are hardcoded. This should probably change eventually to read the api info. (As suggested in the documentation)
Neovim decided to use the binary type in Message Pack for all strings. Even for strings in the api-info dictionary that is returned by --api-info
and vim_get_api_info
(neovim/neovim#1250). Since we are receiving byte arrays we can't currently deserialize into an object automatically with the FasterXML/jackson-databind. Hopefully, after msgpack/msgpack-java#246, get merged this will be fixed. (msgpack/msgpack-java#244 should also be fixed)
vim_get_color_map
also isn't implemented since neovim Dictionary objects contain byte arrays instead of strings for keys. This should be fixed with the same pull request as before. (This means that anything that returns a Dictionary is broken)
TODO List:
- [ ] Figure out if methods should take
String
orbyte[]
. Currently using a mix of both - [ ] Implement
vim_get_api_info
- [ ] Implement
vim_get_color_map
- [ ] Figure out the proper way to serialize and deserialize extended types. Currently using a patched version (https://github.com/fdinoff/msgpack-java/commit/381414d7425e8eb3e5219fcce2cc0015dbc114f0) to do this and merge into the msgpack-java library (and close msgpack/msgpack-java#238)
- [ ] Expose the notification/request handler to the user of the neovim api.
- [ ] Consider wrapping options and internal variables in classes to hide the Class/TypeReferences from the user. Example https://github.com/fdinoff/neovim-java-client/commit/8e8821f7a612a2cd987ccd620112cce42882d977
- [ ] Figure out how to integrate the neovim abstract gui interface (However I think this is mostly undocumented at the moment)
- [ ] Documentation: Most of this could probably be taken from the comments the neovim source
Thanks for that. That will help. I have a couple of questions...most are just small one's...do you think you could either register this repo with gitter.im for a chat room or shall we use an IRC channel? If you are open to this let me know.
hi man ,i really do not know how to use this api,i have read the readme,but it is better to create a example pulugin project, how to defind a command function or variable,
@wsdjeg I'm not planning on creating an example plugin. I never finished and I assume its out of date by now since I haven't updated it in 4-5 months. I know of a least a couple of api calls that are missing.
The closest thing I have to an example can be found https://github.com/fdinoff/intellij-neovim/tree/scratch (in the scratch branch). I don't know if that repo even builds at the moment but it allowed you to run neovim inside of intellij. (Someone said they got it to work after tweaking it a little, it sounded like they were going to work on something similar)
A screen shot of neovim embed in intellij is below.
This plugin provides a thin wrapper around the msgpack-api and tries to abstract msgpack away so you can work on doing the plugin. The problems with using this plugin in its current state is
- [ ] You can't open a java plugin from neovim with whats currently here. (#4) You need to create a stdin/stdout adaptor so that neovim can talk to this plugin. That should be fairly easy to implement but I haven't done so.
- [ ] I'm not sure I like the API, I tried to use CompletableFutures and I feel it just made it ugly and cumbersome to use.
- [ ] There are some api calls that are missing and they should be rather useful. (Some are implement on branches but not merged into head)
- [ ] Annotations should be added to make the api more like the python one, so that command and be registered on open.
- [ ] probably some other stuff I'm forgetting.
The ways to define a command is to send a string over vim.eval and have it call rpcrequest
or rpcnotify
with the channel_id which can be retrieved from the api_info. However you can't get the channel_id from the code in HEAD. api_info branch can get you that info.
To define a variable in neovim you would also have to use setVar or getVar and pass the name.
Overall I don't recommend using this plugin. If you are going to fork it and update it yourself as I do not plan on updating this any time soon.
thanks , i am not good at coding,i start to learn java from march,now i am using python javabridge conmunicate bwtween vim and java,and it works both well in vim and nvim,maybe it is hard for me to use the api,but I will try to learn more about it.Thank you for such a detailed answer
what is the status of this repo?and what can i do for it?Now I think I have time to work on it!
@wsdjeg Status would be dead. I haven't touched this in months.