Merge pull request #411 from ethereum/breakpointremix

Breakpoints
pull/1/head
yann300 8 years ago committed by GitHub
commit d2d88ce877
  1. 4
      assets/css/browser-solidity.css
  2. 20
      src/app/debugger.js
  3. 25
      src/app/editor.js
  4. 2
      test-browser/helpers/contracts.js

@ -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;
}

@ -12,7 +12,27 @@ function Debugger (id, appAPI, executionContextEvent, editorEvent) {
this.el.appendChild(this.debugger.render()) this.el.appendChild(this.debugger.render())
this.appAPI = appAPI this.appAPI = appAPI
this.breakPointManager = new remix.code.BreakpointManager(this.debugger, (sourceLocation) => {
return appAPI.offsetToLineColumn(sourceLocation, sourceLocation.file, this.editor, this.appAPI.lastCompilationResult().data)
})
this.debugger.setBreakpointManager(this.breakPointManager)
this.breakPointManager.event.register('breakpointHit', (sourceLocation) => {
})
var self = this var self = this
editorEvent.register('breakpointCleared', (fileName, row) => {
if (self.appAPI.lastCompilationResult().data) {
this.breakPointManager.remove({fileName: fileName, row: row})
}
})
editorEvent.register('breakpointAdded', (fileName, row) => {
if (self.appAPI.lastCompilationResult().data) {
this.breakPointManager.add({fileName: fileName, row: row})
}
})
executionContextEvent.register('contextChanged', this, function (context) { executionContextEvent.register('contextChanged', this, function (context) {
self.switchProvider(context) self.switchProvider(context)
}) })

@ -18,6 +18,31 @@ function Editor () {
var emptySession = createSession('') var emptySession = createSession('')
var self = this
editor.on('guttermousedown', function (e) {
var target = e.domEvent.target
if (target.className.indexOf('ace_gutter-cell') === -1) {
return
}
var row = e.getDocumentPosition().row
var breakpoints = e.editor.session.getBreakpoints()
for (var k in breakpoints) {
if (k === row.toString()) {
event.trigger('breakpointCleared', [currentSession, row])
e.editor.session.clearBreakpoint(row)
e.stop()
return
}
}
self.setBreakpoint(row)
event.trigger('breakpointAdded', [currentSession, row])
e.stop()
})
this.setBreakpoint = function (row, css) {
editor.session.setBreakpoint(row, css)
}
function createSession (content) { function createSession (content) {
var s = new ace.EditSession(content, 'ace/mode/javascript') var s = new ace.EditSession(content, 'ace/mode/javascript')
s.setUndoManager(new ace.UndoManager()) s.setUndoManager(new ace.UndoManager())

@ -21,7 +21,7 @@ function testContracts (browser, contractCode, compiledContractNames, callback)
.clearValue('#input textarea') .clearValue('#input textarea')
.click('.newFile') .click('.newFile')
.setValue('#input textarea', contractCode, function () {}) .setValue('#input textarea', contractCode, function () {})
.waitForElementPresent('.contract .create', 2000, true, function () { .waitForElementPresent('.contract .create', 5000, true, function () {
checkCompiledContracts(browser, compiledContractNames, callback) checkCompiledContracts(browser, compiledContractNames, callback)
}) })
} }

Loading…
Cancel
Save