From e1473abac5ca0baa5af7738337abc0301e104e0d Mon Sep 17 00:00:00 2001 From: Tae Won Ha Date: Sun, 17 Dec 2023 21:11:37 +0100 Subject: [PATCH] Generate API methods --- .../RxNeovim/RxNeovimApi.generated.swift | 623 +++++++++++------- 1 file changed, 374 insertions(+), 249 deletions(-) diff --git a/RxPack/Sources/RxNeovim/RxNeovimApi.generated.swift b/RxPack/Sources/RxNeovim/RxNeovimApi.generated.swift index 40f5c8f50..273657039 100644 --- a/RxPack/Sources/RxNeovim/RxNeovimApi.generated.swift +++ b/RxPack/Sources/RxNeovim/RxNeovimApi.generated.swift @@ -1,4 +1,4 @@ -// Auto generated for nvim version 0.9.4. +// Auto generated for nvim version 0.10.0. // See bin/generate_api_methods.py import Foundation @@ -1923,6 +1923,7 @@ extension RxNeovimApi { .map(transform) } + @available(*, deprecated, message: "This method has been deprecated.") public func getOptionInfo( name: String, errWhenBlocked: Bool = true @@ -1953,6 +1954,182 @@ extension RxNeovimApi { .map(transform) } + @available(*, deprecated, message: "This method has been deprecated.") + 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() + } + + @available(*, deprecated, message: "This method has been deprecated.") + public func getOption( + name: String, + errWhenBlocked: Bool = true + ) -> Single { + + let params: [RxNeovimApi.Value] = [ + .string(name), + ] + + let transform = { (_ value: Value) throws -> RxNeovimApi.Value in + 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) + } + + @available(*, deprecated, message: "This method has been deprecated.") + public func bufGetOption( + buffer: RxNeovimApi.Buffer, + name: String, + errWhenBlocked: Bool = true + ) -> Single { + + let params: [RxNeovimApi.Value] = [ + .int(Int64(buffer.handle)), + .string(name), + ] + + let transform = { (_ value: Value) throws -> RxNeovimApi.Value in + 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) + } + + @available(*, deprecated, message: "This method has been deprecated.") + 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() + } + + @available(*, deprecated, message: "This method has been deprecated.") + public func winGetOption( + window: RxNeovimApi.Window, + name: String, + errWhenBlocked: Bool = true + ) -> Single { + + let params: [RxNeovimApi.Value] = [ + .int(Int64(window.handle)), + .string(name), + ] + + let transform = { (_ value: Value) throws -> RxNeovimApi.Value in + 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) + } + + @available(*, deprecated, message: "This method has been deprecated.") + 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 createNamespace( name: String, errWhenBlocked: Bool = true @@ -2249,189 +2426,16 @@ extension RxNeovimApi { .rpc(method: "nvim_set_decoration_provider", params: params, expectsReturnValue: expectsReturnValue) .asCompletable() } - - public func getOptionValue( - name: String, - opts: Dictionary, - errWhenBlocked: Bool = true - ) -> Single { - - let params: [RxNeovimApi.Value] = [ - .string(name), - .map(opts.mapToDict({ (Value.string($0), $1) })), - ] - - let transform = { (_ value: Value) throws -> RxNeovimApi.Value in - 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, - 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> { - - let params: [RxNeovimApi.Value] = [ - - ] - - let transform = { (_ value: Value) throws -> Dictionary in - guard let result = (msgPackDictToSwift(value.dictionaryValue)) else { - throw RxNeovimApi.Error.conversion(type: Dictionary.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 getOptionInfo2( - name: String, - opts: Dictionary, - errWhenBlocked: Bool = true - ) -> Single> { - - let params: [RxNeovimApi.Value] = [ - .string(name), - .map(opts.mapToDict({ (Value.string($0), $1) })), - ] - - let transform = { (_ value: Value) throws -> Dictionary in - guard let result = (msgPackDictToSwift(value.dictionaryValue)) else { - throw RxNeovimApi.Error.conversion(type: Dictionary.self) - } - - return result - } - - if errWhenBlocked { - return self - .checkBlocked( - self.rpc(method: "nvim_get_option_info2", params: params, expectsReturnValue: true) - ) - .map(transform) - } - - return self - .rpc(method: "nvim_get_option_info2", 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 { - - let params: [RxNeovimApi.Value] = [ - .string(name), - ] - - let transform = { (_ value: Value) throws -> RxNeovimApi.Value in - 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, + + public func getOptionValue( name: String, + opts: Dictionary, errWhenBlocked: Bool = true ) -> Single { let params: [RxNeovimApi.Value] = [ - .int(Int64(buffer.handle)), .string(name), + .map(opts.mapToDict({ (Value.string($0), $1) })), ] let transform = { (_ value: Value) throws -> RxNeovimApi.Value in @@ -2445,56 +2449,53 @@ extension RxNeovimApi { if errWhenBlocked { return self .checkBlocked( - self.rpc(method: "nvim_buf_get_option", params: params, expectsReturnValue: true) + self.rpc(method: "nvim_get_option_value", params: params, expectsReturnValue: true) ) .map(transform) } return self - .rpc(method: "nvim_buf_get_option", params: params, expectsReturnValue: true) + .rpc(method: "nvim_get_option_value", params: params, expectsReturnValue: true) .map(transform) } - public func bufSetOption( - buffer: RxNeovimApi.Buffer, + public func setOptionValue( name: String, value: RxNeovimApi.Value, + opts: Dictionary, expectsReturnValue: Bool = false ) -> Completable { let params: [RxNeovimApi.Value] = [ - .int(Int64(buffer.handle)), .string(name), value, + .map(opts.mapToDict({ (Value.string($0), $1) })), ] if expectsReturnValue { return self .checkBlocked( - self.rpc(method: "nvim_buf_set_option", params: params, expectsReturnValue: expectsReturnValue) + self.rpc(method: "nvim_set_option_value", params: params, expectsReturnValue: expectsReturnValue) ) .asCompletable() } return self - .rpc(method: "nvim_buf_set_option", params: params, expectsReturnValue: expectsReturnValue) + .rpc(method: "nvim_set_option_value", params: params, expectsReturnValue: expectsReturnValue) .asCompletable() } - public func winGetOption( - window: RxNeovimApi.Window, - name: String, + public func getAllOptionsInfo( errWhenBlocked: Bool = true - ) -> Single { + ) -> Single> { let params: [RxNeovimApi.Value] = [ - .int(Int64(window.handle)), - .string(name), + ] - let transform = { (_ value: Value) throws -> RxNeovimApi.Value in - guard let result = (Optional(value)) else { - throw RxNeovimApi.Error.conversion(type: RxNeovimApi.Value.self) + let transform = { (_ value: Value) throws -> Dictionary in + guard let result = (msgPackDictToSwift(value.dictionaryValue)) else { + throw RxNeovimApi.Error.conversion(type: Dictionary.self) } return result @@ -2503,40 +2504,46 @@ extension RxNeovimApi { if errWhenBlocked { return self .checkBlocked( - self.rpc(method: "nvim_win_get_option", params: params, expectsReturnValue: true) + self.rpc(method: "nvim_get_all_options_info", params: params, expectsReturnValue: true) ) .map(transform) } return self - .rpc(method: "nvim_win_get_option", params: params, expectsReturnValue: true) + .rpc(method: "nvim_get_all_options_info", params: params, expectsReturnValue: true) .map(transform) } - public func winSetOption( - window: RxNeovimApi.Window, + public func getOptionInfo2( name: String, - value: RxNeovimApi.Value, - expectsReturnValue: Bool = false - ) -> Completable { + opts: Dictionary, + errWhenBlocked: Bool = true + ) -> Single> { let params: [RxNeovimApi.Value] = [ - .int(Int64(window.handle)), .string(name), - value, + .map(opts.mapToDict({ (Value.string($0), $1) })), ] - if expectsReturnValue { + let transform = { (_ value: Value) throws -> Dictionary in + guard let result = (msgPackDictToSwift(value.dictionaryValue)) else { + throw RxNeovimApi.Error.conversion(type: Dictionary.self) + } + + return result + } + + if errWhenBlocked { return self .checkBlocked( - self.rpc(method: "nvim_win_set_option", params: params, expectsReturnValue: expectsReturnValue) + self.rpc(method: "nvim_get_option_info2", params: params, expectsReturnValue: true) ) - .asCompletable() + .map(transform) } return self - .rpc(method: "nvim_win_set_option", params: params, expectsReturnValue: expectsReturnValue) - .asCompletable() + .rpc(method: "nvim_get_option_info2", params: params, expectsReturnValue: true) + .map(transform) } public func tabpageListWins( @@ -2961,6 +2968,30 @@ extension RxNeovimApi { .asCompletable() } + public func uiTermEvent( + event: String, + value: RxNeovimApi.Value, + expectsReturnValue: Bool = false + ) -> Completable { + + let params: [RxNeovimApi.Value] = [ + .string(event), + value, + ] + + if expectsReturnValue { + return self + .checkBlocked( + self.rpc(method: "nvim_ui_term_event", params: params, expectsReturnValue: expectsReturnValue) + ) + .asCompletable() + } + + return self + .rpc(method: "nvim_ui_term_event", params: params, expectsReturnValue: expectsReturnValue) + .asCompletable() + } + public func getHlIdByName( name: String, errWhenBlocked: Bool = true @@ -3049,6 +3080,36 @@ extension RxNeovimApi { .asCompletable() } + public func getHlNs( + opts: Dictionary, + errWhenBlocked: Bool = true + ) -> Single { + + let params: [RxNeovimApi.Value] = [ + .map(opts.mapToDict({ (Value.string($0), $1) })), + ] + + let transform = { (_ value: Value) throws -> Int in + 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_get_hl_ns", params: params, expectsReturnValue: true) + ) + .map(transform) + } + + return self + .rpc(method: "nvim_get_hl_ns", params: params, expectsReturnValue: true) + .map(transform) + } + public func setHlNs( ns_id: Int, expectsReturnValue: Bool = false @@ -4701,6 +4762,38 @@ extension RxNeovimApi { .map(transform) } + public func completeSet( + index: Int, + opts: Dictionary, + errWhenBlocked: Bool = true + ) -> Single> { + + let params: [RxNeovimApi.Value] = [ + .int(Int64(index)), + .map(opts.mapToDict({ (Value.string($0), $1) })), + ] + + let transform = { (_ value: Value) throws -> Dictionary in + guard let result = (msgPackDictToSwift(value.dictionaryValue)) else { + throw RxNeovimApi.Error.conversion(type: Dictionary.self) + } + + return result + } + + if errWhenBlocked { + return self + .checkBlocked( + self.rpc(method: "nvim_complete_set", params: params, expectsReturnValue: true) + ) + .map(transform) + } + + return self + .rpc(method: "nvim_complete_set", params: params, expectsReturnValue: true) + .map(transform) + } + public func exec2( src: String, opts: Dictionary, @@ -5493,6 +5586,38 @@ extension RxNeovimApi { .asCompletable() } + public func winTextHeight( + window: RxNeovimApi.Window, + opts: Dictionary, + errWhenBlocked: Bool = true + ) -> Single> { + + let params: [RxNeovimApi.Value] = [ + .int(Int64(window.handle)), + .map(opts.mapToDict({ (Value.string($0), $1) })), + ] + + let transform = { (_ value: Value) throws -> Dictionary in + guard let result = (msgPackDictToSwift(value.dictionaryValue)) else { + throw RxNeovimApi.Error.conversion(type: Dictionary.self) + } + + return result + } + + if errWhenBlocked { + return self + .checkBlocked( + self.rpc(method: "nvim_win_text_height", params: params, expectsReturnValue: true) + ) + .map(transform) + } + + return self + .rpc(method: "nvim_win_text_height", params: params, expectsReturnValue: true) + .map(transform) + } + @available(*, deprecated, message: "This method has been deprecated.") public func rLineCount( buffer: RxNeovimApi.Buffer, @@ -5836,47 +5961,6 @@ extension RxNeovimApi { .asCompletable() } - @available(*, deprecated, message: "This method has been deprecated.") - public func rAddHighlight( - buffer: RxNeovimApi.Buffer, - ns_id: Int, - hl_group: String, - line: Int, - col_start: Int, - col_end: Int, - errWhenBlocked: Bool = true - ) -> Single { - - let params: [RxNeovimApi.Value] = [ - .int(Int64(buffer.handle)), - .int(Int64(ns_id)), - .string(hl_group), - .int(Int64(line)), - .int(Int64(col_start)), - .int(Int64(col_end)), - ] - - let transform = { (_ value: Value) throws -> Int in - 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: "buffer_add_highlight", params: params, expectsReturnValue: true) - ) - .map(transform) - } - - return self - .rpc(method: "buffer_add_highlight", params: params, expectsReturnValue: true) - .map(transform) - } - @available(*, deprecated, message: "This method has been deprecated.") public func etOption( name: String, @@ -6053,6 +6137,47 @@ extension RxNeovimApi { .asCompletable() } + @available(*, deprecated, message: "This method has been deprecated.") + public func rAddHighlight( + buffer: RxNeovimApi.Buffer, + ns_id: Int, + hl_group: String, + line: Int, + col_start: Int, + col_end: Int, + errWhenBlocked: Bool = true + ) -> Single { + + let params: [RxNeovimApi.Value] = [ + .int(Int64(buffer.handle)), + .int(Int64(ns_id)), + .string(hl_group), + .int(Int64(line)), + .int(Int64(col_start)), + .int(Int64(col_end)), + ] + + let transform = { (_ value: Value) throws -> Int in + 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: "buffer_add_highlight", params: params, expectsReturnValue: true) + ) + .map(transform) + } + + return self + .rpc(method: "buffer_add_highlight", params: params, expectsReturnValue: true) + .map(transform) + } + @available(*, deprecated, message: "This method has been deprecated.") public func geGetWindows( tabpage: RxNeovimApi.Tabpage,