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
6a4c434c
Commit
6a4c434c
authored
Sep 25, 2017
by
yann300
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renaming
parent
c27f8281
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
28 deletions
+24
-28
app.js
src/app.js
+2
-2
contextualListener.js
src/app/editor/contextualListener.js
+22
-26
No files found.
src/app.js
View file @
6a4c434c
...
...
@@ -394,11 +394,11 @@ function run () {
getCompilationResult
:
()
=>
{
return
compiler
.
lastCompilationResult
},
warnExpression
:
(
position
)
=>
{
highlight
:
(
position
,
node
)
=>
{
position
=
offsetToLineColumnConverter
.
offsetToLineColumn
(
position
,
position
.
file
,
compiler
.
lastCompilationResult
)
return
editor
.
addMarker
(
position
,
config
.
get
(
'currentFile'
),
'highlightcall'
)
},
stop
WarningExpression
:
(
event
)
=>
{
stop
Highlighting
:
(
event
)
=>
{
editor
.
removeMarker
(
event
.
eventId
,
event
.
fileTarget
)
}
},
{
...
...
src/app/editor/contextualListener.js
View file @
6a4c434c
...
...
@@ -6,16 +6,16 @@ class ContextualListener {
constructor
(
api
,
events
)
{
this
.
_api
=
api
this
.
_index
=
{
Referenced
Declarations
:
{},
Expression
s
:
[]
Declarations
:
{},
Reference
s
:
[]
}
this
.
_events
=
[]
events
.
compiler
.
register
(
'compilationFinished'
,
(
success
,
data
,
source
)
=>
{
this
.
_stop
Warn
ing
()
this
.
_stop
Highlight
ing
()
this
.
_index
=
{
Referenced
Declarations
:
{},
Expression
s
:
[]
Declarations
:
{},
Reference
s
:
[]
}
if
(
success
)
{
this
.
_buildIndex
(
data
,
source
)
...
...
@@ -24,18 +24,18 @@ class ContextualListener {
this
.
sourceMappingDecoder
=
new
SourceMappingDecoder
()
this
.
astWalker
=
new
AstWalker
()
setInterval
(()
=>
{
this
.
_
warnExpressions
(
api
.
getCursorPosition
(),
api
.
getCompilationResult
())
this
.
_
highlight
(
api
.
getCursorPosition
(),
api
.
getCompilationResult
())
},
1000
)
}
_
warnExpressions
(
cursorPosition
,
compilationResult
)
{
_
highlight
(
cursorPosition
,
compilationResult
)
{
if
(
this
.
currentPosition
===
cursorPosition
)
return
this
.
_stop
Warn
ing
()
this
.
_stop
Highlight
ing
()
this
.
currentPosition
=
cursorPosition
if
(
compilationResult
&&
compilationResult
.
data
&&
compilationResult
.
source
)
{
var
nodes
=
this
.
sourceMappingDecoder
.
nodesAtPosition
(
null
,
cursorPosition
,
compilationResult
.
data
.
sources
[
compilationResult
.
source
.
target
])
if
(
nodes
&&
nodes
.
length
&&
nodes
[
nodes
.
length
-
1
])
{
this
.
_
warnExpression
(
nodes
[
nodes
.
length
-
1
],
compilationResult
)
this
.
_
hightlightExpressions
(
nodes
[
nodes
.
length
-
1
],
compilationResult
)
}
}
}
...
...
@@ -46,11 +46,11 @@ class ContextualListener {
var
callback
=
{}
callback
[
'*'
]
=
function
(
node
)
{
if
(
node
&&
node
.
attributes
&&
node
.
attributes
.
referencedDeclaration
)
{
if
(
!
self
.
_index
[
'
Referenced
Declarations'
][
node
.
attributes
.
referencedDeclaration
])
{
self
.
_index
[
'
Referenced
Declarations'
][
node
.
attributes
.
referencedDeclaration
]
=
[]
if
(
!
self
.
_index
[
'Declarations'
][
node
.
attributes
.
referencedDeclaration
])
{
self
.
_index
[
'Declarations'
][
node
.
attributes
.
referencedDeclaration
]
=
[]
}
self
.
_index
[
'
Referenced
Declarations'
][
node
.
attributes
.
referencedDeclaration
].
push
(
node
)
self
.
_index
[
'
Expression
s'
].
push
(
node
)
self
.
_index
[
'Declarations'
][
node
.
attributes
.
referencedDeclaration
].
push
(
node
)
self
.
_index
[
'
Reference
s'
].
push
(
node
)
}
return
true
}
...
...
@@ -58,17 +58,19 @@ class ContextualListener {
}
}
_
warnExpression
(
node
,
compilationResult
)
{
_
hightlightExpressions
(
node
,
compilationResult
)
{
var
self
=
this
function
highlight
(
id
)
{
if
(
self
.
_index
[
'
ReferencedDeclarations'
]
&&
self
.
_index
[
'Referenced
Declarations'
][
id
])
{
var
calls
=
self
.
_index
[
'
Referenced
Declarations'
][
id
]
if
(
self
.
_index
[
'
Declarations'
]
&&
self
.
_index
[
'
Declarations'
][
id
])
{
var
calls
=
self
.
_index
[
'Declarations'
][
id
]
for
(
var
call
in
calls
)
{
self
.
_warn
(
calls
[
call
].
src
,
compilationResult
)
var
node
=
calls
[
call
]
var
position
=
self
.
sourceMappingDecoder
.
decode
(
node
.
src
)
var
eventId
=
self
.
_api
.
highlight
(
position
,
node
)
self
.
_events
.
push
({
eventId
,
position
,
fileTarget
:
compilationResult
.
source
.
target
})
}
}
}
if
(
node
.
attributes
&&
node
.
attributes
.
referencedDeclaration
)
{
highlight
(
node
.
attributes
.
referencedDeclaration
)
}
else
{
...
...
@@ -76,15 +78,9 @@ class ContextualListener {
}
}
_warn
(
src
,
compilationResult
)
{
var
position
=
this
.
sourceMappingDecoder
.
decode
(
src
)
var
eventId
=
this
.
_api
.
warnExpression
(
position
)
this
.
_events
.
push
({
eventId
,
position
,
fileTarget
:
compilationResult
.
source
.
target
})
}
_stopWarning
()
{
_stopHighlighting
()
{
for
(
var
event
in
this
.
_events
)
{
this
.
_api
.
stop
WarningExpression
(
this
.
_events
[
event
])
this
.
_api
.
stop
Highlighting
(
this
.
_events
[
event
])
}
this
.
_events
=
[]
}
...
...
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