From 3c092a06876d3c2b6da495925fc40cad205cfa43 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Mon, 10 Dec 2018 09:54:35 +0530 Subject: [PATCH 01/18] Added Toggle Tail config in Debug. --- Sources/XiEditor/AppDelegate.swift | 13 +++++++++++++ Sources/XiEditor/Main.storyboard | 13 +++++++++++++ Sources/XiEditor/XiCore.swift | 6 ++++++ 3 files changed, 32 insertions(+) diff --git a/Sources/XiEditor/AppDelegate.swift b/Sources/XiEditor/AppDelegate.swift index 8da65283..132ede52 100644 --- a/Sources/XiEditor/AppDelegate.swift +++ b/Sources/XiEditor/AppDelegate.swift @@ -102,6 +102,15 @@ class AppDelegate: NSObject, NSApplicationDelegate, XiClient { updateRpcTracingConfig(newValue) } } + + @objc dynamic var toggleTail : Bool { + get { + return false + } + set { + updateToggleTailConfig(newValue) + } + } var textMetrics: TextDrawingMetrics { get { @@ -490,6 +499,10 @@ class AppDelegate: NSObject, NSApplicationDelegate, XiClient { func updateRpcTracingConfig(_ enabled: Bool) { xiCore?.tracingConfig(enabled: enabled) } + + func updateToggleTailConfig(_ enabled: Bool) { + xiCore?.toggleTailConfig(enabled: enabled) + } @IBAction func writeTrace(_ sender: AnyObject) { let pid = getpid() diff --git a/Sources/XiEditor/Main.storyboard b/Sources/XiEditor/Main.storyboard index 7814f3b7..65c51db8 100644 --- a/Sources/XiEditor/Main.storyboard +++ b/Sources/XiEditor/Main.storyboard @@ -1187,6 +1187,18 @@ Gw + + + + + + + + + + + + @@ -1212,6 +1224,7 @@ Gw + diff --git a/Sources/XiEditor/XiCore.swift b/Sources/XiEditor/XiCore.swift index dd120d58..ea38d00a 100644 --- a/Sources/XiEditor/XiCore.swift +++ b/Sources/XiEditor/XiCore.swift @@ -48,6 +48,8 @@ protocol XiCore: class { /// `Document` calls are migrated to it's own protocol. func sendRpcAsync(_ method: String, params: Any, callback: RpcCallback?) func sendRpc(_ method: String, params: Any) -> RpcResult + /// Will tail opened file if enabled. + func toggleTailConfig(enabled: Bool) } final class CoreConnection: XiCore { @@ -109,6 +111,10 @@ final class CoreConnection: XiCore { let params = ["destination": destination, "frontend_samples": frontendSamples] as AnyObject sendRpcAsync("save_trace", params: params) } + + func toggleTailConfig(enabled: Bool) { + sendRpcAsync("toggle_tail", params: ["enabled": enabled]) + } func sendRpcAsync(_ method: String, params: Any, callback: RpcCallback? = nil) { rpcSender.sendRpcAsync(method, params: params, callback: callback) From c60564ef733e68243ed02cc1af5d5e47a1a2dba0 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Fri, 14 Dec 2018 10:38:34 +0530 Subject: [PATCH 02/18] Refactoring and test case as per @mmatoszko comments. --- Sources/XiEditor/AppDelegate.swift | 2 +- Tests/XiEditorTests/XiCoreTests.swift | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Sources/XiEditor/AppDelegate.swift b/Sources/XiEditor/AppDelegate.swift index 132ede52..78e35a46 100644 --- a/Sources/XiEditor/AppDelegate.swift +++ b/Sources/XiEditor/AppDelegate.swift @@ -500,7 +500,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, XiClient { xiCore?.tracingConfig(enabled: enabled) } - func updateToggleTailConfig(_ enabled: Bool) { + private func updateToggleTailConfig(_ enabled: Bool) { xiCore?.toggleTailConfig(enabled: enabled) } diff --git a/Tests/XiEditorTests/XiCoreTests.swift b/Tests/XiEditorTests/XiCoreTests.swift index 1907f1c0..b738eb25 100644 --- a/Tests/XiEditorTests/XiCoreTests.swift +++ b/Tests/XiEditorTests/XiCoreTests.swift @@ -89,6 +89,14 @@ class CoreRPCTests: XCTestCase { let expected = SaveTraceTestRPCCall(method: "save_trace", keys: ["destination", "frontend_samples"], callback: nil) XCTAssertEqual(expected, connection.calls.first) } + + func testTailToggleConfigEnabled() { + let connection = TestConnection() + let xiCore = CoreConnection(rpcSender: connection) + xiCore.toggleTailConfig(enabled: true) + let expected = TestRPCCall(method: "toggle_tail", params: ["enabled": true], callback: nil) + XCTAssertEqual(expected, connection.calls.first) + } } class PluginRPCTests: XCTestCase { From 335e0c1ead293aa2b7820cdd47295f0ebe3ff9e5 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sun, 3 Feb 2019 17:05:01 -0500 Subject: [PATCH 03/18] Allowing each file to be tailed. --- Sources/XiEditor/AppDelegate.swift | 13 ------------- Sources/XiEditor/EditViewController.swift | 23 +++++++++++++++++++++++ Sources/XiEditor/Main.storyboard | 10 ++-------- Sources/XiEditor/XiCore.swift | 6 +++--- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/Sources/XiEditor/AppDelegate.swift b/Sources/XiEditor/AppDelegate.swift index 78e35a46..8da65283 100644 --- a/Sources/XiEditor/AppDelegate.swift +++ b/Sources/XiEditor/AppDelegate.swift @@ -102,15 +102,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, XiClient { updateRpcTracingConfig(newValue) } } - - @objc dynamic var toggleTail : Bool { - get { - return false - } - set { - updateToggleTailConfig(newValue) - } - } var textMetrics: TextDrawingMetrics { get { @@ -499,10 +490,6 @@ class AppDelegate: NSObject, NSApplicationDelegate, XiClient { func updateRpcTracingConfig(_ enabled: Bool) { xiCore?.tracingConfig(enabled: enabled) } - - private func updateToggleTailConfig(_ enabled: Bool) { - xiCore?.toggleTailConfig(enabled: enabled) - } @IBAction func writeTrace(_ sender: AnyObject) { let pid = getpid() diff --git a/Sources/XiEditor/EditViewController.swift b/Sources/XiEditor/EditViewController.swift index 345e9930..45561f5d 100644 --- a/Sources/XiEditor/EditViewController.swift +++ b/Sources/XiEditor/EditViewController.swift @@ -141,6 +141,8 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc updateLanguageMenu() } } + + var isTailEnabled: Bool = false // used to calculate the gutter width. Initial -1 so that a new document // still triggers update of gutter width. @@ -683,6 +685,20 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc document.xiCore.setTheme(themeName: sender.title) } + fileprivate func toggleTailMenuItem(_ sender: NSMenuItem) { + if self.isTailEnabled { + sender.state = NSControl.StateValue.on + } else { + sender.state = NSControl.StateValue.off + } + } + + @IBAction func debugToggleTail(_ sender: NSMenuItem) { + self.isTailEnabled.toggle() + toggleTailMenuItem(sender) + document.xiCore.toggleTailConfig(identifier: document.coreViewIdentifier!, enabled: self.isTailEnabled) + } + @IBAction func debugSetLanguage(_ sender: NSMenuItem) { guard sender.state != NSControl.StateValue.on else { print("language already active"); return } document.xiCore.setLanguage(identifier: document.coreViewIdentifier!, languageName: sender.title) @@ -806,11 +822,18 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc item.state = findViewController.showMultipleSearchQueries ? .on : .off } + func updateTailMenu() { + let toggleTailSubMenu = NSApplication.shared.mainMenu!.item(withTitle: "Debug")!.submenu!.item(withTitle: "Tail File") + + toggleTailMenuItem(toggleTailSubMenu!) + } + // Gets called when active window changes func updateMenuState() { updatePluginMenu() updateLanguageMenu() updateFindMenu() + updateTailMenu() } @objc func handleCommand(_ sender: NSMenuItem) { diff --git a/Sources/XiEditor/Main.storyboard b/Sources/XiEditor/Main.storyboard index 65c51db8..59036b1e 100644 --- a/Sources/XiEditor/Main.storyboard +++ b/Sources/XiEditor/Main.storyboard @@ -1187,16 +1187,10 @@ Gw - + - - - - - - - + diff --git a/Sources/XiEditor/XiCore.swift b/Sources/XiEditor/XiCore.swift index ea38d00a..e8ae4099 100644 --- a/Sources/XiEditor/XiCore.swift +++ b/Sources/XiEditor/XiCore.swift @@ -49,7 +49,7 @@ protocol XiCore: class { func sendRpcAsync(_ method: String, params: Any, callback: RpcCallback?) func sendRpc(_ method: String, params: Any) -> RpcResult /// Will tail opened file if enabled. - func toggleTailConfig(enabled: Bool) + func toggleTailConfig(identifier: ViewIdentifier, enabled: Bool) } final class CoreConnection: XiCore { @@ -112,8 +112,8 @@ final class CoreConnection: XiCore { sendRpcAsync("save_trace", params: params) } - func toggleTailConfig(enabled: Bool) { - sendRpcAsync("toggle_tail", params: ["enabled": enabled]) + func toggleTailConfig(identifier: ViewIdentifier, enabled: Bool) { + sendRpcAsync("toggle_tail", params: ["view_id": identifier, "enabled": enabled]) } func sendRpcAsync(_ method: String, params: Any, callback: RpcCallback? = nil) { From 7a1ae5963031af0ba8677b10ee9c6fcfa91aab97 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sun, 3 Feb 2019 17:34:59 -0500 Subject: [PATCH 04/18] Complementing toggleTail flag instead of calling .toggle() because Travis build failed. --- Sources/XiEditor/EditViewController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sources/XiEditor/EditViewController.swift b/Sources/XiEditor/EditViewController.swift index 45561f5d..c052e382 100644 --- a/Sources/XiEditor/EditViewController.swift +++ b/Sources/XiEditor/EditViewController.swift @@ -694,7 +694,7 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc } @IBAction func debugToggleTail(_ sender: NSMenuItem) { - self.isTailEnabled.toggle() + self.isTailEnabled = !self.isTailEnabled toggleTailMenuItem(sender) document.xiCore.toggleTailConfig(identifier: document.coreViewIdentifier!, enabled: self.isTailEnabled) } From b374473a888ff4efdba29175bb08145471c1e5a6 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sun, 3 Feb 2019 17:47:24 -0500 Subject: [PATCH 05/18] Removing test case as core doesn't return us anything. --- Tests/XiEditorTests/XiCoreTests.swift | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Tests/XiEditorTests/XiCoreTests.swift b/Tests/XiEditorTests/XiCoreTests.swift index b738eb25..1907f1c0 100644 --- a/Tests/XiEditorTests/XiCoreTests.swift +++ b/Tests/XiEditorTests/XiCoreTests.swift @@ -89,14 +89,6 @@ class CoreRPCTests: XCTestCase { let expected = SaveTraceTestRPCCall(method: "save_trace", keys: ["destination", "frontend_samples"], callback: nil) XCTAssertEqual(expected, connection.calls.first) } - - func testTailToggleConfigEnabled() { - let connection = TestConnection() - let xiCore = CoreConnection(rpcSender: connection) - xiCore.toggleTailConfig(enabled: true) - let expected = TestRPCCall(method: "toggle_tail", params: ["enabled": true], callback: nil) - XCTAssertEqual(expected, connection.calls.first) - } } class PluginRPCTests: XCTestCase { From b0958ae87a00eddc4f4578d98790cb82c6e72132 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sun, 3 Feb 2019 20:50:39 -0500 Subject: [PATCH 06/18] Core needs to send toggle tail config changed notification to client. --- Sources/XiEditor/AppDelegate.swift | 7 ++++++ Sources/XiEditor/Client.swift | 3 +++ Sources/XiEditor/EditViewController.swift | 28 ++++++++++++----------- Sources/XiEditor/RPCSending.swift | 8 +++++++ Sources/XiEditor/XiCore.swift | 1 + 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Sources/XiEditor/AppDelegate.swift b/Sources/XiEditor/AppDelegate.swift index 8da65283..6265c66d 100644 --- a/Sources/XiEditor/AppDelegate.swift +++ b/Sources/XiEditor/AppDelegate.swift @@ -407,6 +407,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, XiClient { document?.editViewController?.replaceStatus(status: status) } } + + func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { + DispatchQueue.main.async { [weak self] in + let document = self?.documentForViewIdentifier(viewIdentifier: viewIdentifier) + document?.editViewController?.toggleTailConfigChanged(isTailEnabled) + } + } //MARK: - top-level interactions @IBAction func openPreferences(_ sender: NSMenuItem) { diff --git a/Sources/XiEditor/Client.swift b/Sources/XiEditor/Client.swift index e897b70e..e2d21d2e 100644 --- a/Sources/XiEditor/Client.swift +++ b/Sources/XiEditor/Client.swift @@ -86,4 +86,7 @@ protocol XiClient: AnyObject { /// A notification containing the current replace status. func replaceStatus(viewIdentifier: String, status: [String: AnyObject]) + + /// A notification telling toggle tail config was successfully changed. + func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) } diff --git a/Sources/XiEditor/EditViewController.swift b/Sources/XiEditor/EditViewController.swift index c052e382..51802a73 100644 --- a/Sources/XiEditor/EditViewController.swift +++ b/Sources/XiEditor/EditViewController.swift @@ -142,7 +142,11 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc } } - var isTailEnabled: Bool = false + var isTailEnabled: Bool = false { + didSet { + updateTailMenu() + } + } // used to calculate the gutter width. Initial -1 so that a new document // still triggers update of gutter width. @@ -685,18 +689,8 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc document.xiCore.setTheme(themeName: sender.title) } - fileprivate func toggleTailMenuItem(_ sender: NSMenuItem) { - if self.isTailEnabled { - sender.state = NSControl.StateValue.on - } else { - sender.state = NSControl.StateValue.off - } - } - @IBAction func debugToggleTail(_ sender: NSMenuItem) { - self.isTailEnabled = !self.isTailEnabled - toggleTailMenuItem(sender) - document.xiCore.toggleTailConfig(identifier: document.coreViewIdentifier!, enabled: self.isTailEnabled) + document.xiCore.toggleTailConfig(identifier: document.coreViewIdentifier!, enabled: !self.isTailEnabled) } @IBAction func debugSetLanguage(_ sender: NSMenuItem) { @@ -825,7 +819,11 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc func updateTailMenu() { let toggleTailSubMenu = NSApplication.shared.mainMenu!.item(withTitle: "Debug")!.submenu!.item(withTitle: "Tail File") - toggleTailMenuItem(toggleTailSubMenu!) + if self.isTailEnabled { + toggleTailSubMenu!.state = NSControl.StateValue.on + } else { + toggleTailSubMenu!.state = NSControl.StateValue.off + } } // Gets called when active window changes @@ -908,6 +906,10 @@ class EditViewController: NSViewController, EditViewDataSource, FindDelegate, Sc languagesMenu.addItem(item) } } + + public func toggleTailConfigChanged(_ isTailEnabled: Bool) { + self.isTailEnabled = isTailEnabled + } @IBAction func gotoLine(_ sender: AnyObject) { guard let window = self.view.window else { return } diff --git a/Sources/XiEditor/RPCSending.swift b/Sources/XiEditor/RPCSending.swift index 12117c0d..aeab27ca 100644 --- a/Sources/XiEditor/RPCSending.swift +++ b/Sources/XiEditor/RPCSending.swift @@ -334,6 +334,14 @@ class StdoutRPCSender: RPCSending { case "replace_status": let status = params["status"] as! [String: AnyObject] client?.replaceStatus(viewIdentifier: viewIdentifier!, status: status) + + case "toggle_tail_config_changed": + let isTailEnabled = params["is_tail_enabled"] as! Bool + client?.toggleTailConfigChanged( + viewIdentifier: viewIdentifier!, + isTailEnabled: isTailEnabled + ) + default: print("unknown notification \(method)") diff --git a/Sources/XiEditor/XiCore.swift b/Sources/XiEditor/XiCore.swift index e8ae4099..02dbbb4f 100644 --- a/Sources/XiEditor/XiCore.swift +++ b/Sources/XiEditor/XiCore.swift @@ -49,6 +49,7 @@ protocol XiCore: class { func sendRpcAsync(_ method: String, params: Any, callback: RpcCallback?) func sendRpc(_ method: String, params: Any) -> RpcResult /// Will tail opened file if enabled. + /// If toggle succeeds the client will receive a `toggle_tail_config_changed` notification. func toggleTailConfig(identifier: ViewIdentifier, enabled: Bool) } From f81774130c17c11597430f7dba94a415d498712e Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sun, 3 Feb 2019 21:07:28 -0500 Subject: [PATCH 07/18] Refactoring. --- Sources/XiEditor/AppDelegate.swift | 7 ------- Sources/XiEditor/ClientImplementation.swift | 7 +++++++ Sources/XiEditor/RPCSending.swift | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/Sources/XiEditor/AppDelegate.swift b/Sources/XiEditor/AppDelegate.swift index 6fbba270..73c026b8 100644 --- a/Sources/XiEditor/AppDelegate.swift +++ b/Sources/XiEditor/AppDelegate.swift @@ -284,13 +284,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { case install = "Install 'xi' Shell Command" case remove = "Remove 'xi' Shell Command" } - - func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { - DispatchQueue.main.async { [weak self] in - let document = self?.documentForViewIdentifier(viewIdentifier: viewIdentifier) - document?.editViewController?.toggleTailConfigChanged(isTailEnabled) - } - } //MARK: - top-level interactions @IBAction func openPreferences(_ sender: NSMenuItem) { diff --git a/Sources/XiEditor/ClientImplementation.swift b/Sources/XiEditor/ClientImplementation.swift index d36fce6d..9f76998a 100644 --- a/Sources/XiEditor/ClientImplementation.swift +++ b/Sources/XiEditor/ClientImplementation.swift @@ -179,6 +179,13 @@ class ClientImplementation: XiClient, DocumentsProviding, ConfigCacheProviding, } } } + + func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { + DispatchQueue.main.async { [weak self] in + let document = self?.documentForViewIdentifier(viewIdentifier: viewIdentifier) + document?.editViewController?.toggleTailConfigChanged(isTailEnabled) + } + } // Stores the config dict so new windows don't have to wait for core to send it. // The main purpose of this is ensuring that `unified_titlebar` applies immediately. diff --git a/Sources/XiEditor/RPCSending.swift b/Sources/XiEditor/RPCSending.swift index 623a6e87..78e85a3d 100644 --- a/Sources/XiEditor/RPCSending.swift +++ b/Sources/XiEditor/RPCSending.swift @@ -73,6 +73,7 @@ enum RPCNotificationMethod: String { case findStatus = "find_status" case replaceStatus = "replace_status" + case toggleTailConfigChanged = "toggle_tail_config_changed" } /// A completion handler for a synchronous RPC @@ -382,7 +383,7 @@ class StdoutRPCSender: RPCSending { let status = params["status"] as! [String: AnyObject] client?.replaceStatus(viewIdentifier: viewIdentifier!, status: status) - case "toggle_tail_config_changed": + case .toggleTailConfigChanged: let isTailEnabled = params["is_tail_enabled"] as! Bool client?.toggleTailConfigChanged( viewIdentifier: viewIdentifier!, From dfec6fe72d98b6d1c7a4dc544b28db6d7c54127e Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sun, 3 Feb 2019 21:29:24 -0500 Subject: [PATCH 08/18] Adding function to test. --- Tests/IntegrationTests/TestClientImplementation.swift | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Tests/IntegrationTests/TestClientImplementation.swift b/Tests/IntegrationTests/TestClientImplementation.swift index 6897e31c..fb125020 100644 --- a/Tests/IntegrationTests/TestClientImplementation.swift +++ b/Tests/IntegrationTests/TestClientImplementation.swift @@ -86,4 +86,7 @@ class TestClientImplementation: XiClient { func replaceStatus(viewIdentifier: String, status: [String : AnyObject]) { } + + func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { + } } From 026f6042d00c6115e5776d6901684d8b0bbe026c Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sat, 9 Feb 2019 10:02:47 -0500 Subject: [PATCH 09/18] Refactoring based on new changes in upstream. --- Sources/XiEditor/AppDelegate.swift | 7 ------- Sources/XiEditor/ClientImplementation.swift | 8 ++++++++ Sources/XiEditor/RPCSending.swift | 7 ++----- Tests/IntegrationTests/TestClientImplementation.swift | 3 +++ 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/Sources/XiEditor/AppDelegate.swift b/Sources/XiEditor/AppDelegate.swift index 6fbba270..73c026b8 100644 --- a/Sources/XiEditor/AppDelegate.swift +++ b/Sources/XiEditor/AppDelegate.swift @@ -284,13 +284,6 @@ class AppDelegate: NSObject, NSApplicationDelegate { case install = "Install 'xi' Shell Command" case remove = "Remove 'xi' Shell Command" } - - func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { - DispatchQueue.main.async { [weak self] in - let document = self?.documentForViewIdentifier(viewIdentifier: viewIdentifier) - document?.editViewController?.toggleTailConfigChanged(isTailEnabled) - } - } //MARK: - top-level interactions @IBAction func openPreferences(_ sender: NSMenuItem) { diff --git a/Sources/XiEditor/ClientImplementation.swift b/Sources/XiEditor/ClientImplementation.swift index d36fce6d..2a48ca45 100644 --- a/Sources/XiEditor/ClientImplementation.swift +++ b/Sources/XiEditor/ClientImplementation.swift @@ -179,6 +179,14 @@ class ClientImplementation: XiClient, DocumentsProviding, ConfigCacheProviding, } } } + + func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { + DispatchQueue.main.async { [weak self] in + let document = self?.documentForViewIdentifier(viewIdentifier: viewIdentifier) + document?.editViewController?.toggleTailConfigChanged(isTailEnabled) + } + } + // Stores the config dict so new windows don't have to wait for core to send it. // The main purpose of this is ensuring that `unified_titlebar` applies immediately. diff --git a/Sources/XiEditor/RPCSending.swift b/Sources/XiEditor/RPCSending.swift index 623a6e87..9a70dca2 100644 --- a/Sources/XiEditor/RPCSending.swift +++ b/Sources/XiEditor/RPCSending.swift @@ -73,6 +73,7 @@ enum RPCNotificationMethod: String { case findStatus = "find_status" case replaceStatus = "replace_status" + case toggle_tail_config_changed = "toggle_tail_config_changed" } /// A completion handler for a synchronous RPC @@ -382,16 +383,12 @@ class StdoutRPCSender: RPCSending { let status = params["status"] as! [String: AnyObject] client?.replaceStatus(viewIdentifier: viewIdentifier!, status: status) - case "toggle_tail_config_changed": + case .toggle_tail_config_changed: let isTailEnabled = params["is_tail_enabled"] as! Bool client?.toggleTailConfigChanged( viewIdentifier: viewIdentifier!, isTailEnabled: isTailEnabled ) - - - default: - print("unknown notification \(method)") } } diff --git a/Tests/IntegrationTests/TestClientImplementation.swift b/Tests/IntegrationTests/TestClientImplementation.swift index 6897e31c..fb125020 100644 --- a/Tests/IntegrationTests/TestClientImplementation.swift +++ b/Tests/IntegrationTests/TestClientImplementation.swift @@ -86,4 +86,7 @@ class TestClientImplementation: XiClient { func replaceStatus(viewIdentifier: String, status: [String : AnyObject]) { } + + func toggleTailConfigChanged(viewIdentifier: String, isTailEnabled: Bool) { + } } From 63bda4374c98e566b662cf602cd5e0e74b2c6150 Mon Sep 17 00:00:00 2001 From: Sujit Joshi Date: Sat, 9 Feb 2019 10:31:13 -0500 Subject: [PATCH 10/18] Removing unecessary file --- .idea/checkstyle-idea.xml | 16 -- .idea/misc.xml | 15 -- .idea/modules.xml | 8 - .idea/qaplug_profiles.xml | 311 ------------------------ .idea/vcs.xml | 7 - .idea/workspace.xml | 487 -------------------------------------- .idea/xi-mac.iml | 70 ------ deleteMe | 0 tailMe | 0 tailMe2 | 5 - tailMe3 | 6 - tailTo | 10 - xi-mac.code-workspace | 8 - 13 files changed, 943 deletions(-) delete mode 100644 .idea/checkstyle-idea.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/modules.xml delete mode 100644 .idea/qaplug_profiles.xml delete mode 100644 .idea/vcs.xml delete mode 100644 .idea/workspace.xml delete mode 100644 .idea/xi-mac.iml delete mode 100644 deleteMe delete mode 100644 tailMe delete mode 100644 tailMe2 delete mode 100644 tailMe3 delete mode 100755 tailTo delete mode 100644 xi-mac.code-workspace diff --git a/.idea/checkstyle-idea.xml b/.idea/checkstyle-idea.xml deleted file mode 100644 index 8f4b34c1..00000000 --- a/.idea/checkstyle-idea.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 51a6ed0b..00000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml deleted file mode 100644 index 6b0985ac..00000000 --- a/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/qaplug_profiles.xml b/.idea/qaplug_profiles.xml deleted file mode 100644 index fc5db5e0..00000000 --- a/.idea/qaplug_profiles.xml +++ /dev/null @@ -1,311 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 46c4c45b..00000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index f213135f..00000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,487 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - file_info - toggle - view - test - line_of - line_of_offset - ViewID - tailDeta - save - update_current_position_in_tail - - - - - - - - - - - true - DEFINITION_ORDER - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -