medek / neovim-qt

My shot at neovim RPC using Qt

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A library to talk with neovim in Qt

Build

$ mkdir build
$ cd build
$ cmake ..

Design

The NeovimConnector class is used to setup the connection to Neovim. It also provides you with some VERY low level methods to call RPC functions - but in general you should be using the QObject returned by NeovimConnector::neovimObject()

  1. To call a function just call the corresponding slot - slots have the same names as the original neovim functions - these are async (return void)
  2. To get the result of the call catch the corresponding signals, by convention these signals are named 'on_' + slot_name
  3. The Neovim() class is automagically generated from the Neovim metadata
  4. For Neovim functions that take the Object type we use QVariant, this seems to be the natural equivalent in Qt
  5. To catch Neovim Notifications you can connect to the Neovim::neovimNotification signal

Requirements

  • Qt5
  • libmsgpack (with support for BIN/STR)
  • Neovim

Update the RPC bindings

Part of the code is autogenerated by calling Neovim to get the API metadata, and generating C++ code. This is done using a python script (generate_bindings.py) if you just want to use neovim-qt as is you don't need to worry about this, I already include the generated code in the repository.

The bindings source templates are stored under the bindings/ folder the generated code is in src/auto/.

To generate the bindings yourself you need

  • python
  • python-msgpack
  • jinja2

Just run make bindings.

TODO

A crapload of them

  • Error checking (start with the QIODevice related errros)
  • We can be more pedantic about argcount in startRequest
  • I currently do not implement synchronous calls, I suppose it would be possible to generate more code to do it using QEventLoop
  • Make it pretty, i.e. hide msgpack internals, PIMPL the NeovimConnector/Function class, etc

About

My shot at neovim RPC using Qt

License:ISC License


Languages

Language:C++ 92.9%Language:Python 4.3%Language:CMake 1.6%Language:C 1.3%