1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-12-24 22:33:52 +03:00

Merge remote-tracking branch 'origin/develop' into update-neovim

This commit is contained in:
Tae Won Ha 2017-12-20 21:01:16 +01:00
commit 183b009091
20 changed files with 64 additions and 2895 deletions

View File

@ -218,7 +218,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -278,7 +278,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -308,7 +308,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 252;
DYLIB_CURRENT_VERSION = 254;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = MsgPackRpc/Info.plist;
@ -331,7 +331,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 252;
DYLIB_CURRENT_VERSION = 254;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = MsgPackRpc/Info.plist;

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-252</string>
<string>0.20.2</string>
<key>CFBundleVersion</key>
<string>252</string>
<string>254</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -15,7 +15,6 @@
4B9E33841FCB47F900E0C4BC /* Result.h in Headers */ = {isa = PBXBuildFile; fileRef = 4B9E33801FCB47F900E0C4BC /* Result.h */; };
4B9E33851FCB47F900E0C4BC /* Result.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9E33811FCB47F900E0C4BC /* Result.swift */; };
4B9E33861FCB47F900E0C4BC /* ResultProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4B9E33821FCB47F900E0C4BC /* ResultProtocol.swift */; };
4BEB11931FE52BF6005D4FF6 /* RxSwift.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4BEB11921FE52BF6005D4FF6 /* RxSwift.framework */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -30,7 +29,6 @@
4B9E33811FCB47F900E0C4BC /* Result.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Result.swift; sourceTree = "<group>"; };
4B9E33821FCB47F900E0C4BC /* ResultProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ResultProtocol.swift; sourceTree = "<group>"; };
4BC8843F1FDC6A45000E95A2 /* NvimMsgPack.playground */ = {isa = PBXFileReference; lastKnownFileType = file.playground; path = NvimMsgPack.playground; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.swift; };
4BEB11921FE52BF6005D4FF6 /* RxSwift.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = RxSwift.framework; path = ../Carthage/Build/Mac/RxSwift.framework; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -38,7 +36,6 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
4BEB11931FE52BF6005D4FF6 /* RxSwift.framework in Frameworks */,
4B9E33781FCB476D00E0C4BC /* MsgPackRpc.framework in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
@ -79,7 +76,6 @@
4B9E33771FCB476D00E0C4BC /* Frameworks */ = {
isa = PBXGroup;
children = (
4BEB11921FE52BF6005D4FF6 /* RxSwift.framework */,
4B9E33791FCB476D00E0C4BC /* MsgPackRpc.framework */,
);
name = Frameworks;
@ -222,7 +218,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -282,7 +278,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
CODE_SIGN_IDENTITY = "-";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -312,9 +308,8 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 252;
DYLIB_CURRENT_VERSION = 254;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = NvimMsgPack/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
@ -336,9 +331,8 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 252;
DYLIB_CURRENT_VERSION = 254;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(SRCROOT)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = NvimMsgPack/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-252</string>
<string>0.20.2</string>
<key>CFBundleVersion</key>
<string>252</string>
<string>254</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -5,7 +5,6 @@
import Foundation
import MsgPackRpc
import RxSwift
public class NvimApi {
@ -84,15 +83,12 @@ public class NvimApi {
}
}
public let stream: StreamApi
public init?(at path: String) {
guard let session = Session(at: path) else {
return nil
}
self.session = session
self.stream = StreamApi(session: session)
}
public func connect() throws {
@ -122,38 +118,6 @@ public class NvimApi {
private let session: Session
}
public class StreamApi {
public var scheduler: SchedulerType?
public func rpc(method: String, params: [NvimApi.Value], expectsReturnValue: Bool = true) -> Single<NvimApi.Value> {
let single = Single<NvimApi.Value>.create { single in
let response = self.session.rpc(method: method, params: params, expectsReturnValue: expectsReturnValue)
let disposable = Disposables.create()
guard let value = response.value else {
single(.error(response.error!))
return disposable
}
single(.success(value))
return disposable
}
if let scheduler = self.scheduler {
return single.subscribeOn(scheduler)
}
return single
}
init(session: Session) {
self.session = session
}
let session: Session
}
class Session {
var notificationCallback: NvimApi.NotificationCallback? {

File diff suppressed because it is too large Load Diff

View File

@ -484,7 +484,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -542,7 +542,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
@ -569,7 +569,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 252;
DYLIB_CURRENT_VERSION = 254;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;
@ -591,7 +591,7 @@
COMBINE_HIDPI_IMAGES = YES;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 252;
DYLIB_CURRENT_VERSION = 254;
DYLIB_INSTALL_NAME_BASE = "@rpath";
FRAMEWORK_SEARCH_PATHS = "$(PROJECT_DIR)/../Carthage/Build/Mac";
FRAMEWORK_VERSION = A;

View File

@ -15,9 +15,9 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-252</string>
<string>0.20.2</string>
<key>CFBundleVersion</key>
<string>252</string>
<string>254</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Tae Won Ha. All rights reserved.</string>
<key>NSPrincipalClass</key>

View File

@ -9,7 +9,7 @@
*/
/**
* Extracted from snapshot-131 of MacVim
* Extracted from snapshot-143 of MacVim
* https://github.com/macvim-dev/macvim
* See VIM.LICENSE
*/

View File

@ -35,28 +35,6 @@ extension NvimApi {
}
}
extension StreamApi {
public func getBufGetInfo(
buffer: NvimApi.Buffer
) -> Single<Dictionary<String, NvimApi.Value>> {
let params: [NvimApi.Value] = [
.int(Int64(buffer.handle)),
]
return self
.rpc(method: "nvim_buf_get_info", params: params, expectsReturnValue: true)
.map {
guard let result = (msgPackDictToSwift($0.dictionaryValue)) else {
throw NvimApi.Error.conversion(type: Dictionary<String, NvimApi.Value>.self)
}
return result
}
}
}
func msgPackDictToSwift(_ dict: Dictionary<NvimApi.Value, NvimApi.Value>?) -> Dictionary<String, NvimApi.Value>? {
return dict?.flatMapToDict { k, v in
guard let strKey = k.stringValue else {

View File

@ -32,7 +32,7 @@ extension NvimView {
return Single<NvimView.Buffer>.create { single in
let disposable = Disposables.create()
guard let buf = self.nvim.getCurrentBuf(checkBlocked: false).value else {
guard let buf = self.nvim.getCurrentBuf().value else {
single(.error(NvimView.Error.api("Could not get the current buffer.")))
return disposable
}

View File

@ -159,14 +159,7 @@ public class NvimView: NSView,
}
set {
let path = newValue.path
guard let escapedCwd = self.uiClient.escapedFileName(path) else {
// this happens when VimR is quitting with some main windows open...
self.logger.fault("Escaped file name returned nil.")
return
}
self.nvim.command(command: "cd \(escapedCwd)")
self.nvim.setCurrentDir(dir: newValue.path, expectsReturnValue: false)
}
}
@ -189,7 +182,6 @@ public class NvimView: NSView,
preconditionFailure("Nvim could not be instantiated")
}
nvim.stream.scheduler = self.nvimApiScheduler
self.nvim = nvim
super.init(frame: .zero)

View File

@ -1032,7 +1032,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
@ -1087,7 +1087,7 @@
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 252;
CURRENT_PROJECT_VERSION = 254;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;

View File

@ -27,8 +27,6 @@ class BuffersList: NSView,
self.emit = emitter.typedEmit()
self.uuid = state.uuid
self.genericIcon = FileUtils.icon(forType: "public.data")
self.usesTheme = state.appearance.usesTheme
self.showsFileIcon = state.appearance.showsFileIcon
@ -75,7 +73,6 @@ class BuffersList: NSView,
private var showsFileIcon: Bool
private let bufferList = NSTableView.standardTableView()
private let genericIcon: NSImage
private var buffers = [NvimView.Buffer]()
@ -186,6 +183,8 @@ extension BuffersList {
return FileUtils.icon(forUrl: url)
}
return self.genericIcon
return genericIcon
}
}
private let genericIcon = FileUtils.icon(forType: "public.data")

View File

@ -32,7 +32,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-252</string>
<string>0.20.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
@ -49,7 +49,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>252</string>
<string>254</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.productivity</string>
<key>LSMinimumSystemVersion</key>

View File

@ -15,10 +15,10 @@
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>SNAPSHOT-252</string>
<string>0.20.2</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>252</string>
<string>254</string>
</dict>
</plist>

View File

@ -7,22 +7,30 @@
<description>Most recent changes with links to updates for VimR.</description>
<language>en</language>
<item>
<title>v0.20.1-245</title>
<title>v0.20.2-254</title>
<description><![CDATA[
<ul>
<li>GH-580: Bugfix: Memory leak</li>
<li>GH-571: Bugfix: Read-only buffers are considered as modified. For example NERDTree buffers won't trigger the "Please save first" dialog anymore.</li>
<li>GH-387: Show all buffers (the same as <code>:buffers</code>) in the buffers list</li>
<li>GH-553: Bugfix: Do not crash when there's an error in <code>init.vim</code>.</li>
<li>Improve forward- and reverse-search for Markdown previews.</li>
<li>High Sierra related fixes<ul>
<li>Do not crash on launch</li>
<li>Too narrow entries in the file browser and buffers list.</li>
</ul>
</li>
</ul>
]]></description>
<releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/v0.20.1-245
https://github.com/qvacua/vimr/releases/tag/v0.20.2-254
</releaseNotesLink>
<pubDate>2017-12-08T12:07:29.346478</pubDate>
<pubDate>2017-12-20T20:35:07.385735</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.20.1-245/VimR-v0.20.1-245.tar.bz2"
sparkle:version="245"
sparkle:shortVersionString="0.20.1"
sparkle:dsaSignature="MC0CFQDKlIbLoMqrNmh43vf8lEQnk7MdpwIUFIpMfgGVLzG9dGXGMIp6jf46k2g="
length="14397686"
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.20.2-254/VimR-v0.20.2-254.tar.bz2"
sparkle:version="254"
sparkle:shortVersionString="0.20.2"
sparkle:dsaSignature="MCwCFHB+5VLSUcHRUGqWfI8tg8oRQHXoAhQV0OrZlxLjiA8KUGfHG2VkeGYskg=="
length="11904069"
type="application/octet-stream"/>
</item>
</channel>

View File

@ -7,23 +7,30 @@
<description>Most recent changes with links to updates for VimR.</description>
<language>en</language>
<item>
<title>SNAPSHOT-252</title>
<title>v0.20.2-254</title>
<description><![CDATA[
<ul>
<li>GH-571: Bugfix: Read-only buffers are considered as modified. For example NERDTree buffers won't trigger the "Please save first" dialog anymore.</li>
<li>GH-387: Show all buffers (the same as <code>:buffers</code>) in the buffers list</li>
<li>GH-553: Bugfix: Do not crash when there's an error in <code>init.vim</code>.</li>
<li>Improve forward- and reverse-search for Markdown previews.</li>
<li>Probably the last snapshot before 0.20.2</li>
<li>High Sierra related fixes<ul>
<li>Do not crash on launch</li>
<li>Too narrow entries in the file browser and buffers list.</li>
</ul>
</li>
</ul>
]]></description>
<releaseNotesLink>
https://github.com/qvacua/vimr/releases/tag/snapshot/252
https://github.com/qvacua/vimr/releases/tag/v0.20.2-254
</releaseNotesLink>
<pubDate>2017-12-18T21:57:02.006104</pubDate>
<pubDate>2017-12-20T20:35:07.385735</pubDate>
<minimumSystemVersion>10.10.0</minimumSystemVersion>
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/252/VimR-SNAPSHOT-252.tar.bz2"
sparkle:version="252"
sparkle:shortVersionString="SNAPSHOT-252"
sparkle:dsaSignature="MCwCFHS7jiE8Ac7868kMGYOady6pHU3rAhQb2bipomB2zKAV/8SZrTSEag2n6g=="
length="11975893"
<enclosure url="https://github.com/qvacua/vimr/releases/download/v0.20.2-254/VimR-v0.20.2-254.tar.bz2"
sparkle:version="254"
sparkle:shortVersionString="0.20.2"
sparkle:dsaSignature="MCwCFHB+5VLSUcHRUGqWfI8tg8oRQHXoAhQV0OrZlxLjiA8KUGfHG2VkeGYskg=="
length="11904069"
type="application/octet-stream"/>
</item>
</channel>

View File

@ -92,74 +92,11 @@ func_template = Template('''\
}
''')
func_stream_template = Template('''\
public func ${func_name}(${args}
) -> Single<${result_type}> {
let single = Single<${result_type}>.create { single in
let params: [NvimApi.Value] = [
${params}
]
let response = self.session.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: true)
let disposable = Disposables.create()
guard let value = response.value else {
single(.error(response.error!))
return disposable
}
guard let result = (${return_value}) else {
single(.error(response.error!))
return disposable
}
single(.success(result))
return disposable
}
if let scheduler = self.scheduler {
return single.subscribeOn(scheduler)
}
return single
}
''')
void_func_stream_template = Template('''\
public func ${func_name}(${args}
expectsReturnValue: Bool = true
) -> Single<${result_type}> {
let single = Single<${result_type}>.create { single in
let params: [NvimApi.Value] = [
${params}
]
let response = self.session.rpc(method: "${nvim_func_name}", params: params, expectsReturnValue: expectsReturnValue)
let disposable = Disposables.create()
if let error = response.error {
single(.error(error))
return disposable
}
single(.success(()))
return disposable
}
if let scheduler = self.scheduler {
return single.subscribeOn(scheduler)
}
return single
}
''')
extension_template = Template('''\
// Auto generated for nvim version ${version}.
// See bin/generate_api_methods.py
import MsgPackRpc
import RxSwift
extension NvimApi {
@ -299,13 +236,6 @@ extension Dictionary {
''')
extension_stream_template = Template('''\
extension StreamApi {
$body
}
''')
def snake_to_camel(snake_str):
components = snake_str.split('_')
return components[0] + "".join(x.title() for x in components[1:])
@ -461,21 +391,6 @@ def parse_function(f):
return result
def parse_function_stream(f):
args = parse_args(f['parameters']) if f['return_type'] == 'void' else parse_args(f['parameters'])[:-1]
template = void_func_stream_template if f['return_type'] == 'void' else func_stream_template
result = template.substitute(
func_name=snake_to_camel(f['name'][5:]),
nvim_func_name=f['name'],
args=args,
params=parse_params(f['parameters']),
result_type=nvim_type_to_swift(f['return_type']),
return_value=msgpack_to_swift('value', nvim_type_to_swift(f['return_type']))
)
return result
def parse_version(version):
return '.'.join([str(v) for v in [version['major'], version['minor'], version['patch']]])
@ -507,7 +422,3 @@ if __name__ == '__main__':
window_type=api['types']['Window']['id'],
tabpage_type=api['types']['Tabpage']['id']
))
print(extension_stream_template.substitute(
body='\n'.join([parse_function_stream(f) for f in functions])
))

View File

@ -11,10 +11,10 @@ pushd VimR
# bundle version
agvtool bump -all
BUNDLE_VERSION=$(agvtool what-version | sed '2q;d' | sed -E 's/ +(.+)/\1/')
# marketing version
if [ "${IS_SNAPSHOT}" = true ] ; then
BUNDLE_VERSION=$(agvtool what-version | sed '2q;d' | sed -E 's/ +(.+)/\1/')
MARKETING_VERSION="SNAPSHOT-${BUNDLE_VERSION}"
fi