mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-18 11:11:34 +03:00
Update neovim
This commit is contained in:
parent
161ef1d4f1
commit
a802c75f4d
@ -1 +1 @@
|
||||
Subproject commit 89e2d74d92cd04480e657fa763326be6334c6db4
|
||||
Subproject commit 8250676b389a814cffb3babab3165e02c859c937
|
@ -661,38 +661,6 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func bufGetCommands(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_get_commands", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_get_commands", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func bufSetVar(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
name: String,
|
||||
@ -743,64 +711,6 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func bufGetOption(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_get_option", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_get_option", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func bufSetOption(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.string(name),
|
||||
value,
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func bufGetName(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
errWhenBlocked: Bool = true
|
||||
@ -1073,6 +983,118 @@ extension RxNeovimApi {
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func parseCmd(
|
||||
str: String,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(str),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_parse_cmd", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_parse_cmd", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func cmd(
|
||||
cmd: Dictionary<String, RxNeovimApi.Value>,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<String> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.map(cmd.mapToDict({ (Value.string($0), $1) })),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> String {
|
||||
guard let result = (value.stringValue) else {
|
||||
throw RxNeovimApi.Error.conversion(type: String.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_cmd", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_cmd", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func createUserCommand(
|
||||
name: String,
|
||||
command: RxNeovimApi.Value,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
command,
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_create_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_create_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func delUserCommand(
|
||||
name: String,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_del_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_del_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func bufCreateUserCommand(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
name: String,
|
||||
@ -1125,6 +1147,68 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getCommands(
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_commands", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_commands", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func bufGetCommands(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_get_commands", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_get_commands", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func createNamespace(
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
@ -1422,6 +1506,293 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getOptionValue(
|
||||
name: String,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_option_value", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_option_value", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func setOptionValue(
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
value,
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_set_option_value", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_set_option_value", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getAllOptionsInfo(
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_all_options_info", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_all_options_info", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func getOptionInfo(
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_option_info", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_option_info", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func setOption(
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
value,
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getOption(
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_option", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_option", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func bufGetOption(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_get_option", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_get_option", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func bufSetOption(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.string(name),
|
||||
value,
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func winGetOption(
|
||||
window: RxNeovimApi.Window,
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(window.handle)),
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_win_get_option", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_win_get_option", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func winSetOption(
|
||||
window: RxNeovimApi.Window,
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(window.handle)),
|
||||
.string(name),
|
||||
value,
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_win_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_win_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func tabpageListWins(
|
||||
tabpage: RxNeovimApi.Tabpage,
|
||||
errWhenBlocked: Bool = true
|
||||
@ -2420,177 +2791,6 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getOption(
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_option", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_option", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func getOptionValue(
|
||||
name: String,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_option_value", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_option_value", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func setOptionValue(
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
value,
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_set_option_value", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_set_option_value", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getAllOptionsInfo(
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_all_options_info", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_all_options_info", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func getOptionInfo(
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_option_info", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_option_info", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func setOption(
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
value,
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func echo(
|
||||
chunks: RxNeovimApi.Value,
|
||||
history: Bool,
|
||||
@ -3335,36 +3535,6 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func getCommands(
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_get_commands", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_commands", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func getApiInfo(
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
@ -3724,54 +3894,6 @@ extension RxNeovimApi {
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func createUserCommand(
|
||||
name: String,
|
||||
command: RxNeovimApi.Value,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
command,
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_create_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_create_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func delUserCommand(
|
||||
name: String,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_del_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_del_user_command", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func exec(
|
||||
src: String,
|
||||
output: Bool,
|
||||
@ -3956,70 +4078,6 @@ extension RxNeovimApi {
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func parseCmd(
|
||||
str: String,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Dictionary<String, RxNeovimApi.Value>> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(str),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Dictionary<String, RxNeovimApi.Value> {
|
||||
guard let result = (msgPackDictToSwift(value.dictionaryValue)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Dictionary<String, RxNeovimApi.Value>.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_parse_cmd", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_parse_cmd", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func cmd(
|
||||
cmd: Dictionary<String, RxNeovimApi.Value>,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<String> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.map(cmd.mapToDict({ (Value.string($0), $1) })),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> String {
|
||||
guard let result = (value.stringValue) else {
|
||||
throw RxNeovimApi.Error.conversion(type: String.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_cmd", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_cmd", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func openWin(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
enter: Bool,
|
||||
@ -4406,64 +4464,6 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func winGetOption(
|
||||
window: RxNeovimApi.Window,
|
||||
name: String,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(window.handle)),
|
||||
.string(name),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> RxNeovimApi.Value {
|
||||
guard let result = (Optional(value)) else {
|
||||
throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_win_get_option", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_win_get_option", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func winSetOption(
|
||||
window: RxNeovimApi.Window,
|
||||
name: String,
|
||||
value: RxNeovimApi.Value,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(window.handle)),
|
||||
.string(name),
|
||||
value,
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_win_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_win_set_option", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func winGetPosition(
|
||||
window: RxNeovimApi.Window,
|
||||
errWhenBlocked: Bool = true
|
||||
|
Loading…
Reference in New Issue
Block a user