Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
f67c4886
Commit
f67c4886
authored
Feb 08, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
use API
parent
3b68f6fb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
15 deletions
+15
-15
debugger.js
src/app/debugger.js
+15
-15
No files found.
src/app/debugger.js
View file @
f67c4886
...
@@ -7,16 +7,14 @@ var Range = ace.acequire('ace/range').Range
...
@@ -7,16 +7,14 @@ var Range = ace.acequire('ace/range').Range
/**
/**
* Manage remix and source highlighting
* Manage remix and source highlighting
*/
*/
function
Debugger
(
id
,
e
ditor
,
compiler
,
executionContextEvent
,
switchToFile
,
offsetToLineColumnConverter
)
{
function
Debugger
(
id
,
e
xecutionContextEvent
,
editorEvent
,
editorAPI
,
compilerAPI
,
contentToolAPI
)
{
this
.
el
=
document
.
querySelector
(
id
)
this
.
el
=
document
.
querySelector
(
id
)
this
.
offsetToLineColumnConverter
=
offsetToLineColumnConverter
this
.
contentToolAPI
=
contentToolAPI
this
.
debugger
=
new
remix
.
ui
.
Debugger
()
this
.
debugger
=
new
remix
.
ui
.
Debugger
()
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
.
editor
=
editor
this
.
compilerAPI
=
compilerAPI
this
.
switchToFile
=
switchToFile
this
.
editorAPI
=
editorAPI
this
.
compiler
=
compiler
this
.
markers
=
{}
var
self
=
this
var
self
=
this
executionContextEvent
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
executionContextEvent
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
...
@@ -28,16 +26,16 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
...
@@ -28,16 +26,16 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
})
})
// unload if a file has changed (but not if tabs were switched)
// unload if a file has changed (but not if tabs were switched)
editor
.
e
vent
.
register
(
'contentChanged'
,
function
()
{
editor
E
vent
.
register
(
'contentChanged'
,
function
()
{
self
.
debugger
.
unLoad
()
self
.
debugger
.
unLoad
()
})
})
// register selected code item, highlight the corresponding source location
// register selected code item, highlight the corresponding source location
this
.
debugger
.
codeManager
.
event
.
register
(
'changed'
,
this
,
function
(
code
,
address
,
index
)
{
this
.
debugger
.
codeManager
.
event
.
register
(
'changed'
,
this
,
function
(
code
,
address
,
index
)
{
if
(
self
.
compiler
.
lastCompilationResult
)
{
if
(
self
.
compiler
API
.
lastCompilationResult
()
)
{
this
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromInstructionIndex
(
address
,
index
,
self
.
compiler
.
lastCompilationResult
.
data
.
contracts
,
function
(
error
,
rawLocation
)
{
this
.
debugger
.
callTree
.
sourceLocationTracker
.
getSourceLocationFromInstructionIndex
(
address
,
index
,
self
.
compiler
API
.
lastCompilationResult
()
.
data
.
contracts
,
function
(
error
,
rawLocation
)
{
if
(
!
error
)
{
if
(
!
error
)
{
var
lineColumnPos
=
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
self
.
editor
,
self
.
compiler
.
lastCompilationResult
.
data
)
var
lineColumnPos
=
self
.
contentToolAPI
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
)
self
.
highlight
(
lineColumnPos
,
rawLocation
)
self
.
highlight
(
lineColumnPos
,
rawLocation
)
}
else
{
}
else
{
self
.
unhighlight
()
self
.
unhighlight
()
...
@@ -56,7 +54,7 @@ Debugger.prototype.debug = function (txHash) {
...
@@ -56,7 +54,7 @@ Debugger.prototype.debug = function (txHash) {
var
self
=
this
var
self
=
this
this
.
debugger
.
web3
().
eth
.
getTransaction
(
txHash
,
function
(
error
,
tx
)
{
this
.
debugger
.
web3
().
eth
.
getTransaction
(
txHash
,
function
(
error
,
tx
)
{
if
(
!
error
)
{
if
(
!
error
)
{
self
.
debugger
.
setCompilationResult
(
self
.
compiler
.
lastCompilationResult
.
data
)
self
.
debugger
.
setCompilationResult
(
self
.
compiler
API
.
lastCompilationResult
()
.
data
)
self
.
debugger
.
debug
(
tx
)
self
.
debugger
.
debug
(
tx
)
}
}
})
})
...
@@ -69,11 +67,11 @@ Debugger.prototype.debug = function (txHash) {
...
@@ -69,11 +67,11 @@ Debugger.prototype.debug = function (txHash) {
* @param {Object} rawLocation - raw position of the source code to hightlight {start, length, file, jump}
* @param {Object} rawLocation - raw position of the source code to hightlight {start, length, file, jump}
*/
*/
Debugger
.
prototype
.
highlight
=
function
(
lineColumnPos
,
rawLocation
)
{
Debugger
.
prototype
.
highlight
=
function
(
lineColumnPos
,
rawLocation
)
{
this
.
unhighlight
()
var
name
=
this
.
editorAPI
.
currentOpenedFile
()
// current opened tab
var
name
=
this
.
editor
.
getCacheFile
()
// current opened
tab
var
source
=
this
.
compilerAPI
.
lastCompilationResult
().
data
.
sourceList
[
rawLocation
.
file
]
// auto switch to that
tab
var
source
=
this
.
compiler
.
lastCompilationResult
.
data
.
sourceList
[
rawLocation
.
file
]
// auto switch to that tab
this
.
removeCurrentMarker
()
if
(
name
!==
source
)
{
if
(
name
!==
source
)
{
this
.
switchToFile
(
source
)
// command the app to swicth to the next file
this
.
editorAPI
.
switchToFile
(
source
)
// command the app to swicth to the next file
}
}
var
range
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
column
)
var
range
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
column
)
this
.
markers
[
'highlightcode'
]
=
this
.
editor
.
addMarker
(
range
,
'highlightcode'
)
this
.
markers
[
'highlightcode'
]
=
this
.
editor
.
addMarker
(
range
,
'highlightcode'
)
...
@@ -92,6 +90,8 @@ Debugger.prototype.highlight = function (lineColumnPos, rawLocation) {
...
@@ -92,6 +90,8 @@ Debugger.prototype.highlight = function (lineColumnPos, rawLocation) {
Debugger
.
prototype
.
unhighlight
=
function
(
lineColumnPos
,
rawLocation
,
cssCode
)
{
Debugger
.
prototype
.
unhighlight
=
function
(
lineColumnPos
,
rawLocation
,
cssCode
)
{
this
.
removeMarker
(
'highlightcode'
)
this
.
removeMarker
(
'highlightcode'
)
this
.
removeMarker
(
'highlightcode_fullLine'
)
this
.
removeMarker
(
'highlightcode_fullLine'
)
this
.
currentRange
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
column
)
this
.
currentMarker
=
this
.
editorAPI
.
addMarker
(
this
.
currentRange
,
'highlightcode'
)
}
}
/**
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment