|
|
@ -77,7 +77,7 @@ export interface EditorUIProps { |
|
|
|
getCursorPosition: () => cursorPosition |
|
|
|
getCursorPosition: () => cursorPosition |
|
|
|
getHoverPosition: (position: IPosition) => number |
|
|
|
getHoverPosition: (position: IPosition) => number |
|
|
|
addDecoration: (marker: sourceMarker, filePath: string, typeOfDecoration: string) => DecorationsReturn |
|
|
|
addDecoration: (marker: sourceMarker, filePath: string, typeOfDecoration: string) => DecorationsReturn |
|
|
|
addErrorMarker: (error: CompilationError) => void |
|
|
|
addErrorMarker: (errors: []) => void |
|
|
|
clearDecorationsByPlugin: (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => DecorationsReturn |
|
|
|
clearDecorationsByPlugin: (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => DecorationsReturn |
|
|
|
keepDecorationsFor: (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => DecorationsReturn |
|
|
|
keepDecorationsFor: (filePath: string, plugin: string, typeOfDecoration: string, registeredDecorations: any, currentDecorations: any) => DecorationsReturn |
|
|
|
} |
|
|
|
} |
|
|
@ -356,32 +356,30 @@ export const EditorUI = (props: EditorUIProps) => { |
|
|
|
return addDecoration(marker, filePath, typeOfDecoration) |
|
|
|
return addDecoration(marker, filePath, typeOfDecoration) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
props.editorAPI.addErrorMarker = async (marker: CompilationError) => { |
|
|
|
props.editorAPI.addErrorMarker = async (errors: []) => { |
|
|
|
|
|
|
|
|
|
|
|
console.log(editorModelsState) |
|
|
|
for (const error of errors) { |
|
|
|
let filePath = marker.sourceLocation.file |
|
|
|
const marker = (error as any).error |
|
|
|
console.log(filePath) |
|
|
|
const lineColumn = (error as any).lineColumn |
|
|
|
if (!filePath) return |
|
|
|
let filePath = marker.sourceLocation.file |
|
|
|
const fileFromUrl = await props.plugin.call('fileManager', 'getPathFromUrl', filePath) |
|
|
|
|
|
|
|
filePath = fileFromUrl.file |
|
|
|
if (!filePath) return |
|
|
|
const model = editorModelsState[filePath]?.model |
|
|
|
const fileFromUrl = await props.plugin.call('fileManager', 'getPathFromUrl', filePath) |
|
|
|
if (model) { |
|
|
|
filePath = fileFromUrl.file |
|
|
|
console.log(model) |
|
|
|
const model = editorModelsState[filePath]?.model |
|
|
|
const markerData: monaco.editor.IMarkerData = { |
|
|
|
if (model) { |
|
|
|
severity: MarkerSeverity.Error, |
|
|
|
const markerData: monaco.editor.IMarkerData = { |
|
|
|
startLineNumber: 1, |
|
|
|
severity: MarkerSeverity.Error, |
|
|
|
startColumn: 1, |
|
|
|
startLineNumber: lineColumn.start.line + 1, |
|
|
|
endLineNumber: 1, |
|
|
|
startColumn: lineColumn.start.column + 1, |
|
|
|
endColumn: 2, |
|
|
|
endLineNumber: lineColumn.end.line + 1, |
|
|
|
message: marker.message, |
|
|
|
endColumn: lineColumn.end.column + 1, |
|
|
|
code: '21ji2j21ij21iji' |
|
|
|
message: marker.message, |
|
|
|
|
|
|
|
code: '21ji2j21ij21iji' |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
console.log(markerData) |
|
|
|
|
|
|
|
monacoRef.current.editor.setModelMarkers(model, 'remix-solidity', [markerData]) |
|
|
|
} |
|
|
|
} |
|
|
|
console.log(markerData) |
|
|
|
|
|
|
|
monacoRef.current.editor.colorizeModelLine(model,1) |
|
|
|
|
|
|
|
monacoRef.current.editor.colorizeModelLine(model,2) |
|
|
|
|
|
|
|
console.log(monacoRef.current.editor.getModels()) |
|
|
|
|
|
|
|
monacoRef.current.editor.setModelMarkers(model, 'remix-solidity', [markerData]) |
|
|
|
|
|
|
|
console.log(monacoRef.current.editor.getModelMarkers({})) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -510,7 +508,7 @@ export const EditorUI = (props: EditorUIProps) => { |
|
|
|
language={editorModelsState[props.currentFile] ? editorModelsState[props.currentFile].language : 'text'} |
|
|
|
language={editorModelsState[props.currentFile] ? editorModelsState[props.currentFile].language : 'text'} |
|
|
|
onMount={handleEditorDidMount} |
|
|
|
onMount={handleEditorDidMount} |
|
|
|
beforeMount={handleEditorWillMount} |
|
|
|
beforeMount={handleEditorWillMount} |
|
|
|
options={{ glyphMargin: true, readOnly: true}} |
|
|
|
options={{ glyphMargin: true, readOnly: true }} |
|
|
|
defaultValue={defaultEditorValue} |
|
|
|
defaultValue={defaultEditorValue} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="contextview"> |
|
|
|
<div className="contextview"> |
|
|
|