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
0a668571
Commit
0a668571
authored
Feb 13, 2017
by
yann300
Committed by
GitHub
Feb 13, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #420 from ethereum/highlight
highlight the entire line
parents
bf7258a2
818125ed
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 @
0a668571
...
@@ -478,5 +478,12 @@ input[type="file"] {
...
@@ -478,5 +478,12 @@ input[type="file"] {
.highlightcode
{
.highlightcode
{
position
:
absolute
;
position
:
absolute
;
z-index
:
20
;
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 @
0a668571
...
@@ -16,6 +16,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
...
@@ -16,6 +16,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
this
.
editor
=
editor
this
.
editor
=
editor
this
.
switchToFile
=
switchToFile
this
.
switchToFile
=
switchToFile
this
.
compiler
=
compiler
this
.
compiler
=
compiler
this
.
markers
=
{}
var
self
=
this
var
self
=
this
executionContextEvent
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
executionContextEvent
.
register
(
'contextChanged'
,
this
,
function
(
context
)
{
...
@@ -23,7 +24,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
...
@@ -23,7 +24,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
})
})
this
.
debugger
.
event
.
register
(
'traceUnloaded'
,
this
,
function
()
{
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)
// unload if a file has changed (but not if tabs were switched)
...
@@ -39,7 +40,7 @@ function Debugger (id, editor, compiler, executionContextEvent, switchToFile, of
...
@@ -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
)
var
lineColumnPos
=
self
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
rawLocation
,
rawLocation
.
file
,
self
.
editor
,
self
.
compiler
.
lastCompilationResult
.
data
)
self
.
highlight
(
lineColumnPos
,
rawLocation
)
self
.
highlight
(
lineColumnPos
,
rawLocation
)
}
else
{
}
else
{
self
.
removeCurrentMarker
()
self
.
unhighlight
()
}
}
})
})
}
}
...
@@ -68,14 +69,29 @@ Debugger.prototype.debug = function (txHash) {
...
@@ -68,14 +69,29 @@ 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
.
editor
.
getCacheFile
()
// current opened tab
var
name
=
this
.
editor
.
getCacheFile
()
// current opened tab
var
source
=
this
.
compiler
.
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
.
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
)
var
range
=
new
Range
(
lineColumnPos
.
start
.
line
,
lineColumnPos
.
start
.
column
,
lineColumnPos
.
end
.
line
,
lineColumnPos
.
end
.
column
)
this
.
currentMarker
=
this
.
editor
.
addMarker
(
this
.
currentRange
,
'highlightcode'
)
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) {
...
@@ -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
* unhighlight the current highlighted statement
*/
*/
Debugger
.
prototype
.
remove
CurrentMarker
=
function
(
)
{
Debugger
.
prototype
.
remove
Marker
=
function
(
key
)
{
if
(
this
.
currentMarker
)
{
if
(
this
.
markers
[
key
]
)
{
this
.
editor
.
removeMarker
(
this
.
currentMarker
)
this
.
editor
.
removeMarker
(
this
.
markers
[
key
]
)
this
.
currentMarker
=
null
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