From 0a495532a6177cfac1ea9c11d21110a46ff4fc1e Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 18 Feb 2017 17:26:21 +0400 Subject: [PATCH 1/5] fix regression with revealtab --- plugins/c9.ide.terminal/terminal.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/plugins/c9.ide.terminal/terminal.js b/plugins/c9.ide.terminal/terminal.js index d06a4b15..fa53cefe 100644 --- a/plugins/c9.ide.terminal/terminal.js +++ b/plugins/c9.ide.terminal/terminal.js @@ -1315,6 +1315,8 @@ define(function(require, exports, module) { write: write, getPathAsync: function(callback) { + if (!currentSession || !currentSession.getStatus) + return callback("not ready"); currentSession.getStatus({}, function(err, result) { callback(err, result && util.normalizePath(result.path)); }); From dc91171b1a00c1f9ad19cfc428e3b5dac43d9eef Mon Sep 17 00:00:00 2001 From: nightwing Date: Sat, 18 Feb 2017 22:05:19 +0400 Subject: [PATCH 2/5] fix local version --- local/server.js | 23 ++++++++++------------- settings/local.js | 28 ++-------------------------- 2 files changed, 12 insertions(+), 39 deletions(-) diff --git a/local/server.js b/local/server.js index 400be93c..9bbfb122 100644 --- a/local/server.js +++ b/local/server.js @@ -1,21 +1,19 @@ -var fs = require("fs"); -var join = require("path").join; -var proc = require("child_process"); -var path = require("path"); +require("amd-loader"); + +var fs = require("fs"); +var join = require("path").join; +var proc = require("child_process"); +var path = require("path"); // set up env variables for windows if (process.platform == "win32") { - // HOME usually isn't defined on windows - if (!process.env.HOME) - process.env.HOME = process.env.HOMEDRIVE + process.env.HOMEPATH; - // add cloud9 cygwin to path - var msysBin = join(process.env.HOME, ".c9", "msys/bin"); - process.env.Path = msysBin + ";" + process.env.path; - process.env.C9_BASH_BIN = msysBin + "/bash.exe"; process.env.CYGWIN = "nodosfilewarning " + (process.env.CYGWIN || ""); process.env.CHERE_INVOKING = 1; // prevent cygwin from changing bash path } +// HOME usually isn't defined on windows, so weload settings/standalone which adds it +var localSettings = require(join(__dirname, "../settings/local.js"))({ revision: " " }, null); + // Ports on which we'd like to run preview (see http://saucelabs.com/docs/connect#localhost) var SAFE_PORTS = [2222, 2310, 3000, 3001, 3030, 3210, 3333, 4000, 4001, 4040, 4321, 4502, 4503, 4567, 5000, 5001, 5050, 5555, @@ -252,7 +250,6 @@ var server = { getPlugins : function(options, cb, restoreWindow) { var windowConfig = options.windowConfig || {}; var configPath = join(__dirname, "../configs/ide/default-local.js"); - var settingsPath = join(__dirname, "../settings/local.js"); var themeDir = join(__dirname, "../build/standalone/skin/" + (windowConfig.isRemote ? "full" : "default-local")); @@ -370,7 +367,7 @@ var server = { loadTheme(themeName, cb); } - var settings = require(settingsPath)(null, null, settingDir); + var settings = localSettings; settings.packed = options.packed; settings.vfsServers = options.vfsServers; diff --git a/settings/local.js b/settings/local.js index c0244bf7..4e471550 100644 --- a/settings/local.js +++ b/settings/local.js @@ -1,26 +1,9 @@ -module.exports = function(manifest, installPath, settingDir) { +module.exports = function(manifest, installPath) { var path = require("path"); var fs = require("fs"); - if (typeof installPath != "string") { - installPath = process.platform == "darwin" && false // disabled for sdk - ? "/Library/Application Support/Cloud9" - : path.join(process.env.HOME, ".c9"); - } - var config = require("./standalone")(manifest, installPath); - - // Support legacy installations - if (!config.settingDir) { - if (settingDir) - config.settingDir = settingDir; - else { - config.settingDir = installPath; - if (installPath === "/Library/Application Support/Cloud9") - config.settingDir = path.join(process.env.HOME, installPath); - } - } - + config.local = true; config.standalone = false; config.host = "localhost"; @@ -47,13 +30,6 @@ module.exports = function(manifest, installPath, settingDir) { // config.update.port = "8888" // config.update.host = "http" - // config.nodeBin = [process.platform == "win32" - // ? path.join(process.execPath, "..\\node.exe") - // : path.join(installPath, "node/bin/node")]; - config.bashBin = process.platform == "win32" - ? process.env.C9_BASH_BIN || "C:\\cygwin\\bin\\bash.exe" - : "/bin/bash"; - config.raygun.client.apiKey = "sraXwWUvvI6TQT6d45u4bw=="; config.raygun.server.apiKey = "sraXwWUvvI6TQT6d45u4bw=="; From 0841961fc7f43bca7bd360fdc7a69caef7de2fe2 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Feb 2017 15:52:14 +0400 Subject: [PATCH 3/5] handle misformed tabstate --- plugins/c9.ide.editors/tabmanager.js | 9 ++++++-- plugins/c9.ide.editors/tabmanager_test.js | 25 ++++++++++++++--------- 2 files changed, 22 insertions(+), 12 deletions(-) diff --git a/plugins/c9.ide.editors/tabmanager.js b/plugins/c9.ide.editors/tabmanager.js index 73b8d27d..2a974f48 100644 --- a/plugins/c9.ide.editors/tabmanager.js +++ b/plugins/c9.ide.editors/tabmanager.js @@ -498,8 +498,13 @@ define(function(require, module, exports) { state.pane = panes[i]; } if (!state.pane) { - throw new Error("Called open too early. Please wait until " - + "a pane is available. Use the ready event."); + if (isReady) { + state.pane = createPane({}); + container.appendChild(state.pane.aml); + } else { + throw new Error("Called open too early. Please wait until " + + "a pane is available. Use the ready event."); + } } } diff --git a/plugins/c9.ide.editors/tabmanager_test.js b/plugins/c9.ide.editors/tabmanager_test.js index 8c3d8b62..6f08e9f8 100644 --- a/plugins/c9.ide.editors/tabmanager_test.js +++ b/plugins/c9.ide.editors/tabmanager_test.js @@ -54,16 +54,6 @@ require(["lib/architect/architect", "lib/chai/chai"], }, "plugins/c9.fs/fs.cache.xml", - // Mock plugins - { - consumes: ["apf", "ui", "Plugin"], - provides: [ - "commands", "menus", "commands", "layout", "watcher", "proc", - "save", "anims", "clipboard", "dialog.alert", "auth.bootstrap", - "info", "dialog.error" - ], - setup: expect.html.mocked - }, { consumes: ["tabManager", "ui", "fs.cache", "fs"], provides: [], @@ -112,6 +102,21 @@ require(["lib/architect/architect", "lib/chai/chai"], var text; describe("open(), openFile(), openEditor() and reload()", function() { + it('should recover from state with no panes', function(done) { + var oldState = tabs.getState(); + tabs.setState({ + "nodes": [], + "type": "hsplitbox" + }, function() {}); + tabs.openEditor("timeview", function(err, tab) { + expect(tabs.getTabs()).length(1); + + expect(tabs.focussedTab) + .to.exist + .to.equal(tab); + tabs.setState(oldState, done); + }); + }); it('should open a pane from a path', function(done) { var vpath = "/file.txt"; tabs.openFile(vpath, function(err, tab) { From 51a9f0d192ee7b39a082e917ad2aa2c3214e4683 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Feb 2017 16:00:58 +0400 Subject: [PATCH 4/5] add Alt-` as an alternative to Ctrl-Tab on windows --- plugins/c9.ide.behaviors/tabs.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/plugins/c9.ide.behaviors/tabs.js b/plugins/c9.ide.behaviors/tabs.js index 298ab9ab..056a4aaa 100644 --- a/plugins/c9.ide.behaviors/tabs.js +++ b/plugins/c9.ide.behaviors/tabs.js @@ -68,8 +68,8 @@ define(function(require, exports, module) { ["tab9", "Command-9", "Ctrl-9", null, "navigate to the ninth tab"], ["tab0", "Command-0", "Ctrl-0", null, "navigate to the tenth tab"], ["revealtab", "Command-Shift-L", "Ctrl-Shift-L", ACTIVEPATH, "reveal current tab in the file tree"], - ["nexttab", "Option-Tab", "Ctrl-Tab", MORETABSINPANE, "navigate to the next tab in the stack of accessed tabs"], - ["previoustab", "Option-Shift-Tab", "Ctrl-Shift-Tab", MORETABSINPANE, "navigate to the previous tab in the stack of accessed tabs"], + ["nexttab", "Option-Tab", "Ctrl-Tab|Alt-`", MORETABSINPANE, "navigate to the next tab in the stack of accessed tabs"], + ["previoustab", "Option-Shift-Tab", "Ctrl-Shift-Tab|Alt-Shift-`", MORETABSINPANE, "navigate to the previous tab in the stack of accessed tabs"], ["nextpane", "Option-ESC", "Ctrl-`", MOREPANES, "navigate to the next tab in the stack of panes"], ["previouspane", "Option-Shift-ESC", "Ctrl-Shift-`", MOREPANES, "navigate to the previous tab in the stack of panes"], ["gotopaneright", "Ctrl-Meta-Right", "Ctrl-Meta-Right", null, "navigate to the pane on the right"], @@ -120,7 +120,7 @@ define(function(require, exports, module) { list.remove(null); paneList = list; } - }); + }, plugin); settings.on("write", function(e) { var list; @@ -134,7 +134,7 @@ define(function(require, exports, module) { settings.setJson("state/panecycle", list); paneList.changed = false; } - }); + }, plugin); // Preferences prefs.add({ @@ -472,7 +472,7 @@ define(function(require, exports, module) { meta.accessList = []; if (!meta.accessList.toJson) meta.accessList.toJson = accessListToJson; - }); + }, plugin); //@todo store the stack for availability after reload tabs.on("tabBeforeClose", function(e) { @@ -489,14 +489,14 @@ define(function(require, exports, module) { closeallbutme(tab); return false; } - }); + }, plugin); tabs.on("tabAfterClose", function(e) { // Hack to force focus on the right pane var accessList = e.tab.pane.meta.accessList; if (tabs.focussedTab == e.tab && accessList[1]) e.tab.pane.aml.nextTabInLine = accessList[1].aml; - }); + }, plugin); tabs.on("tabBeforeReparent", function(e) { // Move to new access list @@ -512,7 +512,7 @@ define(function(require, exports, module) { // Hack to force focus on the right pane if (tabs.focussedTab == e.tab && lastList[0]) e.lastPane.aml.nextTabInLine = lastList[0].aml; - }); + }, plugin); tabs.on("tabAfterClose", function(e) { var tab = e.tab; @@ -522,7 +522,7 @@ define(function(require, exports, module) { addTabToClosedMenu(tab); tab.pane.meta.accessList.remove(tab); paneList.remove(tab); - }); + }, plugin); tabs.on("tabCreate", function(e) { var tab = e.tab; @@ -565,7 +565,7 @@ define(function(require, exports, module) { else paneList[idx] = tab; } - }); + }, plugin); tabs.on("focusSync", function(e) { var tab = e.tab; @@ -588,7 +588,7 @@ define(function(require, exports, module) { && settings.getBool('user/general/@revealfile')) { revealtab(tab, true); } - }); + }, plugin); tabs.on("tabAfterActivate", function(e) { var tab = e.tab; if (tab == tabs.focussedTab || !tab.loaded) @@ -605,7 +605,7 @@ define(function(require, exports, module) { settings.save(); } - }); + }, plugin); apf.addEventListener("keydown", function(eInfo) { if (eInfo.keyCode == 17 || eInfo.keyCode == 18) { From 9762b5ea441527c1ad0a1164f695d29a004b1ee6 Mon Sep 17 00:00:00 2001 From: nightwing Date: Sun, 19 Feb 2017 16:48:00 +0400 Subject: [PATCH 5/5] tweak modelist --- node_modules/ace/lib/ace/ext/modelist.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node_modules/ace/lib/ace/ext/modelist.js b/node_modules/ace/lib/ace/ext/modelist.js index 0f883bb4..1e4711f1 100644 --- a/node_modules/ace/lib/ace/ext/modelist.js +++ b/node_modules/ace/lib/ace/ext/modelist.js @@ -88,10 +88,10 @@ var supportedModes = { HAML: ["haml"], Handlebars: ["hbs|handlebars|tpl|mustache"], Haskell: ["hs"], - Haskell_Cabal: ["cabal"], + Haskell_Cabal: ["cabal"], haXe: ["hx"], Hjson: ["hjson"], - HTML: ["html|htm|xhtml"], + HTML: ["html|htm|xhtml|vue|we|wpy"], HTML_Elixir: ["eex|html.eex"], HTML_Ruby: ["erb|rhtml|html.erb"], INI: ["ini|conf|cfg|prefs"],