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
818125ed
Commit
818125ed
authored
Feb 09, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
highlight the entire line
parent
bf7258a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
10 deletions
+42
-10
browser-solidity.css
assets/css/browser-solidity.css
+8
-1
debugger.js
src/app/debugger.js
+34
-9
No files found.
assets/css/browser-solidity.css
View file @
818125ed
...
...
@@ -478,5 +478,12 @@ input[type="file"] {
.highlightcode
{
position
:
absolute
;
z-index
:
20
;
background-color
:
#F
4B9B7
;
background-color
:
#F
77E79
;
}
.highlightcode_fullLine
{
position
:
absolute
;
z-index
:
20
;
background-color
:
#F4B9B7
;
opacity
:
0.5
;
}
src/app/debugger.js
View file @
818125ed
...
...
@@ -16,6 +16,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
this
.
editor
=
editor
this
.
switchToFile
=
switchToFile
this
.
compiler
=
compiler
this
.
markers
=
{}
var
self
=
this
executionContextEvent
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
...
...
@@ -23,7 +24,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
})
this
.
debugger
.
event
.
register
(
'traceUnloaded'
,
this
,
function
()
{
self
.
remove
CurrentMarker
()
self
.
remove
Markers
()
})
// unload if a file has changed (but not if tabs were switched)
...
...
@@ -39,7 +40,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
var
lineColumnPos
=
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
self
.
editor
,
self
.
compiler
.
lastCompilationResult
.
data
)
self
.
highlight
(
lineColumnPos
,
rawLocation
)
}
else
{
self
.
removeCurrentMarker
()
self
.
unhighlight
()
}
})
}
...
...
@@ -68,14 +69,29 @@ Debugger.prototype.debug = function (txHash) {
* @param {Object} rawLocation - raw position of the source code to hightlight {start, length, file, jump}
*/
Debugger
.
prototype
.
highlight
=
function
(
lineColumnPos
,
rawLocation
)
{
this
.
unhighlight
()
var
name
=
this
.
editor
.
getCacheFile
()
// current opened tab
var
source
=
this
.
compiler
.
lastCompilationResult
.
data
.
sourceList
[
rawLocation
.
file
]
// auto switch to that tab
this
.
removeCurrentMarker
()
if
(
name
!==
source
)
{
this
.
switchToFile
(
source
)
// command the app to swicth to the next file
}
this
.
currentRange
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
column
)
this
.
currentMarker
=
this
.
editor
.
addMarker
(
this
.
currentRange
,
'highlightcode'
)
var
range
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
column
)
this
.
markers
[
'highlightcode'
]
=
this
.
editor
.
addMarker
(
range
,
'highlightcode'
)
if
(
lineColumnPos
.
start
.
line
===
lineColumnPos
.
end
.
line
)
{
var
fullrange
=
new
Range
(
lineColumnPos
.
start
.
line
,
0
,
lineColumnPos
.
start
.
line
+
1
,
0
)
this
.
markers
[
'highlightcode_fullLine'
]
=
this
.
editor
.
addMarker
(
fullrange
,
'highlightcode_fullLine'
)
}
}
/**
* unhighlight the given @arg lineColumnPos
*
* @param {Object} lineColumnPos - position of the source code to hightlight {start: {line, column}, end: {line, column}}
* @param {Object} rawLocation - raw position of the source code to hightlight {start, length, file, jump}
*/
Debugger
.
prototype
.
unhighlight
=
function
(
lineColumnPos
,
rawLocation
,
cssCode
)
{
this
.
removeMarker
(
'highlightcode'
)
this
.
removeMarker
(
'highlightcode_fullLine'
)
}
/**
...
...
@@ -105,12 +121,21 @@ Debugger.prototype.web3 = function (type) {
}
/**
* unhighlight highlighted statements
*/
Debugger
.
prototype
.
removeMarkers
=
function
()
{
for
(
var
k
in
this
.
markers
)
{
this
.
removeMarker
(
k
)
}
}
/**
* unhighlight the current highlighted statement
*/
Debugger
.
prototype
.
remove
CurrentMarker
=
function
(
)
{
if
(
this
.
currentMarker
)
{
this
.
editor
.
removeMarker
(
this
.
currentMarker
)
this
.
currentMarker
=
null
Debugger
.
prototype
.
remove
Marker
=
function
(
key
)
{
if
(
this
.
markers
[
key
]
)
{
this
.
editor
.
removeMarker
(
this
.
markers
[
key
]
)
this
.
markers
[
key
]
=
null
}
}
...
...
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