From 6492dcbb1482fb13f87177d7ecbf76fb40858571 Mon Sep 17 00:00:00 2001 From: yann300 Date: Mon, 4 Apr 2022 17:52:57 +0200 Subject: [PATCH] don't clear ui if just running a script --- .../src/app/tabs/intelligent-script-executor.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts index 78bf8f030b..66368b5f56 100644 --- a/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts +++ b/apps/remix-ide/src/app/tabs/intelligent-script-executor.ts @@ -26,18 +26,20 @@ export class IntelligentScriptExecutor extends Plugin { e.preventDefault() this.targetFileName = file await this.call('solidity', 'compile', file) - } else if (file.endsWith('.js')) { + } else if (file.endsWith('.js') || file.endsWith('.ts')) { e.preventDefault() - this.runScript(file) + this.runScript(file, false) } } } } - async runScript (fileName) { + async runScript (fileName, clearAllInstances) { await this.call('terminal', 'log', `running ${fileName} ...`) const content = await this.call('fileManager', 'readFile', fileName) - await this.call('udapp', 'clearAllInstances') + if (clearAllInstances) { + await this.call('udapp', 'clearAllInstances') + } await this.call('scriptRunner', 'execute', content) } @@ -48,7 +50,7 @@ export class IntelligentScriptExecutor extends Plugin { if (this.targetFileName === contract.file && contract.object && contract.object.devdoc['custom:dev-run-script']) { this.targetFileName = null const file = contract.object.devdoc['custom:dev-run-script'] - if (file) this.runScript(file) + if (file) this.runScript(file, true) } }) }