Commit 177fb686 authored by gxkai's avatar gxkai

fix: 暂时移除高亮

parent 1844a594
......@@ -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 () {
......
......@@ -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()
// return {
// startColumn: point.column,
// startLineNumber: point.row,
// endColumn: point.column,
// endLineNumber: point.row,
// }
// }
// }
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 + 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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment