diff --git a/src/app/tabs/compileTab/compilerContainer.js b/src/app/tabs/compileTab/compilerContainer.js index d8da197549..4bd21ee2c9 100644 --- a/src/app/tabs/compileTab/compilerContainer.js +++ b/src/app/tabs/compileTab/compilerContainer.js @@ -38,10 +38,17 @@ class CompilerContainer { } if (!this._view.compilationButton) return const button = this.compilationButton(name.split('/').pop()) - this._disableCompileBtn(!name) + this._disableCompileBtn(!name || (name && !this.isSolFileSelected(name))) yo.update(this._view.compilationButton, button) } + isSolFileSelected (currentFile = '') { + if (!currentFile) currentFile = this.config.get('currentFile') + if (!currentFile) return false + return currentFile.substr(currentFile.length - 3, currentFile.length) === 'sol' || + currentFile.substr(currentFile.length - 3, currentFile.length) === 'yul' + } + deactivate () { // deactivate editor listeners this.editor.event.unregister('contentChanged') @@ -113,7 +120,7 @@ class CompilerContainer { */ compilationButton (name = '') { const displayed = name || '' - const disabled = name ? '' : 'disabled' + const disabled = name && this.isSolFileSelected() ? '' : 'disabled' const compileBtn = yo`