diff --git a/libs/remix-tests/src/compiler.ts b/libs/remix-tests/src/compiler.ts index c287ca3677..740a306931 100644 --- a/libs/remix-tests/src/compiler.ts +++ b/libs/remix-tests/src/compiler.ts @@ -1,6 +1,7 @@ import fs from './fileSystem' import async from 'async' import path from 'path' +import deepequal from 'deep-equal' import Log from './logger' import { Compiler as RemixCompiler } from '@remix-project/remix-solidity' import { SrcIfc, CompilerConfiguration, CompilationErrors } from './types' @@ -170,7 +171,8 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts * @param opts Options * @param cb Callback */ -export function compileContractSources (sources: SrcIfc, compiler: any, opts: any, cb): void { +export function compileContractSources (sources: SrcIfc, newCompConfig: any, importFileCb, UTRunner, opts: any, cb): void { + let compiler const filepath = opts.testFilePath || '' const testFileImportRegEx = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm @@ -183,8 +185,28 @@ export function compileContractSources (sources: SrcIfc, compiler: any, opts: an } async.waterfall([ - function doCompilation (next) { + (next) => { + if (!deepequal(UTRunner.compilerConfig, newCompConfig)) { + UTRunner.compilerConfig = newCompConfig + const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = newCompConfig + compiler = new RemixCompiler(importFileCb) + compiler.set('evmVersion', evmVersion) + compiler.set('optimize', optimize) + compiler.set('runs', runs) + compiler.loadVersion(usingWorker, currentCompilerUrl) + // @ts-ignore + compiler.event.register('compilerLoaded', this, (version) => { + next() + }) + } else { + compiler = UTRunner.compiler + next() + } + }, + (next) => { const compilationFinishedCb = (success, data, source) => { + // data.error usually exists for exceptions like worker error etc. + if (!data.error) UTRunner.compiler = compiler if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source) next(null, data) } diff --git a/libs/remix-tests/src/runTestSources.ts b/libs/remix-tests/src/runTestSources.ts index 0f2a72cea5..40f0d87788 100644 --- a/libs/remix-tests/src/runTestSources.ts +++ b/libs/remix-tests/src/runTestSources.ts @@ -1,6 +1,4 @@ import async, { ErrorCallback } from 'async' -import deepequal from 'deep-equal' -import { Compiler as RemixCompiler } from '@remix-project/remix-solidity' import { compileContractSources, writeTestAccountsContract } from './compiler' import { deployAll } from './deployer' import { runTest } from './testRunner' @@ -50,29 +48,13 @@ export class UnitTestRunner { * @param importFileCb Import file callback * @param opts Options */ - async runTestSources (contractSources: SrcIfc, compilerConfig: CompilerConfiguration, testCallback, resultCallback, deployCb:any, finalCallback: any, importFileCb, opts: Options) { + async runTestSources (contractSources: SrcIfc, newCompilerConfig: CompilerConfiguration, testCallback, resultCallback, deployCb:any, finalCallback: any, importFileCb, opts: Options) { opts = opts || {} const sourceASTs: any = {} if (opts.web3 || opts.accounts) this.init(opts.web3, opts.accounts) - async.waterfall([ (next) => { - if (!deepequal(this.compilerConfig, compilerConfig)) { - this.compilerConfig = compilerConfig - const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = compilerConfig - this.compiler = new RemixCompiler(importFileCb) - this.compiler.set('evmVersion', evmVersion) - this.compiler.set('optimize', optimize) - this.compiler.set('runs', runs) - this.compiler.loadVersion(usingWorker, currentCompilerUrl) - // @ts-ignore - this.compiler.event.register('compilerLoaded', this, (version) => { - next() - }) - } else next() - }, - (next) => { - compileContractSources(contractSources, this.compiler, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next) + compileContractSources(contractSources, newCompilerConfig, importFileCb, this, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next) }, (compilationResult: compilationInterface, asts: ASTInterface, next) => { for (const filename in asts) { diff --git a/libs/remix-ui/editor/src/lib/remix-ui-editor.css b/libs/remix-ui/editor/src/lib/remix-ui-editor.css index af7cd06bfd..ad1c9a7d5b 100644 --- a/libs/remix-ui/editor/src/lib/remix-ui-editor.css +++ b/libs/remix-ui/editor/src/lib/remix-ui-editor.css @@ -10,6 +10,11 @@ width: auto; } +.monaco-hover .markdown-hover > .hover-contents:not(.code-hover-contents) { + max-width: none !important; + word-wrap: break-word; +} + .contextview { opacity: 1; position: absolute; diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css index d0d2c6dcd2..54c71b16c5 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css @@ -1,5 +1,6 @@ .remixui_home_text { cursor: pointer; + font-size: 0.8rem; font-weight: normal; max-width: 300px; } diff --git a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx index 18d0649988..ecbca46eb7 100644 --- a/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx +++ b/libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx @@ -125,6 +125,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => { } const createNewFile = async () => { + plugin.verticalIcons.select('filePanel') await plugin.call('filePanel', 'createNewFile') } @@ -261,21 +262,22 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {

File

- createNewFile()}>New File +

- + + + { + event.stopPropagation() + plugin.verticalIcons.select('filePanel') + uploadFile(event.target) + }} multiple />

- connectToLocalhost()}>Connect to Localhost +

@@ -301,7 +303,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {

- switchToPreviousVersion()}>Old experience +