Merge pull request +15282 from c9/ide-fix-various

Ide fix various
This commit is contained in:
Harutyun Amirjanyan 2017-02-20 13:08:39 +04:00 committed by GitHub
commit 3113210322
7 changed files with 50 additions and 65 deletions

View File

@ -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;

View File

@ -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"],

View File

@ -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) {

View File

@ -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.");
}
}
}

View File

@ -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) {

View File

@ -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));
});

View File

@ -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==";