Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump remix libs && fix remix tests module view #2295

Merged
merged 7 commits into from
Sep 3, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18,326 changes: 0 additions & 18,326 deletions package-lock.json

This file was deleted.

10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@
"npm-merge-driver": "^2.3.5",
"npm-run-all": "^4.0.2",
"onchange": "^3.2.1",
"remix-analyzer": "0.3.8",
"remix-debug": "0.3.9",
"remix-lib": "^0.4.8",
"remix-solidity": "0.3.10",
"remix-analyzer": "0.3.11",
"remix-debug": "0.3.12",
"remix-lib": "0.4.10",
"remix-solidity": "0.3.13",
"remix-tabs": "1.0.48",
"remix-tests": "0.1.13",
"remix-tests": "0.1.16",
"remixd": "0.1.8-alpha.7",
"request": "^2.83.0",
"rimraf": "^2.6.1",
Expand Down
5 changes: 3 additions & 2 deletions src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
appManager.register([
contentImport,
themeModule,
editor.sourceHighlighters,
editor,
fileManager,
compilerMetadataGenerator,
compilersArtefacts,
Expand Down Expand Up @@ -317,7 +317,8 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
registry.get('filemanager').api,
filePanel,
compileTab,
appManager
appManager,
new Renderer()
)

appManager.register([
Expand Down
20 changes: 3 additions & 17 deletions src/app/editor/SourceHighlighters.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,16 @@
'use strict'
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:
// - methods: ['highlight', 'discardHighlight'],

class SourceHighlighters extends Plugin {
class SourceHighlighters {

constructor () {
super(profile)
this.highlighters = {}
}

highlight (position, filePath, hexColor) {
const { from } = this.currentRequest
highlight (position, filePath, hexColor, from) {
try {
if (!this.highlighters[from]) this.highlighters[from] = new SourceHighlighter()
this.highlighters[from].currentSourceLocation(null)
Expand All @@ -33,8 +20,7 @@ class SourceHighlighters extends Plugin {
}
}

discardHighlight () {
const { from } = this.currentRequest
discardHighlight (from) {
if (this.highlighters[from]) this.highlighters[from].currentSourceLocation(null)
}
}
Expand Down
23 changes: 22 additions & 1 deletion src/app/editor/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ const EventManager = require('../../lib/events')
const yo = require('yo-yo')
const csjs = require('csjs-inject')
const ace = require('brace')
import { Plugin } from '@remixproject/engine'
import * as packageJson from '../../../package.json'

const globalRegistry = require('../../global/registry')
const SourceHighlighters = require('./SourceHighlighters')
Expand Down Expand Up @@ -37,9 +39,18 @@ document.head.appendChild(yo`
</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) {
super(profile)
// Dependancies
this._components = {}
this._components.registry = globalRegistry
Expand Down Expand Up @@ -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) {
this.editor.setTheme('ace/theme/' + this._themes[type])
}
Expand Down
11 changes: 6 additions & 5 deletions src/app/tabs/test-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ const profile = {
}

module.exports = class TestTab extends ViewPlugin {
constructor (fileManager, filePanel, compileTab, appManager) {
constructor (fileManager, filePanel, compileTab, appManager, renderer) {
super(profile)
this.compileTab = compileTab
this._view = { el: null }
this.compileTab = compileTab
this.fileManager = fileManager
this.filePanel = filePanel
this.data = {}
this.appManager = appManager
this.renderer = renderer
appManager.event.on('activate', (name) => {
if (name === 'solidity') this.updateRunAction(fileManager.currentFile())
})
Expand Down Expand Up @@ -117,10 +117,10 @@ module.exports = class TestTab extends ViewPlugin {
cb()
}

updateFinalResult (_err, result, filename) {
updateFinalResult (_errors, result, filename) {
this.testsSummary.hidden = false
if (_err) {
this.testsSummary.appendChild(yo`<div class="${css.testFailureSummary} text-danger" >${_err.message}</div>`)
if (_errors) {
_errors.forEach((err) => this.renderer.error(err.formattedMessage || err.message, this.testsSummary, {type: err.severity}))
return
}
this.testsSummary.appendChild(yo`<div class=${css.summaryTitle}> ${filename} </div>`)
Expand Down Expand Up @@ -178,6 +178,7 @@ module.exports = class TestTab extends ViewPlugin {
}

runTests () {
this.call('editor', 'clearAnnotations')
this.testsOutput.innerHTML = ''
this.testsSummary.innerHTML = ''
var tests = this.data.selectedTests
Expand Down
9 changes: 8 additions & 1 deletion src/app/udapp/run-tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as packageJson from '../../../package.json'

const $ = require('jquery')
const yo = require('yo-yo')
const ethJSUtil = require('ethereumjs-util')
const EventManager = require('../../lib/events')
const Card = require('../ui/card')

Expand Down Expand Up @@ -44,6 +45,8 @@ export class RunTab extends LibraryPlugin {
this.filePanel = filePanel
this.compilersArtefacts = compilersArtefacts
this.networkModule = networkModule

executionContext.checkpointAndCommit(() => { console.log('initial checkpoint and commit of JavaScript VM') })
}

onActivationInternal () {
Expand All @@ -68,7 +71,11 @@ export class RunTab extends LibraryPlugin {
}
},
getGasLimit: (cb) => {
cb(null, $('#gasLimit').val())
try {
cb(null, '0x' + new ethJSUtil.BN($('#gasLimit').val(), 10).toString(16))
} catch (e) {
cb(e.message)
}
}
})
}
Expand Down
2 changes: 1 addition & 1 deletion src/lib/panels-resize.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const csjs = require('csjs-inject')

const css = csjs`
.dragbar {
width : 1px;
width : 2px;
height : 100%;
cursor : col-resize;
z-index : 999;
Expand Down