From 822eccb18f89ac3a482d2a32a6ca28ddedff1b8f Mon Sep 17 00:00:00 2001 From: Tim Robinson Date: Mon, 13 Jul 2015 15:36:08 +0000 Subject: [PATCH] Refactoring to what @nightwing mentioned --- package.json | 2 +- plugins/c9.ide.watcher/gui.js | 20 +++----------------- 2 files changed, 4 insertions(+), 18 deletions(-) diff --git a/package.json b/package.json index 71e49a64..0892aec7 100644 --- a/package.json +++ b/package.json @@ -67,7 +67,7 @@ "c9.ide.language.javascript.tern": "#2b0bb024da", "c9.ide.language.javascript.infer": "#cfec494a3c", "c9.ide.language.jsonalyzer": "#ba3e0d298c", - "c9.ide.collab": "#e9912adbfc", + "c9.ide.collab": "#234c59a8e9", "c9.ide.local": "#a9703b630c", "c9.ide.find": "#6cc6d3379d", "c9.ide.find.infiles": "#72582de3cd", diff --git a/plugins/c9.ide.watcher/gui.js b/plugins/c9.ide.watcher/gui.js index 4ecdf707..a3325d86 100644 --- a/plugins/c9.ide.watcher/gui.js +++ b/plugins/c9.ide.watcher/gui.js @@ -124,23 +124,9 @@ define(function(require, exports, module) { watcher.on("change", function(e) { var tab = tabManager.findTab(e.path); if (tab) { - if (collabEnabled && tab.editorType == "ace") { - // Collab is supposed to handle this change - // TODO make this a setting - console.warn("[watchers] change ignored because of Collab", e.path); - /* If the lastChange (added by collab) was greater than 1 second ago set up a watch - To ensure that collab makes this change, if not report an error. The lastChange - check is to avoid a race condition if collab updates before this function runs */ - if (!tab.debugData.lastChange || tab.debugData.lastChange < (Date.now() - 1000)) { - if (tab.debugData.changeRegistered) { - clearTimeout(tab.debugData.changeRegistered); - } - tab.debugData.changeRegistered = setTimeout(function() { - emit("changeNotAppliedError", {tab: tab}); - }, 5000); - } - return; - } + // If collab picks this up and handles the change it will return false + if (emit("docChange", {tab: tab}) === false) + return addChangedTab(tab, e.type === "change"); }