1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-28 08:13:17 +03:00

Add neovim version check on startup

This commit is contained in:
George Harker 2023-11-08 09:37:50 -08:00
parent c918c92aad
commit 13bf3b10a9

View File

@ -86,11 +86,23 @@ extension NvimView {
value in
guard let info = value.arrayValue,
info.count == 2,
let channel = info[0].int32Value
let channel = info[0].int32Value,
let dict = info[1].dictionaryValue,
let version = dict["version"]?.dictionaryValue,
let major = version["major"]?.intValue,
let minor = version["minor"]?.intValue
else {
throw RxNeovimApi.Error
.exception(message: "Could not convert values to api info.")
}
guard major >= 0 && minor >= 10 || major >= 1
else {
self.eventsSubject.onNext(.ipcBecameInvalid(
"Incompatible neovim version \(major).\(minor)"))
throw RxNeovimApi.Error
.exception(message: "Could not convert values to api info.")
}
return channel
}).flatMapCompletable({
// FIXME: make lua