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
177fb686
Commit
177fb686
authored
Nov 26, 2021
by
gxkai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 暂时移除高亮
parent
1844a594
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
37 additions
and
33 deletions
+37
-33
contextualListener.js
apps/remix-ide/src/app/editor/contextualListener.js
+6
-6
ace-remix-ui-editor.tsx
libs/remix-ui/editor/src/lib/ace-remix-ui-editor.tsx
+31
-27
No files found.
apps/remix-ide/src/app/editor/contextualListener.js
View file @
177fb686
...
...
@@ -51,12 +51,12 @@ class ContextualListener extends Plugin {
}
this
.
_buildIndex
(
data
,
source
)
})
setInterval
(()
=>
{
if
(
this
.
_deps
.
compilersArtefacts
.
__last
&&
this
.
_deps
.
compilersArtefacts
.
__last
.
languageversion
.
indexOf
(
'soljson'
)
===
0
)
{
this
.
_highlightItems
(
this
.
editor
.
getCursorPosition
(),
this
.
_deps
.
compilersArtefacts
.
__last
,
this
.
_deps
.
config
.
get
(
'currentFile'
))
}
},
1000
)
// todo
//
setInterval(() => {
//
if (this._deps.compilersArtefacts.__last && this._deps.compilersArtefacts.__last.languageversion.indexOf('soljson') === 0) {
//
this._highlightItems(this.editor.getCursorPosition(), this._deps.compilersArtefacts.__last, this._deps.config.get('currentFile'))
//
}
//
}, 1000)
}
getActiveHighlights
()
{
...
...
libs/remix-ui/editor/src/lib/ace-remix-ui-editor.tsx
View file @
177fb686
...
...
@@ -5,11 +5,11 @@ import './remix-ui-editor.css'
///
import
AceEditor
from
'react-ace'
import
"ace-builds/src-min-noconflict/ext-language_tools"
;
import
'ace-builds/src-min-noconflict/ext-language_tools'
import
'ace-builds/webpack-resolver'
// Custom mode and theme import
import
'ace-mode-solidity/build/remix-ide/mode-solidity'
import
'./utils/theme-solidity'
;
import
'./utils/theme-solidity'
import
{
Ace
}
from
'ace-builds'
import
*
as
AceBuilds
from
'ace-builds'
type
cursorPosition
=
{
...
...
@@ -71,7 +71,7 @@ export interface EditorUIProps {
findMatches
:
(
uri
:
string
,
value
:
string
)
=>
any
getFontSize
:
()
=>
number
,
getValue
:
(
uri
:
string
)
=>
string
getCursorPosition
:
()
=>
cursorPosition
getCursorPosition
:
()
=>
number
}
}
...
...
@@ -142,28 +142,32 @@ export const EditorUI = (props: EditorUIProps) => {
}
}
// todo cursor position
// props.editorAPI.getCursorPosition = () => {
// if (!aceRef.current) return
// const model = editorModelsState[currentFileRef.current]?.model
// if (model) {
// const point = model.getCursorPosition()
props
.
editorAPI
.
getCursorPosition
=
()
=>
{
if
(
!
aceRef
.
current
)
return
const
model
=
editorModelsState
[
currentFileRef
.
current
]?.
model
const
point
=
editorRef
.
current
.
getCursorPosition
()
const
offset
=
model
.
getDocument
().
positionToIndex
(
point
,
0
)
return
offset
// return {
// startColumn: point.column,
// startLineNumber: point.row,
// endColumn: point.column,
// endLineNumber: point.row,
// }
// }
// endColumn: point.column + offset,
// endLineNumber: point.row
// }
}
props
.
editorAPI
.
getFontSize
=
()
=>
{
if
(
!
editorRef
.
current
)
return
return
Number
(
editorRef
.
current
.
getFontSize
())
}
function
onLoad
(
editor
:
Ace
.
Editor
)
{
function
onLoad
(
editor
:
Ace
.
Editor
)
{
editorRef
.
current
=
editor
reducerListener
(
props
.
plugin
,
dispatch
,
aceRef
.
current
,
editorRef
.
current
,
props
.
events
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
props
.
events
.
onEditorMounted
()
},
1000
)
// @ts-ignore
...
...
@@ -171,33 +175,33 @@ export const EditorUI = (props: EditorUIProps) => {
const
row
=
e
.
getDocumentPosition
().
row
const
target
=
e
.
domEvent
.
target
if
(
target
.
className
.
indexOf
(
"ace_gutter-cell"
)
==
-
1
)
{
return
;
if
(
target
.
className
.
indexOf
(
'ace_gutter-cell'
)
==
-
1
)
{
return
}
if
(
!
editor
.
isFocused
()){
return
;
if
(
!
editor
.
isFocused
())
{
return
}
if
(
e
.
clientX
>
25
+
target
.
getBoundingClientRect
().
left
){
return
;
if
(
e
.
clientX
>
25
+
target
.
getBoundingClientRect
().
left
)
{
return
}
// If there's a breakpoint already defined, it should be removed, offering the toggle feature
const
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
const
currentFile
=
currentFileRef
.
current
if
(
breakpoints
[
row
]
===
undefined
)
{
if
(
breakpoints
[
row
]
===
undefined
)
{
props
.
events
.
onBreakPointAdded
(
currentFile
,
row
)
e
.
editor
.
session
.
setBreakpoint
(
row
,
'ace_breakpoint'
)
;
}
else
{
e
.
editor
.
session
.
setBreakpoint
(
row
,
'ace_breakpoint'
)
}
else
{
props
.
events
.
onBreakPointCleared
(
currentFile
,
row
)
e
.
editor
.
session
.
clearBreakpoint
(
row
)
;
e
.
editor
.
session
.
clearBreakpoint
(
row
)
}
e
.
stop
()
;
e
.
stop
()
})
}
function
onBeforeunload
(
ace
:
typeof
AceBuilds
)
{
function
onBeforeunload
(
ace
:
typeof
AceBuilds
)
{
aceRef
.
current
=
ace
}
...
...
@@ -211,7 +215,7 @@ export const EditorUI = (props: EditorUIProps) => {
enableLiveAutocompletion
enableSnippets
editorProps=
{
{
$blockScrolling
:
true
}
}
style=
{
{
lineHeight
:
1.75
,
height
:
'100%'
,
width
:
'100%'
}
}
style=
{
{
lineHeight
:
1.75
,
height
:
'100%'
,
width
:
'100%'
}
}
onLoad=
{
onLoad
}
onBeforeLoad=
{
onBeforeunload
}
showGutter
...
...
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