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
f7cf4a95
Unverified
Commit
f7cf4a95
authored
Nov 26, 2020
by
yann300
Committed by
GitHub
Nov 26, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #621 from ethereum/refactorDebugger
refactor debugger component
parents
9a3f4e9b
98e31c2f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
97 additions
and
12 deletions
+97
-12
debugger-tab.js
apps/remix-ide/src/app/tabs/debugger-tab.js
+17
-1
index.ts
libs/remix-solidity/src/index.ts
+3
-2
DebuggerAPI.ts
libs/remix-ui/debugger-ui/src/lib/DebuggerAPI.ts
+65
-0
debugger-ui.tsx
libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx
+10
-8
tsconfig.json
tsconfig.json
+2
-1
No files found.
apps/remix-ide/src/app/tabs/debugger-tab.js
View file @
f7cf4a95
...
@@ -68,9 +68,25 @@ class DebuggerTab extends ViewPlugin {
...
@@ -68,9 +68,25 @@ class DebuggerTab extends ViewPlugin {
return
this
.
el
return
this
.
el
}
}
async
discardHighlight
()
{
await
this
.
call
(
'editor'
,
'discardHighlight'
)
}
async
highlight
(
lineColumnPos
,
path
)
{
await
this
.
call
(
'editor'
,
'highlight'
,
lineColumnPos
,
path
)
}
async
getFile
(
path
)
{
await
this
.
call
(
'fileManager'
,
'getFile'
,
path
)
}
async
setFile
(
path
,
content
)
{
await
this
.
call
(
'fileManager'
,
'setFile'
,
path
,
content
)
}
renderComponent
()
{
renderComponent
()
{
ReactDOM
.
render
(
ReactDOM
.
render
(
<
DebuggerUI
debugger
Module
=
{
this
}
/
>
<
DebuggerUI
debugger
API
=
{
this
}
/
>
,
this
.
el
)
,
this
.
el
)
}
}
...
...
libs/remix-solidity/src/index.ts
View file @
f7cf4a95
export
{
Compiler
}
from
'./compiler/compiler'
export
{
Compiler
}
from
'./compiler/compiler'
export
{
default
as
CompilerInput
}
from
'./compiler/compiler-input'
export
{
default
as
CompilerInput
}
from
'./compiler/compiler-input'
export
*
from
'./compiler/types'
libs/remix-ui/debugger-ui/src/lib/DebuggerAPI.ts
0 → 100644
View file @
f7cf4a95
import
type
{
CompilationResult
,
CompilationSource
}
from
'@remix-project/remix-solidity-ts'
export
interface
DebuggerUIProps
{
debuggerAPI
:
DebuggerAPI
}
interface
EditorEvent
{
event
:
{
register
(
eventName
:
'breakpointCleared'
|
'breakpointAdded'
|
'contentChanged'
,
callback
:
(
fileName
:
string
,
row
:
string
|
number
)
=>
void
)
}
}
interface
LineColumnLocation
{
start
:
{
line
:
number
,
column
:
number
},
end
:
{
line
:
number
,
column
:
number
}
}
interface
RawLocation
{
start
:
number
,
length
:
number
}
interface
Sources
{
[
fileName
:
string
]
:
{
content
:
string
}
}
interface
CompilationOutput
{
source
:
{
sources
:
Sources
,
target
:
string
}
data
:
CompilationResult
getSourceName
:
(
id
:
number
)
=>
string
}
interface
Asts
{
[
fileName
:
string
]
:
CompilationSource
// ast
}
interface
TransactionReceipt
{
blockHash
:
string
blockNumber
:
number
transactionHash
:
string
transactionIndex
:
number
from
:
string
to
:
string
contractAddress
:
string
|
null
}
export
interface
DebuggerAPI
{
offsetToLineColumnConverter
:
{
offsetToLineColumn
:
(
sourceLocation
:
RawLocation
,
file
:
number
,
contents
:
Sources
,
asts
:
Asts
)
=>
LineColumnLocation
}
debugHash
:
string
debugHashRequest
:
string
removeHighlights
:
boolean
editor
:
EditorEvent
discardHighlight
:
()
=>
void
highlight
:
(
lineColumnPos
:
LineColumnLocation
,
path
:
string
)
=>
void
fetchContractAndCompile
:
(
address
:
string
,
currentReceipt
:
TransactionReceipt
)
=>
CompilationOutput
getFile
:
(
path
:
string
)
=>
string
setFile
:
(
path
:
string
,
content
:
string
)
=>
void
getDebugWeb3
:
()
=>
any
// returns an instance of web3.js
}
\ No newline at end of file
libs/remix-ui/debugger-ui/src/lib/debugger-ui.tsx
View file @
f7cf4a95
...
@@ -3,11 +3,13 @@ import TxBrowser from './tx-browser/tx-browser'
...
@@ -3,11 +3,13 @@ import TxBrowser from './tx-browser/tx-browser'
import
StepManager
from
'./step-manager/step-manager'
import
StepManager
from
'./step-manager/step-manager'
import
VmDebugger
from
'./vm-debugger/vm-debugger'
import
VmDebugger
from
'./vm-debugger/vm-debugger'
import
VmDebuggerHead
from
'./vm-debugger/vm-debugger-head'
import
VmDebuggerHead
from
'./vm-debugger/vm-debugger-head'
import
remixDebug
,
{
TransactionDebugger
as
Debugger
}
from
'@remix-project/remix-debug'
import
{
TransactionDebugger
as
Debugger
}
from
'@remix-project/remix-debug'
import
{
DebuggerAPI
,
DebuggerUIProps
}
from
'./DebuggerAPI'
/* eslint-disable-next-line */
/* eslint-disable-next-line */
import
'./debugger-ui.css'
import
'./debugger-ui.css'
export
const
DebuggerUI
=
({
debuggerModule
})
=>
{
export
const
DebuggerUI
=
(
props
:
DebuggerUIProps
)
=>
{
const
debuggerModule
=
props
.
debuggerAPI
const
[
state
,
setState
]
=
useState
({
const
[
state
,
setState
]
=
useState
({
isActive
:
false
,
isActive
:
false
,
statusMessage
:
''
,
statusMessage
:
''
,
...
@@ -64,7 +66,7 @@ export const DebuggerUI = ({ debuggerModule }) => {
...
@@ -64,7 +66,7 @@ export const DebuggerUI = ({ debuggerModule }) => {
if
(
!
debuggerInstance
)
return
if
(
!
debuggerInstance
)
return
debuggerInstance
.
event
.
register
(
'debuggerStatus'
,
async
(
isActive
)
=>
{
debuggerInstance
.
event
.
register
(
'debuggerStatus'
,
async
(
isActive
)
=>
{
await
debuggerModule
.
call
(
'editor'
,
'discardHighlight'
)
await
debuggerModule
.
discardHighlight
(
)
setState
(
prevState
=>
{
setState
(
prevState
=>
{
return
{
...
prevState
,
isActive
}
return
{
...
prevState
,
isActive
}
})
})
...
@@ -85,20 +87,20 @@ export const DebuggerUI = ({ debuggerModule }) => {
...
@@ -85,20 +87,20 @@ export const DebuggerUI = ({ debuggerModule }) => {
path
=
`browser/.debugger/generated-sources/
${
source
.
name
}
`
path
=
`browser/.debugger/generated-sources/
${
source
.
name
}
`
let
content
let
content
try
{
try
{
content
=
await
debuggerModule
.
call
(
'fileManager'
,
'getFile'
,
path
,
source
.
contents
)
content
=
await
debuggerModule
.
getFile
(
path
)
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
'unable to fetch generated sources, the file probably doesn
\'
t exist yet'
,
e
)
console
.
log
(
'unable to fetch generated sources, the file probably doesn
\'
t exist yet'
,
e
)
}
}
if
(
content
!==
source
.
contents
)
{
if
(
content
!==
source
.
contents
)
{
await
debuggerModule
.
call
(
'fileManager'
,
'setFile'
,
path
,
source
.
contents
)
await
debuggerModule
.
setFile
(
path
,
source
.
contents
)
}
}
break
break
}
}
}
}
}
}
if
(
path
)
{
if
(
path
)
{
await
debuggerModule
.
call
(
'editor'
,
'discardHighlight'
)
await
debuggerModule
.
discardHighlight
(
)
await
debuggerModule
.
call
(
'editor'
,
'highlight'
,
lineColumnPos
,
path
)
await
debuggerModule
.
highlight
(
lineColumnPos
,
path
)
}
}
}
}
})
})
...
@@ -183,7 +185,7 @@ const debug = (txHash) => {
...
@@ -183,7 +185,7 @@ const debug = (txHash) => {
const
deleteHighlights
=
async
()
=>
{
const
deleteHighlights
=
async
()
=>
{
await
debuggerModule
.
call
(
'editor'
,
'discardHighlight'
)
await
debuggerModule
.
discardHighlight
(
)
}
}
const
stepManager
=
{
const
stepManager
=
{
...
...
tsconfig.json
View file @
f7cf4a95
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
"@remix-ui/tree-view"
:
[
"libs/remix-ui/tree-view/src/index.ts"
],
"@remix-ui/tree-view"
:
[
"libs/remix-ui/tree-view/src/index.ts"
],
"@remix-ui/debugger-ui"
:
[
"libs/remix-ui/debugger-ui/src/index.ts"
],
"@remix-ui/debugger-ui"
:
[
"libs/remix-ui/debugger-ui/src/index.ts"
],
"@remix-ui/utils"
:
[
"libs/remix-ui/utils/src/index.ts"
],
"@remix-ui/utils"
:
[
"libs/remix-ui/utils/src/index.ts"
],
"@remix-ui/clipboard"
:
[
"libs/remix-ui/clipboard/src/index.ts"
]
"@remix-ui/clipboard"
:
[
"libs/remix-ui/clipboard/src/index.ts"
],
"@remix-project/remix-solidity-ts"
:
[
"libs/remix-solidity/src/index.ts"
],
}
}
},
},
"exclude"
:
[
"node_modules"
,
"tmp"
]
"exclude"
:
[
"node_modules"
,
"tmp"
]
...
...
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