From 3f51b02e256bf959050d3d293cd9a5833e58dba1 Mon Sep 17 00:00:00 2001 From: Glavin Wiechert Date: Wed, 2 Mar 2016 12:47:28 -0400 Subject: [PATCH] Fixes #839. Throw error if languages have same namespace Also fix XTemplate & Riot.js --- src/beautifiers/index.coffee | 6 ++++++ src/languages/riotjs.coffee | 2 +- src/languages/xtemplate.coffee | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/beautifiers/index.coffee b/src/beautifiers/index.coffee index 732e0a6..53067d4 100644 --- a/src/beautifiers/index.coffee +++ b/src/beautifiers/index.coffee @@ -262,6 +262,12 @@ module.exports = class Beautifiers extends EventEmitter beautifiers = lang.beautifiers optionName = "language_#{lang.namespace}" + # Check if namespace has already been used + if _.has(flatOptions, "#{optionName}_disabled") + error = new Error("Language named '#{name}' has an already used namespace #{lang.namespace}.") + atom.notifications?.addError(error.message, { + stack: error.stack, detail: error.message, dismissable : true}) + throw error # Add Language configurations flatOptions["#{optionName}_disabled"] = { diff --git a/src/languages/riotjs.coffee b/src/languages/riotjs.coffee index daf7a22..1557a2f 100644 --- a/src/languages/riotjs.coffee +++ b/src/languages/riotjs.coffee @@ -2,7 +2,7 @@ module.exports = { name: "Riot.js" description: "Riot.js HTML based templating language" - namespace: "html" + namespace: "riot" fallback: ['html', 'mustache'] ### diff --git a/src/languages/xtemplate.coffee b/src/languages/xtemplate.coffee index 64d5aea..2aad0f9 100644 --- a/src/languages/xtemplate.coffee +++ b/src/languages/xtemplate.coffee @@ -1,7 +1,7 @@ module.exports = { name: "XTemplate" - namespace: "html" + namespace: "xtemplate" fallback: ['html','mustache'] ###