Unverified Commit 922febb7 authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #2295 from ethereum/bumpRemixLibs

Bump remix libs && fix remix tests module view
parents 0da7e214 3b8185cd
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -51,12 +51,12 @@ ...@@ -51,12 +51,12 @@
"npm-merge-driver": "^2.3.5", "npm-merge-driver": "^2.3.5",
"npm-run-all": "^4.0.2", "npm-run-all": "^4.0.2",
"onchange": "^3.2.1", "onchange": "^3.2.1",
"remix-analyzer": "0.3.8", "remix-analyzer": "0.3.11",
"remix-debug": "0.3.9", "remix-debug": "0.3.12",
"remix-lib": "^0.4.8", "remix-lib": "0.4.10",
"remix-solidity": "0.3.10", "remix-solidity": "0.3.13",
"remix-tabs": "1.0.48", "remix-tabs": "1.0.48",
"remix-tests": "0.1.13", "remix-tests": "0.1.16",
"remixd": "0.1.8-alpha.7", "remixd": "0.1.8-alpha.7",
"request": "^2.83.0", "request": "^2.83.0",
"rimraf": "^2.6.1", "rimraf": "^2.6.1",
......
...@@ -247,7 +247,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -247,7 +247,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
appManager.register([ appManager.register([
contentImport, contentImport,
themeModule, themeModule,
editor.sourceHighlighters, editor,
fileManager, fileManager,
compilerMetadataGenerator, compilerMetadataGenerator,
compilersArtefacts, compilersArtefacts,
...@@ -317,7 +317,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org ...@@ -317,7 +317,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.get('filemanager').api, registry.get('filemanager').api,
filePanel, filePanel,
compileTab, compileTab,
appManager appManager,
new Renderer()
) )
appManager.register([ appManager.register([
......
'use strict' 'use strict'
const SourceHighlighter = require('./sourceHighlighter') const SourceHighlighter = require('./sourceHighlighter')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'
const profile = {
displayName: 'Editor',
name: 'editor',
description: 'service - highlight source code',
version: packageJson.version,
methods: ['highlight', 'discardHighlight']
}
// EditorApi: // EditorApi:
// - methods: ['highlight', 'discardHighlight'], // - methods: ['highlight', 'discardHighlight'],
class SourceHighlighters extends Plugin { class SourceHighlighters {
constructor () { constructor () {
super(profile)
this.highlighters = {} this.highlighters = {}
} }
highlight (position, filePath, hexColor) { highlight (position, filePath, hexColor, from) {
const { from } = this.currentRequest
try { try {
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter() if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter()
this.highlighters[from].currentSourceLocation(null) this.highlighters[from].currentSourceLocation(null)
...@@ -33,8 +20,7 @@ class SourceHighlighters extends Plugin { ...@@ -33,8 +20,7 @@ class SourceHighlighters extends Plugin {
} }
} }
discardHighlight () { discardHighlight (from) {
const { from } = this.currentRequest
if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null) if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null)
} }
} }
......
...@@ -3,6 +3,8 @@ const EventManager = require('../../lib/events') ...@@ -3,6 +3,8 @@ const EventManager = require('../../lib/events')
const yo = require('yo-yo') const yo = require('yo-yo')
const csjs = require('csjs-inject') const csjs = require('csjs-inject')
const ace = require('brace') const ace = require('brace')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'
const globalRegistry = require('../../global/registry') const globalRegistry = require('../../global/registry')
const SourceHighlighters = require('./SourceHighlighters') const SourceHighlighters = require('./SourceHighlighters')
...@@ -37,9 +39,18 @@ document.head.appendChild(yo` ...@@ -37,9 +39,18 @@ document.head.appendChild(yo`
</style> </style>
`) `)
class Editor { const profile = {
displayName: 'Editor',
name: 'editor',
description: 'service - editor',
version: packageJson.version,
methods: ['highlight', 'discardHighlight', 'clearAnnotations', 'addAnnotation']
}
class Editor extends Plugin {
constructor (opts = {}, themeModule) { constructor (opts = {}, themeModule) {
super(profile)
// Dependancies // Dependancies
this._components = {} this._components = {}
this._components.registry = globalRegistry this._components.registry = globalRegistry
...@@ -177,6 +188,16 @@ class Editor { ...@@ -177,6 +188,16 @@ class Editor {
}) })
} }
highlight (position, filePath, hexColor) {
const { from } = this.currentRequest
this.sourceHighlighters.highlight(position, filePath, hexColor, from)
}
discardHighlight () {
const { from } = this.currentRequest
this.sourceHighlighters.discardHighlight(from)
}
setTheme (type) { setTheme (type) {
this.editor.setTheme('ace/theme/' + this._themes[type]) this.editor.setTheme('ace/theme/' + this._themes[type])
} }
......
...@@ -19,15 +19,15 @@ const profile = { ...@@ -19,15 +19,15 @@ const profile = {
} }
module.exports = class TestTab extends ViewPlugin { module.exports = class TestTab extends ViewPlugin {
constructor (fileManager, filePanel, compileTab, appManager) { constructor (fileManager, filePanel, compileTab, appManager, renderer) {
super(profile) super(profile)
this.compileTab = compileTab this.compileTab = compileTab
this._view = { el: null } this._view = { el: null }
this.compileTab = compileTab
this.fileManager = fileManager this.fileManager = fileManager
this.filePanel = filePanel this.filePanel = filePanel
this.data = {} this.data = {}
this.appManager = appManager this.appManager = appManager
this.renderer = renderer
appManager.event.on('activate', (name) => { appManager.event.on('activate', (name) => {
if (name === 'solidity') this.updateRunAction(fileManager.currentFile()) if (name === 'solidity') this.updateRunAction(fileManager.currentFile())
}) })
...@@ -117,10 +117,10 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -117,10 +117,10 @@ module.exports = class TestTab extends ViewPlugin {
cb() cb()
} }
updateFinalResult (_err, result, filename) { updateFinalResult (_errors, result, filename) {
this.testsSummary.hidden = false this.testsSummary.hidden = false
if (_err) { if (_errors) {
this.testsSummary.appendChild(yo`<div class="${css.testFailureSummary} text-danger" >${_err.message}</div>`) _errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsSummary, {type: err.severity}))
return return
} }
this.testsSummary.appendChild(yo`<div class=${css.summaryTitle}> ${filename} </div>`) this.testsSummary.appendChild(yo`<div class=${css.summaryTitle}> ${filename} </div>`)
...@@ -178,6 +178,7 @@ module.exports = class TestTab extends ViewPlugin { ...@@ -178,6 +178,7 @@ module.exports = class TestTab extends ViewPlugin {
} }
runTests () { runTests () {
this.call('editor', 'clearAnnotations')
this.testsOutput.innerHTML = '' this.testsOutput.innerHTML = ''
this.testsSummary.innerHTML = '' this.testsSummary.innerHTML = ''
var tests = this.data.selectedTests var tests = this.data.selectedTests
......
...@@ -3,6 +3,7 @@ import * as packageJson from '../../../package.json' ...@@ -3,6 +3,7 @@ import * as packageJson from '../../../package.json'
const $ = require('jquery') const $ = require('jquery')
const yo = require('yo-yo') const yo = require('yo-yo')
const ethJSUtil = require('ethereumjs-util')
const EventManager = require('../../lib/events') const EventManager = require('../../lib/events')
const Card = require('../ui/card') const Card = require('../ui/card')
...@@ -44,6 +45,8 @@ export class RunTab extends LibraryPlugin { ...@@ -44,6 +45,8 @@ export class RunTab extends LibraryPlugin {
this.filePanel = filePanel this.filePanel = filePanel
this.compilersArtefacts = compilersArtefacts this.compilersArtefacts = compilersArtefacts
this.networkModule = networkModule this.networkModule = networkModule
executionContext.checkpointAndCommit(() => { console.log('initial checkpoint and commit of JavaScript VM') })
} }
onActivationInternal () { onActivationInternal () {
...@@ -68,7 +71,11 @@ export class RunTab extends LibraryPlugin { ...@@ -68,7 +71,11 @@ export class RunTab extends LibraryPlugin {
} }
}, },
getGasLimit: (cb) => { getGasLimit: (cb) => {
cb(null, $('#gasLimit').val()) try {
cb(null, '0x' + new ethJSUtil.BN($('#gasLimit').val(), 10).toString(16))
} catch (e) {
cb(e.message)
}
} }
}) })
} }
......
...@@ -3,7 +3,7 @@ const csjs = require('csjs-inject') ...@@ -3,7 +3,7 @@ const csjs = require('csjs-inject')
const css = csjs` const css = csjs`
.dragbar { .dragbar {
width : 1px; width : 2px;
height : 100%; height : 100%;
cursor : col-resize; cursor : col-resize;
z-index : 999; z-index : 999;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment