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 {
...
@@ -51,12 +51,12 @@ class ContextualListener extends Plugin {
}
}
this
.
_buildIndex
(
data
,
source
)
this
.
_buildIndex
(
data
,
source
)
})
})
// todo
setInterval
(()
=>
{
//
setInterval(() => {
if
(
this
.
_deps
.
compilersArtefacts
.
__last
&&
this
.
_deps
.
compilersArtefacts
.
__last
.
languageversion
.
indexOf
(
'soljson'
)
===
0
)
{
//
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'
))
//
this._highlightItems(this.editor.getCursorPosition(), this._deps.compilersArtefacts.__last, this._deps.config.get('currentFile'))
}
//
}
},
1000
)
//
}, 1000)
}
}
getActiveHighlights
()
{
getActiveHighlights
()
{
...
...
libs/remix-ui/editor/src/lib/ace-remix-ui-editor.tsx
View file @
177fb686
...
@@ -5,11 +5,11 @@ import './remix-ui-editor.css'
...
@@ -5,11 +5,11 @@ import './remix-ui-editor.css'
///
///
import
AceEditor
from
'react-ace'
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'
import
'ace-builds/webpack-resolver'
// Custom mode and theme import
// Custom mode and theme import
import
'ace-mode-solidity/build/remix-ide/mode-solidity'
import
'ace-mode-solidity/build/remix-ide/mode-solidity'
import
'./utils/theme-solidity'
;
import
'./utils/theme-solidity'
import
{
Ace
}
from
'ace-builds'
import
{
Ace
}
from
'ace-builds'
import
*
as
AceBuilds
from
'ace-builds'
import
*
as
AceBuilds
from
'ace-builds'
type
cursorPosition
=
{
type
cursorPosition
=
{
...
@@ -71,7 +71,7 @@ export interface EditorUIProps {
...
@@ -71,7 +71,7 @@ export interface EditorUIProps {
findMatches
:
(
uri
:
string
,
value
:
string
)
=>
any
findMatches
:
(
uri
:
string
,
value
:
string
)
=>
any
getFontSize
:
()
=>
number
,
getFontSize
:
()
=>
number
,
getValue
:
(
uri
:
string
)
=>
string
getValue
:
(
uri
:
string
)
=>
string
getCursorPosition
:
()
=>
cursorPosition
getCursorPosition
:
()
=>
number
}
}
}
}
...
@@ -142,28 +142,32 @@ export const EditorUI = (props: EditorUIProps) => {
...
@@ -142,28 +142,32 @@ export const EditorUI = (props: EditorUIProps) => {
}
}
}
}
// todo cursor position
// todo cursor position
// props.editorAPI.getCursorPosition = () => {
props
.
editorAPI
.
getCursorPosition
=
()
=>
{
// if (!aceRef.current) return
if
(
!
aceRef
.
current
)
return
// const model = editorModelsState[currentFileRef.current]?.model
const
model
=
editorModelsState
[
currentFileRef
.
current
]?.
model
// if (model) {
const
point
=
editorRef
.
current
.
getCursorPosition
()
// const point = model.getCursorPosition()
const
offset
=
model
.
getDocument
().
positionToIndex
(
point
,
0
)
return
offset
// return {
// return {
// startColumn: point.column,
// startColumn: point.column,
// startLineNumber: point.row,
// startLineNumber: point.row,
// endColumn: point.column,
// endColumn: point.column + offset,
// endLineNumber: point.row,
// endLineNumber: point.row
// }
// }
// }
// }
}
props
.
editorAPI
.
getFontSize
=
()
=>
{
props
.
editorAPI
.
getFontSize
=
()
=>
{
if
(
!
editorRef
.
current
)
return
if
(
!
editorRef
.
current
)
return
return
Number
(
editorRef
.
current
.
getFontSize
())
return
Number
(
editorRef
.
current
.
getFontSize
())
}
}
function
onLoad
(
editor
:
Ace
.
Editor
)
{
function
onLoad
(
editor
:
Ace
.
Editor
)
{
editorRef
.
current
=
editor
editorRef
.
current
=
editor
reducerListener
(
props
.
plugin
,
dispatch
,
aceRef
.
current
,
editorRef
.
current
,
props
.
events
)
reducerListener
(
props
.
plugin
,
dispatch
,
aceRef
.
current
,
editorRef
.
current
,
props
.
events
)
setTimeout
(()
=>
{
setTimeout
(()
=>
{
props
.
events
.
onEditorMounted
()
props
.
events
.
onEditorMounted
()
},
1000
)
},
1000
)
// @ts-ignore
// @ts-ignore
...
@@ -171,33 +175,33 @@ export const EditorUI = (props: EditorUIProps) => {
...
@@ -171,33 +175,33 @@ export const EditorUI = (props: EditorUIProps) => {
const
row
=
e
.
getDocumentPosition
().
row
const
row
=
e
.
getDocumentPosition
().
row
const
target
=
e
.
domEvent
.
target
const
target
=
e
.
domEvent
.
target
if
(
target
.
className
.
indexOf
(
"ace_gutter-cell"
)
==
-
1
)
{
if
(
target
.
className
.
indexOf
(
'ace_gutter-cell'
)
==
-
1
)
{
return
;
return
}
}
if
(
!
editor
.
isFocused
()){
if
(
!
editor
.
isFocused
())
{
return
;
return
}
}
if
(
e
.
clientX
>
25
+
target
.
getBoundingClientRect
().
left
){
if
(
e
.
clientX
>
25
+
target
.
getBoundingClientRect
().
left
)
{
return
;
return
}
}
// If there's a breakpoint already defined, it should be removed, offering the toggle feature
// If there's a breakpoint already defined, it should be removed, offering the toggle feature
const
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
const
breakpoints
=
e
.
editor
.
session
.
getBreakpoints
()
const
currentFile
=
currentFileRef
.
current
const
currentFile
=
currentFileRef
.
current
if
(
breakpoints
[
row
]
===
undefined
)
{
if
(
breakpoints
[
row
]
===
undefined
)
{
props
.
events
.
onBreakPointAdded
(
currentFile
,
row
)
props
.
events
.
onBreakPointAdded
(
currentFile
,
row
)
e
.
editor
.
session
.
setBreakpoint
(
row
,
'ace_breakpoint'
)
;
e
.
editor
.
session
.
setBreakpoint
(
row
,
'ace_breakpoint'
)
}
else
{
}
else
{
props
.
events
.
onBreakPointCleared
(
currentFile
,
row
)
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
aceRef
.
current
=
ace
}
}
...
@@ -211,7 +215,7 @@ export const EditorUI = (props: EditorUIProps) => {
...
@@ -211,7 +215,7 @@ export const EditorUI = (props: EditorUIProps) => {
enableLiveAutocompletion
enableLiveAutocompletion
enableSnippets
enableSnippets
editorProps=
{
{
$blockScrolling
:
true
}
}
editorProps=
{
{
$blockScrolling
:
true
}
}
style=
{
{
lineHeight
:
1.75
,
height
:
'100%'
,
width
:
'100%'
}
}
style=
{
{
lineHeight
:
1.75
,
height
:
'100%'
,
width
:
'100%'
}
}
onLoad=
{
onLoad
}
onLoad=
{
onLoad
}
onBeforeLoad=
{
onBeforeunload
}
onBeforeLoad=
{
onBeforeunload
}
showGutter
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