From 4f5211e8c8adf4183f5b6c15ce0f7b7fbe7c59d1 Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 6 Jun 2018 22:32:30 -0400 Subject: [PATCH 1/3] Add ability to filter out compiler warnings --- src/app/tabs/compile-tab.js | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 9d7b71e0f5..7b85d9708a 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -35,6 +35,7 @@ module.exports = class CompileTab { maxTime: 1000, timeout: 300 } + self._opts.config.set('hideWarnings', false) self._events.editor.register('contentChanged', scheduleCompilation) self._events.editor.register('sessionSwitched', scheduleCompilation) function scheduleCompilation () { @@ -113,7 +114,13 @@ module.exports = class CompileTab { if (data.errors && data.errors.length) { error = true data.errors.forEach(function (err) { - self._opts.renderer.error(err.formattedMessage, self._view.errorContainer, {type: err.severity}) + if (self._opts.config.get('hideWarnings')) { + if (err.severity !== 'warning') { + self._opts.renderer.error(err.formattedMessage, self._view.errorContainer, {type: err.severity}) + } + } else { + self._opts.renderer.error(err.formattedMessage, self._view.errorContainer, {type: err.severity}) + } }) } if (!error && data.contracts) { @@ -137,6 +144,7 @@ module.exports = class CompileTab { self._view.compileIcon = yo`` self._view.compileButton = yo`
${self._view.compileIcon} Start to compile
` self._view.autoCompile = yo`` + self._view.hideWarningsBox = yo`` if (self.data.autoCompile) self._view.autoCompile.setAttribute('checked', '') self._view.compileContainer = yo`
@@ -147,6 +155,10 @@ module.exports = class CompileTab { Auto compile
${self._view.warnCompilationSlow} +
+ ${self._view.hideWarningsBox} + Hide warnings +
` self._view.errorContainer = yo`
` @@ -181,6 +193,10 @@ module.exports = class CompileTab { } function updateAutoCompile (event) { self._opts.config.set('autoCompile', self._view.autoCompile.checked) } function compile (event) { self._api.runCompiler() } + function hideWarnings (event) { + self._opts.config.set('hideWarnings', !self._opts.config.get('hideWarnings')) + self._api.runCompiler() + } function details () { const select = self._view.contractNames if (select.children.length > 0 && select.selectedIndex >= 0) { @@ -277,6 +293,11 @@ const css = csjs` display: flex; align-items: center; } + .hideWarningsContainer { + display: flex; + align-items: center; + margin-left: 2% + } .autocompile {} .autocompileTitle { font-weight: bold; From f8157e3ea1ef86a447d7aeb00be020c818676baf Mon Sep 17 00:00:00 2001 From: greg Date: Wed, 6 Jun 2018 23:17:39 -0400 Subject: [PATCH 2/3] Mimic logic of autoCompile button --- src/app/tabs/compile-tab.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index 7b85d9708a..ec977223e9 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -29,13 +29,13 @@ module.exports = class CompileTab { contractEl: null } self.data = { + hideWarnings: self._opts.config.get('hideWarnings') || false, autoCompile: self._opts.config.get('autoCompile'), compileTimeout: null, contractsDetails: {}, maxTime: 1000, timeout: 300 } - self._opts.config.set('hideWarnings', false) self._events.editor.register('contentChanged', scheduleCompilation) self._events.editor.register('sessionSwitched', scheduleCompilation) function scheduleCompilation () { @@ -146,6 +146,7 @@ module.exports = class CompileTab { self._view.autoCompile = yo`` self._view.hideWarningsBox = yo`` if (self.data.autoCompile) self._view.autoCompile.setAttribute('checked', '') + if (self.data.hideWarnings) self._view.hideWarningsBox.setAttribute('checked', '') self._view.compileContainer = yo`
@@ -194,7 +195,7 @@ module.exports = class CompileTab { function updateAutoCompile (event) { self._opts.config.set('autoCompile', self._view.autoCompile.checked) } function compile (event) { self._api.runCompiler() } function hideWarnings (event) { - self._opts.config.set('hideWarnings', !self._opts.config.get('hideWarnings')) + self._opts.config.set('hideWarnings', self._view.hideWarningsBox.checked) self._api.runCompiler() } function details () { From a871108eac2c534d10771b9481c9b63eb3beaf35 Mon Sep 17 00:00:00 2001 From: greg Date: Thu, 7 Jun 2018 12:23:20 -0400 Subject: [PATCH 3/3] move styles to global file --- src/app/tabs/compile-tab.js | 5 ----- src/universal-dapp-styles.js | 5 +++++ 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/tabs/compile-tab.js b/src/app/tabs/compile-tab.js index ec977223e9..29a46055d7 100644 --- a/src/app/tabs/compile-tab.js +++ b/src/app/tabs/compile-tab.js @@ -294,11 +294,6 @@ const css = csjs` display: flex; align-items: center; } - .hideWarningsContainer { - display: flex; - align-items: center; - margin-left: 2% - } .autocompile {} .autocompileTitle { font-weight: bold; diff --git a/src/universal-dapp-styles.js b/src/universal-dapp-styles.js index 3ccca94d34..13d15666da 100644 --- a/src/universal-dapp-styles.js +++ b/src/universal-dapp-styles.js @@ -241,6 +241,11 @@ var css = csjs` padding-right: 26px; padding-top: 5px; float: right; + }, + .hideWarningsContainer { + display: flex; + align-items: center; + margin-left: 2% } `