From c6e27314e946cb85d243a837fba6705481a1c270 Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 17 Apr 2015 02:30:11 +0400 Subject: [PATCH 1/2] update syntax of existing tabs when new syntax is defined --- plugins/c9.ide.ace/ace.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index 8fbd4e9d..fdb48892 100644 --- a/plugins/c9.ide.ace/ace.js +++ b/plugins/c9.ide.ace/ace.js @@ -1218,7 +1218,16 @@ define(function(require, exports, module) { } } - var updateSyntaxMenu = lang.delayedCall(rebuildSyntaxMenu, 50); + var updateSyntaxMenu = lang.delayedCall(function() { + rebuildSyntaxMenu(); + tabs.getTabs().forEach(function(tab) { + if (tab.editorType == "ace") { + var c9Session = tab.document.getSession(); + if (c9Session.session) + detectSyntax(c9Session, tab.path); + } + }); + }, 50); /***** Syntax *****/ @@ -1237,6 +1246,7 @@ define(function(require, exports, module) { modes.extensions[ext] = name; }); + updateSyntaxMenu.schedule(); } From 23935bae6d6fbc6173140096488fd03da9683a4c Mon Sep 17 00:00:00 2001 From: nightwing Date: Fri, 17 Apr 2015 02:53:34 +0400 Subject: [PATCH 2/2] guard against missing session --- plugins/c9.ide.ace/ace.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/c9.ide.ace/ace.js b/plugins/c9.ide.ace/ace.js index fdb48892..d1f1e89c 100644 --- a/plugins/c9.ide.ace/ace.js +++ b/plugins/c9.ide.ace/ace.js @@ -1223,7 +1223,7 @@ define(function(require, exports, module) { tabs.getTabs().forEach(function(tab) { if (tab.editorType == "ace") { var c9Session = tab.document.getSession(); - if (c9Session.session) + if (c9Session && c9Session.session) detectSyntax(c9Session, tab.path); } });