-
Hello! So, I'd like to make a Neovim GUI which uses this library, but I'm having trouble getting things working. The code in question is essentially this (written in Kotlin since I prefer it to Java; I've also left out the imports to focus on the code, but let me know if you want those as well): class UiEventSubscriber : Flow.Subscriber<NeovimRedrawEvent> {
override fun onNext(item: NeovimRedrawEvent?) {
println("Notif name: ${item?.notificationName}")
TODO("Not yet implemented")
}
override fun onSubscribe(subscription: Flow.Subscription?) {
TODO("Not yet implemented")
}
override fun onError(throwable: Throwable?) {
TODO("Not yet implemented")
}
override fun onComplete() {
TODO("Not yet implemented")
}
}
fun main() {
val process = ProcessBuilder("nvim", "--embed").start()
val connection = ProcessRpcConnection(process)
val rpcStreamer = ReactiveRpcClient.createDefaultInstance()
rpcStreamer.attach(connection)
val nvim = NeovimStreamApi(rpcStreamer)
val notifHandler = NeovimStreamNotificationHandler(rpcStreamer)
val subscriber = UiEventSubscriber()
notifHandler.uiEvents().subscribe(subscriber)
nvim.attachUi(80, 80, UiOptions.FULL_UI)
nvim.executeCommand("e ~/path/to/file/on/system").thenAccept {
nvim.currentBuffer.thenAccept {
it.getLines(0, -1, false).thenAccept { lines ->
println("${lines.joinToString()}")
}
}
}
} There are two problems I've run into with the above code. First, the Second, there appears to be an issue with
Here's the full stacktrace for the example above (in a gist so as not to make this comment overly long): https://gist.github.com/smolck/e466adee2fd8b91d549468ecb37e8a53 Hopefully these issues are straightforward to fix, because until I know how to fix them I'm not sure I can get to working on this Neovim GUI I'd like to build. Thanks in advance! |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hello! Thank you for reporting this issue. I hope library is usable for you. I have checked out the code you posted in the question and it seems that all issues come from notification handler. I believe there is a bug in library (the stacktrace you posted) which I will try to resolve quickly. Regarding the
Key difference here is usage of I will need to look into issues with notification handlers. Also in the meantime, for future debugging, adding logger implementation to see library logs could be useful to you:
To enable debug logs (which show all responses received from nvim instance), create
I would also recommend using:
Until your GUI has means of handling inputs, since in my case, loading my |
Beta Was this translation helpful? Give feedback.
-
I have released version
Otherwise no events will be received by this subscriber. You can of course request some other value, this requests all future events. |
Beta Was this translation helpful? Give feedback.
Hello! Thank you for reporting this issue. I hope library is usable for you.
I have checked out the code you posted in the question and it seems that all issues come from notification handler. I believe there is a bug in library (the stacktrace you posted) which I will try to resolve quickly.
Regarding the
rpcStreamer
vsNeovimApis
, it is my bad for bad API design. In the meantime you can use a workaround, using code similar toNeovimApis
:Key difference here is usage of
N…