Commit 053304ef authored by yann300's avatar yann300

use new API

parent 3b7d4dd5
...@@ -487,3 +487,7 @@ input[type="file"] { ...@@ -487,3 +487,7 @@ input[type="file"] {
background-color:#F4B9B7; background-color:#F4B9B7;
opacity: 0.5; opacity: 0.5;
} }
.ace_gutter-cell.ace_breakpoint{
background-color: #F77E79;
}
...@@ -11,28 +11,28 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) { ...@@ -11,28 +11,28 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) {
this.sourceMappingDecoder = new remix.util.SourceMappingDecoder() this.sourceMappingDecoder = new remix.util.SourceMappingDecoder()
this.el.appendChild(this.debugger.render()) this.el.appendChild(this.debugger.render())
this.appAPI = appAPI this.appAPI = appAPI
this.markers = {}
this.breakPointManager = new remix.code.BreakpointManager(this.debugger, (sourceLocation) => { this.breakPointManager = new remix.code.BreakpointManager(this.debugger, (sourceLocation) => {
return this.offsetToLineColumnConverter.offsetToLineColumn(sourceLocation, sourceLocation.file, this.editor, this.compiler.lastCompilationResult.data) return appAPI.offsetToLineColumn(sourceLocation, sourceLocation.file, this.editor, this.appAPI.lastCompilationResult().data)
}) })
this.debugger.setBreakpointManager(this.breakPointManager) this.debugger.setBreakpointManager(this.breakPointManager)
this.breakPointManager.event.register('breakpointHit', (sourceLocation) => { this.breakPointManager.event.register('breakpointHit', (sourceLocation) => {
}) })
var self = this
editorEvent.register('breakpointCleared', (fileName, row) => { editorEvent.register('breakpointCleared', (fileName, row) => {
if (self.compiler.lastCompilationResult.data) { if (self.appAPI.lastCompilationResult().data) {
this.breakPointManager.remove({fileName: fileName, row: row}) this.breakPointManager.remove({fileName: fileName, row: row})
} }
}) })
editorEvent.register('breakpointAdded', (fileName, row) => { editorEvent.register('breakpointAdded', (fileName, row) => {
if (self.compiler.lastCompilationResult.data) { if (self.appAPI.lastCompilationResult().data) {
this.breakPointManager.add({fileName: fileName, row: row}) this.breakPointManager.add({fileName: fileName, row: row})
} }
}) })
var self = this
executionContextEvent.register('contextChanged', this, function (context) { executionContextEvent.register('contextChanged', this, function (context) {
self.switchProvider(context) self.switchProvider(context)
}) })
...@@ -44,7 +44,6 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) { ...@@ -44,7 +44,6 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) {
// unload if a file has changed (but not if tabs were switched) // unload if a file has changed (but not if tabs were switched)
editorEvent.register('contentChanged', function () { editorEvent.register('contentChanged', function () {
self.debugger.unLoad() self.debugger.unLoad()
self.removeMarkers()
}) })
// register selected code item, highlight the corresponding source location // register selected code item, highlight the corresponding source location
...@@ -77,16 +76,6 @@ Debugger.prototype.debug = function (txHash) { ...@@ -77,16 +76,6 @@ Debugger.prototype.debug = function (txHash) {
}) })
} }
Debugger.prototype.switchFile = function (rawLocation) {
var name = this.editor.getCacheFile() // current opened tab
if (this.compiler.lastCompilationResult.data) {
var source = this.compiler.lastCompilationResult.data.sourceList[rawLocation.file] // auto switch to that tab
if (name !== source) {
this.switchToFile(source) // command the app to swicth to the next file
}
}
}
/** /**
* add a new web3 provider to remix * add a new web3 provider to remix
* *
......
...@@ -28,14 +28,14 @@ function Editor () { ...@@ -28,14 +28,14 @@ function Editor () {
var breakpoints = e.editor.session.getBreakpoints() var breakpoints = e.editor.session.getBreakpoints()
for (var k in breakpoints) { for (var k in breakpoints) {
if (k === row.toString()) { if (k === row.toString()) {
event.trigger('breakpointCleared', [self.getCacheFile(), row]) event.trigger('breakpointCleared', [currentSession, row])
e.editor.session.clearBreakpoint(row) e.editor.session.clearBreakpoint(row)
e.stop() e.stop()
return return
} }
} }
self.setBreakpoint(row) self.setBreakpoint(row)
event.trigger('breakpointAdded', [self.getCacheFile(), row]) event.trigger('breakpointAdded', [currentSession, row])
e.stop() e.stop()
}) })
......
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