|
|
|
@ -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`<i class="fa fa-refresh ${css.icon}" aria-hidden="true"></i>` |
|
|
|
|
self._view.compileButton = yo`<div class="${css.compileButton}" onclick=${compile} id="compile" title="Compile source code">${self._view.compileIcon} Start to compile</div>` |
|
|
|
|
self._view.autoCompile = yo`<input class="${css.autocompile}" onchange=${updateAutoCompile} id="autoCompile" type="checkbox" title="Auto compile">` |
|
|
|
|
self._view.hideWarningsBox = yo`<input class="${css.autocompile}" onchange=${hideWarnings} id="hideWarningsBox" type="checkbox" title="Hide warnings">` |
|
|
|
|
if (self.data.autoCompile) self._view.autoCompile.setAttribute('checked', '') |
|
|
|
|
self._view.compileContainer = yo` |
|
|
|
|
<div class="${css.compileContainer}"> |
|
|
|
@ -147,6 +155,10 @@ module.exports = class CompileTab { |
|
|
|
|
<span class="${css.autocompileText}">Auto compile</span> |
|
|
|
|
</div> |
|
|
|
|
${self._view.warnCompilationSlow} |
|
|
|
|
<div class=${css.hideWarningsContainer}> |
|
|
|
|
${self._view.hideWarningsBox} |
|
|
|
|
<span class="${css.autocompileText}">Hide warnings</span> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div>` |
|
|
|
|
self._view.errorContainer = yo`<div class='error'></div>` |
|
|
|
@ -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; |
|
|
|
|