mirror of
https://github.com/qvacua/vimr.git
synced 2024-12-24 22:33:52 +03:00
Update neovim
This commit is contained in:
parent
bf89439ad4
commit
52ae48be2a
@ -1 +1 @@
|
||||
Subproject commit c503e4192cfc293eb60b708ace175ee8fd6438d4
|
||||
Subproject commit bc7937e337e3c5233092949d33dd6cc09165a59c
|
@ -41,6 +41,190 @@ extension RxNeovimApi {
|
||||
|
||||
extension RxNeovimApi {
|
||||
|
||||
public func getAutocmds(
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<RxNeovimApi.Value> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.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_autocmds", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_get_autocmds", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func createAutocmd(
|
||||
event: RxNeovimApi.Value,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Int> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
event,
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Int {
|
||||
guard let result = ((value.int64Value == nil ? nil : Int(value.int64Value!))) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Int.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_create_autocmd", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_create_autocmd", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func delAutocmd(
|
||||
id: Int,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(id)),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_del_autocmd", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_del_autocmd", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func createAugroup(
|
||||
name: String,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<Int> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> Int {
|
||||
guard let result = ((value.int64Value == nil ? nil : Int(value.int64Value!))) else {
|
||||
throw RxNeovimApi.Error.conversion(type: Int.self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_create_augroup", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_create_augroup", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func delAugroupById(
|
||||
id: Int,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(id)),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_del_augroup_by_id", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_del_augroup_by_id", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func delAugroupByName(
|
||||
name: String,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.string(name),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_del_augroup_by_name", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_del_augroup_by_name", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func doAutocmd(
|
||||
event: RxNeovimApi.Value,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
expectsReturnValue: Bool = false
|
||||
) -> Completable {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
event,
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
if expectsReturnValue {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_do_autocmd", params: params, expectsReturnValue: expectsReturnValue)
|
||||
)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_do_autocmd", params: params, expectsReturnValue: expectsReturnValue)
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func bufLineCount(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
errWhenBlocked: Bool = true
|
||||
@ -233,6 +417,46 @@ extension RxNeovimApi {
|
||||
.asCompletable()
|
||||
}
|
||||
|
||||
public func bufGetText(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
start_row: Int,
|
||||
start_col: Int,
|
||||
end_row: Int,
|
||||
end_col: Int,
|
||||
opts: Dictionary<String, RxNeovimApi.Value>,
|
||||
errWhenBlocked: Bool = true
|
||||
) -> Single<[String]> {
|
||||
|
||||
let params: [RxNeovimApi.Value] = [
|
||||
.int(Int64(buffer.handle)),
|
||||
.int(Int64(start_row)),
|
||||
.int(Int64(start_col)),
|
||||
.int(Int64(end_row)),
|
||||
.int(Int64(end_col)),
|
||||
.map(opts.mapToDict({ (Value.string($0), $1) })),
|
||||
]
|
||||
|
||||
func transform(_ value: Value) throws -> [String] {
|
||||
guard let result = (value.arrayValue?.compactMap({ v in v.stringValue })) else {
|
||||
throw RxNeovimApi.Error.conversion(type: [String].self)
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
if errWhenBlocked {
|
||||
return self
|
||||
.checkBlocked(
|
||||
self.rpc(method: "nvim_buf_get_text", params: params, expectsReturnValue: true)
|
||||
)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
return self
|
||||
.rpc(method: "nvim_buf_get_text", params: params, expectsReturnValue: true)
|
||||
.map(transform)
|
||||
}
|
||||
|
||||
public func bufGetOffset(
|
||||
buffer: RxNeovimApi.Buffer,
|
||||
index: Int,
|
||||
|
Loading…
Reference in New Issue
Block a user