Skip to content

Commit 330a1ee

Browse files
authored
Merge branch 'master' into SUTFixes2
2 parents 651c9dd + cc01ea0 commit 330a1ee

File tree

5 files changed

+43
-31
lines changed

5 files changed

+43
-31
lines changed

libs/remix-tests/src/compiler.ts

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import fs from './fileSystem'
22
import async from 'async'
33
import path from 'path'
4+
import deepequal from 'deep-equal'
45
import Log from './logger'
56
import { Compiler as RemixCompiler } from '@remix-project/remix-solidity'
67
import { SrcIfc, CompilerConfiguration, CompilationErrors } from './types'
@@ -170,7 +171,8 @@ export function compileFileOrFiles (filename: string, isDirectory: boolean, opts
170171
* @param opts Options
171172
* @param cb Callback
172173
*/
173-
export function compileContractSources (sources: SrcIfc, compiler: any, opts: any, cb): void {
174+
export function compileContractSources (sources: SrcIfc, newCompConfig: any, importFileCb, UTRunner, opts: any, cb): void {
175+
let compiler
174176
const filepath = opts.testFilePath || ''
175177
const testFileImportRegEx = /^(import)\s['"](remix_tests.sol|tests.sol)['"];/gm
176178

@@ -183,8 +185,28 @@ export function compileContractSources (sources: SrcIfc, compiler: any, opts: an
183185
}
184186

185187
async.waterfall([
186-
function doCompilation (next) {
188+
(next) => {
189+
if (!deepequal(UTRunner.compilerConfig, newCompConfig)) {
190+
UTRunner.compilerConfig = newCompConfig
191+
const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = newCompConfig
192+
compiler = new RemixCompiler(importFileCb)
193+
compiler.set('evmVersion', evmVersion)
194+
compiler.set('optimize', optimize)
195+
compiler.set('runs', runs)
196+
compiler.loadVersion(usingWorker, currentCompilerUrl)
197+
// @ts-ignore
198+
compiler.event.register('compilerLoaded', this, (version) => {
199+
next()
200+
})
201+
} else {
202+
compiler = UTRunner.compiler
203+
next()
204+
}
205+
},
206+
(next) => {
187207
const compilationFinishedCb = (success, data, source) => {
208+
// data.error usually exists for exceptions like worker error etc.
209+
if (!data.error) UTRunner.compiler = compiler
188210
if (opts && opts.event) opts.event.emit('compilationFinished', success, data, source)
189211
next(null, data)
190212
}

libs/remix-tests/src/runTestSources.ts

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
import async, { ErrorCallback } from 'async'
2-
import deepequal from 'deep-equal'
3-
import { Compiler as RemixCompiler } from '@remix-project/remix-solidity'
42
import { compileContractSources, writeTestAccountsContract } from './compiler'
53
import { deployAll } from './deployer'
64
import { runTest } from './testRunner'
@@ -50,29 +48,13 @@ export class UnitTestRunner {
5048
* @param importFileCb Import file callback
5149
* @param opts Options
5250
*/
53-
async runTestSources (contractSources: SrcIfc, compilerConfig: CompilerConfiguration, testCallback, resultCallback, deployCb:any, finalCallback: any, importFileCb, opts: Options) {
51+
async runTestSources (contractSources: SrcIfc, newCompilerConfig: CompilerConfiguration, testCallback, resultCallback, deployCb:any, finalCallback: any, importFileCb, opts: Options) {
5452
opts = opts || {}
5553
const sourceASTs: any = {}
5654
if (opts.web3 || opts.accounts) this.init(opts.web3, opts.accounts)
57-
5855
async.waterfall([
5956
(next) => {
60-
if (!deepequal(this.compilerConfig, compilerConfig)) {
61-
this.compilerConfig = compilerConfig
62-
const { currentCompilerUrl, evmVersion, optimize, runs, usingWorker } = compilerConfig
63-
this.compiler = new RemixCompiler(importFileCb)
64-
this.compiler.set('evmVersion', evmVersion)
65-
this.compiler.set('optimize', optimize)
66-
this.compiler.set('runs', runs)
67-
this.compiler.loadVersion(usingWorker, currentCompilerUrl)
68-
// @ts-ignore
69-
this.compiler.event.register('compilerLoaded', this, (version) => {
70-
next()
71-
})
72-
} else next()
73-
},
74-
(next) => {
75-
compileContractSources(contractSources, this.compiler, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next)
57+
compileContractSources(contractSources, newCompilerConfig, importFileCb, this, { accounts: this.testsAccounts, testFilePath: opts.testFilePath, event: this.event }, next)
7658
},
7759
(compilationResult: compilationInterface, asts: ASTInterface, next) => {
7860
for (const filename in asts) {

libs/remix-ui/editor/src/lib/remix-ui-editor.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010
width: auto;
1111
}
1212

13+
.monaco-hover .markdown-hover > .hover-contents:not(.code-hover-contents) {
14+
max-width: none !important;
15+
word-wrap: break-word;
16+
}
17+
1318
.contextview {
1419
opacity: 1;
1520
position: absolute;

libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.remixui_home_text {
22
cursor: pointer;
3+
font-size: 0.8rem;
34
font-weight: normal;
45
max-width: 300px;
56
}

libs/remix-ui/home-tab/src/lib/remix-ui-home-tab.tsx

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
125125
}
126126

127127
const createNewFile = async () => {
128+
plugin.verticalIcons.select('filePanel')
128129
await plugin.call('filePanel', 'createNewFile')
129130
}
130131

@@ -261,21 +262,22 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
261262
<h4>File</h4>
262263
<p className="mb-1">
263264
<i className="mr-2 far fa-file"></i>
264-
<span className="ml-1 mb-1 remixui_home_text" onClick={() => createNewFile()}>New File</span>
265+
<label className="ml-1 mb-1 remixui_home_text" onClick={() => createNewFile()}>New File</label>
265266
</p>
266267
<p className="mb-1">
267268
<i className="mr-2 far fa-file-alt"></i>
268-
<span className="ml-1 remixui_home_labelIt remixui_home_bigLabelSize remixui_home_text">
269+
<label className="ml-1 remixui_home_labelIt remixui_home_bigLabelSize} remixui_home_text" htmlFor="openFileInput">
269270
Open Files
270-
<input title="open file" type="file" onChange={(event) => {
271-
event.stopPropagation()
272-
uploadFile(event.target)
273-
}} multiple />
274-
</span>
271+
</label>
272+
<input title="open file" type="file" id="openFileInput" onChange={(event) => {
273+
event.stopPropagation()
274+
plugin.verticalIcons.select('filePanel')
275+
uploadFile(event.target)
276+
}} multiple />
275277
</p>
276278
<p className="mb-1">
277279
<i className="mr-1 far fa-hdd"></i>
278-
<span className="ml-1 remixui_home_text" onClick={() => connectToLocalhost()}>Connect to Localhost</span>
280+
<label className="ml-1 remixui_home_text" onClick={() => connectToLocalhost()}>Connect to Localhost</label>
279281
</p>
280282
<p className="mt-3 mb-0"><label>LOAD FROM:</label></p>
281283
<div className="btn-group">
@@ -301,7 +303,7 @@ export const RemixUiHomeTab = (props: RemixUiHomeTabProps) => {
301303
</p>
302304
<p className="mb-1">
303305
<i className="mr-2 fab fa-ethereum remixui_home_image"></i>
304-
<span className="remixui_home_text" onClick={() => switchToPreviousVersion()}>Old experience</span>
306+
<label className="remixui_home_text" onClick={() => switchToPreviousVersion()}>Old experience</label>
305307
</p>
306308
</div>
307309
</div>

0 commit comments

Comments
 (0)