fix editor highlighter

pull/1104/head
tizah 4 years ago
parent 6924eb457d
commit d3cdaaf153
  1. 8
      libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx
  2. 6
      libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx

@ -25,9 +25,9 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => {
return result return result
} }
const handlePointToErrorOnClick = () => { const handlePointToErrorOnClick = (location, fileName) => {
const result = opt.locationString.split(':') editor.call('editor', 'discardHighlight')
editor._components.registry.get('editor').api.gotoLine(parseInt(result[0]) - 1, parseInt(result[1])) editor.call('editor', 'highlight', location, fileName)
} }
if (!message) return if (!message) return
@ -48,7 +48,7 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => {
<div className="close" data-id="renderer"> <div className="close" data-id="renderer">
<i className="fas fa-times"></i> <i className="fas fa-times"></i>
</div> </div>
<span className='d-flex flex-column' onClick={handlePointToErrorOnClick}> <span className='d-flex flex-column' onClick={() => handlePointToErrorOnClick(opt.location, opt.fileName)}>
<span className='h6 font-weight-bold'>{opt.name}</span> <span className='h6 font-weight-bold'>{opt.name}</span>
{ opt.item.warning } { opt.item.warning }
{opt.item.more {opt.item.more

@ -169,12 +169,14 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
type: 'warning', type: 'warning',
useSpan: true, useSpan: true,
errFile: fileName, errFile: fileName,
fileName,
errLine: row, errLine: row,
errCol: column, errCol: column,
item: item, item: item,
name: result.name, name: result.name,
locationString, locationString,
more: item.more more: item.more,
location: location
} }
warningErrors.push(options) warningErrors.push(options)
setWarning({ msg, hasWarning: true, options, warningErrors: warningErrors }) setWarning({ msg, hasWarning: true, options, warningErrors: warningErrors })
@ -314,7 +316,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => {
return ( return (
<div className="analysis_3ECCBV px-3 pb-1"> <div className="analysis_3ECCBV px-3 pb-1">
<div className="my-2 d-flex flex-column align-items-left"> <div className="my-2 d-flex flex-column align-items-left">
<div className="d-flex justify-content-between"> <div className="d-flex justify-content-between" id="staticanalysisButton">
<RemixUiCheckbox <RemixUiCheckbox
id="checkAllEntries" id="checkAllEntries"
inputType="checkbox" inputType="checkbox"

Loading…
Cancel
Save