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
cb2a9683
Unverified
Commit
cb2a9683
authored
Nov 03, 2020
by
David Disu
Committed by
GitHub
Nov 03, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #526 from ethereum/highlightsCleaner
Hide Highlights of plugin if not in focused
parents
d9de096e
e57a4553
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
68 additions
and
17 deletions
+68
-17
editor.test.ts
apps/remix-ide-e2e/src/tests/editor.test.ts
+15
-6
side-panel.js
apps/remix-ide/src/app/components/side-panel.js
+6
-0
SourceHighlighters.js
apps/remix-ide/src/app/editor/SourceHighlighters.js
+27
-3
contextualListener.js
apps/remix-ide/src/app/editor/contextualListener.js
+4
-3
editor.js
apps/remix-ide/src/app/editor/editor.js
+10
-1
sourceHighlighter.js
apps/remix-ide/src/app/editor/sourceHighlighter.js
+5
-3
darkTheme.js
apps/remix-ide/src/assets/js/editor/darkTheme.js
+1
-1
No files found.
apps/remix-ide-e2e/src/tests/editor.test.ts
View file @
cb2a9683
...
@@ -77,7 +77,10 @@ module.exports = {
...
@@ -77,7 +77,10 @@ module.exports = {
},
},
'Should highlight source code'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should highlight source code'
:
function
(
browser
:
NightwatchBrowser
)
{
// include all files here because switching between plugins in side-panel removes highlight
browser
.
addFile
(
'sourcehighlight.js'
,
sourcehighlightScript
)
browser
.
addFile
(
'sourcehighlight.js'
,
sourcehighlightScript
)
.
addFile
(
'removeSourcehighlightScript.js'
,
removeSourcehighlightScript
)
.
addFile
(
'removeAllSourcehighlightScript.js'
,
removeAllSourcehighlightScript
)
.
openFile
(
'browser/sourcehighlight.js'
)
.
openFile
(
'browser/sourcehighlight.js'
)
.
executeScript
(
'remix.exeCurrent()'
)
.
executeScript
(
'remix.exeCurrent()'
)
.
editorScroll
(
'down'
,
60
)
.
editorScroll
(
'down'
,
60
)
...
@@ -90,20 +93,26 @@ module.exports = {
...
@@ -90,20 +93,26 @@ module.exports = {
},
},
'Should remove 1 highlight from source code'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should remove 1 highlight from source code'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
addFile
(
'removeSourcehighlightScript.js'
,
removeSourcehighlightScript
)
browser
.
waitForElementVisible
(
'li[key="browser/removeSourcehighlightScript.js"]'
)
.
openFile
(
'browser/removeSourcehighlightScript.js'
)
.
click
(
'li[key="browser/removeSourcehighlightScript.js"]'
)
.
pause
(
2000
)
.
executeScript
(
'remix.exeCurrent()'
)
.
executeScript
(
'remix.exeCurrent()'
)
.
openFile
(
'browser/3_Ballot.sol'
)
.
waitForElementVisible
(
'li[key="browser/3_Ballot.sol"]'
)
.
click
(
'li[key="browser/3_Ballot.sol"]'
)
.
pause
(
2000
)
.
waitForElementNotPresent
(
'.highlightLine32'
)
.
waitForElementNotPresent
(
'.highlightLine32'
)
.
checkElementStyle
(
'.highlightLine40'
,
'background-color'
,
'rgb(8, 108, 181)'
)
.
checkElementStyle
(
'.highlightLine40'
,
'background-color'
,
'rgb(8, 108, 181)'
)
.
checkElementStyle
(
'.highlightLine50'
,
'background-color'
,
'rgb(8, 108, 181)'
)
.
checkElementStyle
(
'.highlightLine50'
,
'background-color'
,
'rgb(8, 108, 181)'
)
},
},
'Should remove all highlights from source code'
:
function
(
browser
:
NightwatchBrowser
)
{
'Should remove all highlights from source code'
:
function
(
browser
:
NightwatchBrowser
)
{
browser
.
addFile
(
'removeAllSourcehighlightScript.js'
,
removeAllSourcehighlightScript
)
browser
.
waitForElementVisible
(
'li[key="browser/removeAllSourcehighlightScript.js"]'
)
.
openFile
(
'browser/removeAllSourcehighlightScript.js'
)
.
click
(
'li[key="browser/removeAllSourcehighlightScript.js"]'
)
.
pause
(
2000
)
.
executeScript
(
'remix.exeCurrent()'
)
.
executeScript
(
'remix.exeCurrent()'
)
.
openFile
(
'browser/3_Ballot.sol'
)
.
waitForElementVisible
(
'li[key="browser/3_Ballot.sol"]'
)
.
click
(
'li[key="browser/3_Ballot.sol"]'
)
.
pause
(
2000
)
.
waitForElementNotPresent
(
'.highlightLine32'
)
.
waitForElementNotPresent
(
'.highlightLine32'
)
.
waitForElementNotPresent
(
'.highlightLine40'
)
.
waitForElementNotPresent
(
'.highlightLine40'
)
.
waitForElementNotPresent
(
'.highlightLine50'
)
.
waitForElementNotPresent
(
'.highlightLine50'
)
...
...
apps/remix-ide/src/app/components/side-panel.js
View file @
cb2a9683
...
@@ -91,8 +91,13 @@ export class SidePanel extends AbstractPanel {
...
@@ -91,8 +91,13 @@ export class SidePanel extends AbstractPanel {
})
})
}
}
focus
(
name
)
{
this
.
emit
(
'focusChanged'
,
name
)
}
removeView
(
profile
)
{
removeView
(
profile
)
{
super
.
removeView
(
profile
)
super
.
removeView
(
profile
)
this
.
emit
(
'pluginDisabled'
,
profile
.
name
)
this
.
verticalIcons
.
unlinkContent
(
profile
)
this
.
verticalIcons
.
unlinkContent
(
profile
)
}
}
...
@@ -108,6 +113,7 @@ export class SidePanel extends AbstractPanel {
...
@@ -108,6 +113,7 @@ export class SidePanel extends AbstractPanel {
async
showContent
(
name
)
{
async
showContent
(
name
)
{
super
.
showContent
(
name
)
super
.
showContent
(
name
)
this
.
renderHeader
()
this
.
renderHeader
()
this
.
focus
(
name
)
}
}
/** The header of the side panel */
/** The header of the side panel */
...
...
apps/remix-ide/src/app/editor/SourceHighlighters.js
View file @
cb2a9683
'use strict'
'use strict'
const
SourceHighlighter
=
require
(
'./sourceHighlighter'
)
const
SourceHighlighter
=
require
(
'./sourceHighlighter'
)
// EditorApi:
// - methods: ['highlight', 'discardHighlight'],
class
SourceHighlighters
{
class
SourceHighlighters
{
constructor
()
{
constructor
()
{
...
@@ -28,6 +25,24 @@ class SourceHighlighters {
...
@@ -28,6 +25,24 @@ class SourceHighlighters {
}
}
}
}
// highlights all locations for @from plugin
highlightAllFrom
(
from
)
{
try
{
if
(
!
this
.
highlighters
[
from
])
return
const
sourceHighlight
=
new
SourceHighlighter
()
for
(
const
index
in
this
.
highlighters
[
from
])
{
sourceHighlight
.
currentSourceLocationFromfileName
(
this
.
highlighters
[
from
][
index
].
position
,
this
.
highlighters
[
from
][
index
].
source
,
this
.
highlighters
[
from
][
index
].
style
)
this
.
highlighters
[
from
][
index
]
=
sourceHighlight
}
}
catch
(
e
)
{
throw
e
}
}
discardHighlight
(
from
)
{
discardHighlight
(
from
)
{
if
(
this
.
highlighters
[
from
])
{
if
(
this
.
highlighters
[
from
])
{
for
(
const
index
in
this
.
highlighters
[
from
])
this
.
highlighters
[
from
][
index
].
currentSourceLocation
(
null
)
for
(
const
index
in
this
.
highlighters
[
from
])
this
.
highlighters
[
from
][
index
].
currentSourceLocation
(
null
)
...
@@ -35,6 +50,15 @@ class SourceHighlighters {
...
@@ -35,6 +50,15 @@ class SourceHighlighters {
this
.
highlighters
[
from
]
=
[]
this
.
highlighters
[
from
]
=
[]
}
}
hideHighlightsExcept
(
toStay
)
{
for
(
const
highlighter
in
this
.
highlighters
)
{
for
(
const
index
in
this
.
highlighters
[
highlighter
])
{
this
.
highlighters
[
highlighter
][
index
].
currentSourceLocation
(
null
)
}
this
.
highlightAllFrom
(
toStay
)
}
}
discardHighlightAt
(
line
,
filePath
,
from
)
{
discardHighlightAt
(
line
,
filePath
,
from
)
{
if
(
this
.
highlighters
[
from
])
{
if
(
this
.
highlighters
[
from
])
{
for
(
const
index
in
this
.
highlighters
[
from
])
{
for
(
const
index
in
this
.
highlighters
[
from
])
{
...
...
apps/remix-ide/src/app/editor/contextualListener.js
View file @
cb2a9683
...
@@ -123,14 +123,15 @@ class ContextualListener extends Plugin {
...
@@ -123,14 +123,15 @@ class ContextualListener extends Plugin {
}
}
_highlightInternal
(
position
,
node
)
{
_highlightInternal
(
position
,
node
)
{
if
(
node
.
nodeType
===
'Block'
)
return
let
lastCompilationResult
=
this
.
_deps
.
compilersArtefacts
[
'__last'
]
let
lastCompilationResult
=
this
.
_deps
.
compilersArtefacts
[
'__last'
]
if
(
lastCompilationResult
&&
lastCompilationResult
.
languageversion
.
indexOf
(
'soljson'
)
===
0
)
{
if
(
lastCompilationResult
&&
lastCompilationResult
.
languageversion
.
indexOf
(
'soljson'
)
===
0
)
{
let
lineColumn
=
this
.
_deps
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
position
,
position
.
file
,
lastCompilationResult
.
getSourceCode
().
sources
,
lastCompilationResult
.
getAsts
())
let
lineColumn
=
this
.
_deps
.
offsetToLineColumnConverter
.
offsetToLineColumn
(
position
,
position
.
file
,
lastCompilationResult
.
getSourceCode
().
sources
,
lastCompilationResult
.
getAsts
())
const
css
=
csjs
`
const
css
=
csjs
`
.highlightref_fullLine {
.highlightref_fullLine {
position:absolute;
position:
absolute;
z-index:2;
z-index:
2;
opacity: 0.
4
;
opacity: 0.
1
;
background-color: var(--info);
background-color: var(--info);
}
}
`
`
...
...
apps/remix-ide/src/app/editor/editor.js
View file @
cb2a9683
...
@@ -189,7 +189,6 @@ class Editor extends Plugin {
...
@@ -189,7 +189,6 @@ class Editor extends Plugin {
this
.
editor
.
on
(
'changeSession'
,
()
=>
{
this
.
editor
.
on
(
'changeSession'
,
()
=>
{
this
.
_onChange
()
this
.
_onChange
()
this
.
event
.
trigger
(
'sessionSwitched'
,
[])
this
.
event
.
trigger
(
'sessionSwitched'
,
[])
this
.
editor
.
getSession
().
on
(
'change'
,
()
=>
{
this
.
editor
.
getSession
().
on
(
'change'
,
()
=>
{
this
.
_onChange
()
this
.
_onChange
()
this
.
event
.
trigger
(
'contentChanged'
,
[])
this
.
event
.
trigger
(
'contentChanged'
,
[])
...
@@ -197,6 +196,16 @@ class Editor extends Plugin {
...
@@ -197,6 +196,16 @@ class Editor extends Plugin {
})
})
}
}
onActivation
()
{
this
.
on
(
'sidePanel'
,
'focusChanged'
,
(
name
)
=>
this
.
sourceHighlighters
.
hideHighlightsExcept
(
name
))
this
.
on
(
'sidePanel'
,
'pluginDisabled'
,
(
name
)
=>
this
.
sourceHighlighters
.
discardHighlight
(
name
))
}
onDeactivation
()
{
this
.
off
(
'sidePanel'
,
'focusChanged'
)
this
.
off
(
'sidePanel'
,
'pluginDisabled'
)
}
highlight
(
position
,
filePath
,
hexColor
)
{
highlight
(
position
,
filePath
,
hexColor
)
{
const
{
from
}
=
this
.
currentRequest
const
{
from
}
=
this
.
currentRequest
this
.
sourceHighlighters
.
highlight
(
position
,
filePath
,
hexColor
,
from
)
this
.
sourceHighlighters
.
highlight
(
position
,
filePath
,
hexColor
,
from
)
...
...
apps/remix-ide/src/app/editor/sourceHighlighter.js
View file @
cb2a9683
...
@@ -39,6 +39,8 @@ class SourceHighlighter {
...
@@ -39,6 +39,8 @@ class SourceHighlighter {
this
.
source
=
null
this
.
source
=
null
if
(
lineColumnPos
)
{
if
(
lineColumnPos
)
{
this
.
source
=
filePath
this
.
source
=
filePath
this
.
style
=
style
||
'var(--info)'
//if (!this.source) this.source = this._deps.fileManager.currentFile()
if
(
this
.
_deps
.
fileManager
.
currentFile
()
!==
this
.
source
)
{
if
(
this
.
_deps
.
fileManager
.
currentFile
()
!==
this
.
source
)
{
await
this
.
_deps
.
fileManager
.
open
(
this
.
source
)
await
this
.
_deps
.
fileManager
.
open
(
this
.
source
)
this
.
source
=
this
.
_deps
.
fileManager
.
currentFile
()
this
.
source
=
this
.
_deps
.
fileManager
.
currentFile
()
...
@@ -49,16 +51,16 @@ class SourceHighlighter {
...
@@ -49,16 +51,16 @@ class SourceHighlighter {
position:absolute;
position:absolute;
z-index:20;
z-index:20;
opacity: 0.3;
opacity: 0.3;
background-color:
${
style
||
'var(--info)'
}
;
background-color:
${
this
.
style
}
;
}
}
.highlightcode_fullLine {
.highlightcode_fullLine {
position:absolute;
position:absolute;
z-index:20;
z-index:20;
opacity: 0.5;
opacity: 0.5;
background-color:
${
style
||
'var(--info)'
}
;
background-color:
${
this
.
style
}
;
}
}
.customBackgroundColor {
.customBackgroundColor {
background-color:
${
style
||
'var(--info)'
}
;
background-color:
${
this
.
style
}
;
}
}
`
`
...
...
apps/remix-ide/src/assets/js/editor/darkTheme.js
View file @
cb2a9683
...
@@ -50,7 +50,7 @@ ace.define("ace/theme/remixDark",["require","exports","module","ace/lib/dom"], f
...
@@ -50,7 +50,7 @@ ace.define("ace/theme/remixDark",["require","exports","module","ace/lib/dom"], f
border: 1px solid #FCE94F;
\
border: 1px solid #FCE94F;
\
}
\
}
\
.ace-remixDark .ace_marker-layer .ace_active-line {
\
.ace-remixDark .ace_marker-layer .ace_active-line {
\
background: #
363950
;
\
background: #
262843
;
\
}
\
}
\
.ace-remixDark .ace_gutter-active-line {
\
.ace-remixDark .ace_gutter-active-line {
\
background-color: #363950;
\
background-color: #363950;
\
...
...
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