update Renderer (support Vyper rendering)

pull/5270/head
yann300 1 month ago committed by Aniket
parent 0c675ccb81
commit ffb91becac
  1. 29
      libs/remix-ui/renderer/src/lib/renderer.tsx

@ -7,16 +7,28 @@ const _paq = (window._paq = window._paq || [])
interface RendererProps {
message: any
opt?: any
opt?: RendererOptions
plugin: any
}
export const Renderer = ({ message, opt = {}, plugin }: RendererProps) => {
type RendererOptions = {
useSpan?: boolean
type: string
errorType?: string
errCol?: number
errLine?: number
errFile?: string
}
export const Renderer = ({ message, opt, plugin }: RendererProps) => {
const intl = useIntl()
const [messageText, setMessageText] = useState(null)
const [editorOptions, setEditorOptions] = useState({
const [editorOptions, setEditorOptions] = useState<RendererOptions>({
useSpan: false,
type: '',
errorType: '',
errCol: -1,
errLine: -1,
errFile: ''
})
const [classList, setClassList] = useState(opt.type === 'error' ? 'alert alert-danger' : 'alert alert-warning')
@ -35,11 +47,14 @@ export const Renderer = ({ message, opt = {}, plugin }: RendererProps) => {
// ^ e.g:
// browser/gm.sol: Warning: Source file does not specify required compiler version! Consider adding "pragma solidity ^0.6.12
// https://github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.2.0/contracts/introspection/IERC1820Registry.sol:3:1: ParserError: Source file requires different compiler version (current compiler is 0.7.4+commit.3f05b770.Emscripten.clang) - note that nightly builds are considered to be strictly less than the released version
const positionDetails = helper.getPositionDetails(text)
if (!opt.errLine) {
const positionDetails = helper.getPositionDetails(text)
opt.errLine = positionDetails.errLine
opt.errCol = positionDetails.errCol
opt.errFile = positionDetails.errFile ? (positionDetails.errFile as string).trim() : ''
opt.errLine = positionDetails.errLine as number
opt.errCol = positionDetails.errCol as number
opt.errFile = positionDetails.errFile ? (positionDetails.errFile as string).trim() : ''
}
setMessageText(text)
setEditorOptions(opt)

Loading…
Cancel
Save