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
73869116
Commit
73869116
authored
Feb 13, 2018
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change exists call async
parent
26d5e1cb
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
7 deletions
+44
-7
app.js
src/app.js
+34
-5
file-explorer.js
src/app/files/file-explorer.js
+6
-1
file-panel.js
src/app/panels/file-panel.js
+4
-1
No files found.
src/app.js
View file @
73869116
...
...
@@ -214,9 +214,16 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
// ----------------- Compiler -----------------
var
compiler
=
new
Compiler
((
url
,
cb
)
=>
{
var
provider
=
fileManager
.
fileProviderOf
(
url
)
if
(
provider
&&
provider
.
exists
(
url
))
{
if
(
provider
)
{
provider
.
exists
(
url
,
(
error
,
exist
)
=>
{
if
(
error
)
return
cb
(
error
)
if
(
exist
)
{
return
provider
.
get
(
url
,
cb
)
}
else
{
return
cb
(
'file not found'
)
}
})
}
else
{
handleImports
.
import
(
url
,
(
loadingMsg
)
=>
{
$
(
'#output'
).
append
(
$
(
'<div/>'
).
append
(
$
(
'<pre/>'
).
text
(
loadingMsg
)))
...
...
@@ -229,6 +236,7 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
cb
(
error
)
}
})
}
})
var
offsetToLineColumnConverter
=
new
OffsetToLineColumnConverter
(
compiler
.
event
)
...
...
@@ -386,14 +394,26 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
this
.
_components
.
contextView
=
new
ContextView
({
contextualListener
:
this
.
_components
.
contextualListener
,
jumpTo
:
(
position
)
=>
{
function
jumpToLine
(
lineColumn
)
{
if
(
lineColumn
.
start
&&
lineColumn
.
start
.
line
&&
lineColumn
.
start
.
column
)
{
editor
.
gotoLine
(
lineColumn
.
start
.
line
,
lineColumn
.
end
.
column
+
1
)
}
}
if
(
compiler
.
lastCompilationResult
&&
compiler
.
lastCompilationResult
.
data
)
{
var
lineColumn
=
offsetToLineColumnConverter
.
offsetToLineColumn
(
position
,
position
.
file
,
compiler
.
lastCompilationResult
)
var
filename
=
compiler
.
getSourceName
(
position
.
file
)
if
(
filename
!==
config
.
get
(
'currentFile'
)
&&
(
filesProviders
[
'browser'
].
exists
(
filename
)
||
filesProviders
[
'localhost'
].
exists
(
filename
)))
{
// TODO: refactor with rendererAPI.errorClick
if
(
filename
!==
config
.
get
(
'currentFile'
))
{
var
provider
=
fileManager
.
fileProviderOf
(
filename
)
if
(
provider
)
{
provider
.
exists
(
filename
,
(
error
,
exist
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
fileManager
.
switchFile
(
filename
)
jumpToLine
(
lineColumn
)
})
}
if
(
lineColumn
.
start
&&
lineColumn
.
start
.
line
&&
lineColumn
.
start
.
column
)
{
editor
.
gotoLine
(
lineColumn
.
start
.
line
,
lineColumn
.
end
.
column
+
1
)
}
else
{
jumpToLine
(
lineColumn
)
}
}
}
...
...
@@ -541,12 +561,21 @@ Please make a backup of your contracts and start using http://remix.ethereum.org
}
},
errorClick
:
(
errFile
,
errLine
,
errCol
)
=>
{
if
(
errFile
!==
config
.
get
(
'currentFile'
)
&&
(
filesProviders
[
'browser'
].
exists
(
errFile
)
||
filesProviders
[
'localhost'
].
exists
(
errFile
)))
{
if
(
errFile
!==
config
.
get
(
'currentFile'
))
{
// TODO: refactor with this._components.contextView.jumpTo
var
provider
=
fileManager
.
fileProviderOf
(
errFile
)
if
(
provider
)
{
provider
.
exists
(
errFile
,
(
error
,
exist
)
=>
{
if
(
error
)
return
console
.
log
(
error
)
fileManager
.
switchFile
(
errFile
)
editor
.
gotoLine
(
errLine
,
errCol
)
})
}
}
else
{
editor
.
gotoLine
(
errLine
,
errCol
)
}
}
}
var
renderer
=
new
Renderer
(
rendererAPI
)
// ----------------- StaticAnalysis -----------------
...
...
src/app/files/file-explorer.js
View file @
73869116
...
...
@@ -221,12 +221,17 @@ function fileExplorer (appAPI, files) {
}
else
if
(
helper
.
checkSpecialChars
(
label
.
innerText
))
{
modalDialogCustom
.
alert
(
'Special characters are not allowed'
)
label
.
innerText
=
textUnderEdit
}
else
if
(
!
files
.
exists
(
newPath
))
{
}
else
{
files
.
exists
(
newPath
,
(
error
,
exist
)
=>
{
if
(
error
)
return
modalDialogCustom
.
alert
(
'Unexpected error while renaming: '
+
error
)
if
(
!
exist
)
{
files
.
rename
(
label
.
dataset
.
path
,
newPath
,
isFolder
)
}
else
{
modalDialogCustom
.
alert
(
'File already exists.'
)
label
.
innerText
=
textUnderEdit
}
})
}
}
if
(
event
.
which
===
13
)
event
.
preventDefault
()
...
...
src/app/panels/file-panel.js
View file @
73869116
...
...
@@ -175,12 +175,15 @@ function filepanel (appAPI, filesProvider) {
}
var
name
=
files
.
type
+
'/'
+
file
.
name
if
(
!
files
.
exists
(
name
))
{
files
.
exists
(
name
,
(
error
,
exist
)
=>
{
if
(
error
)
console
.
log
(
error
)
if
(
!
exist
)
{
loadFile
()
}
else
{
modalDialogCustom
.
confirm
(
null
,
`The file
${
name
}
already exists! Would you like to overwrite it?`
,
()
=>
{
loadFile
()
})
}
})
})
}
// ----------------- resizeable ui ---------------
...
...
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