From f54169e5f3a0e7d922603b0931ef63b7fafeaf67 Mon Sep 17 00:00:00 2001 From: tizah Date: Sat, 24 Apr 2021 06:10:21 +0100 Subject: [PATCH] fix editor highlighter --- libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx | 8 ++++---- .../static-analyser/src/lib/remix-ui-static-analyser.tsx | 6 ++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx b/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx index b31a62b9de..46dfd16a15 100644 --- a/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx +++ b/libs/remix-ui/static-analyser/src/lib/ErrorRenderer.tsx @@ -25,9 +25,9 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => { return result } - const handlePointToErrorOnClick = () => { - const result = opt.locationString.split(':') - editor._components.registry.get('editor').api.gotoLine(parseInt(result[0]) - 1, parseInt(result[1])) + const handlePointToErrorOnClick = (location, fileName) => { + editor.call('editor', 'discardHighlight') + editor.call('editor', 'highlight', location, fileName) } if (!message) return @@ -48,7 +48,7 @@ const ErrorRenderer = ({ message, opt, editor }: ErrorRendererProps) => {
- + handlePointToErrorOnClick(opt.location, opt.fileName)}> {opt.name} { opt.item.warning } {opt.item.more diff --git a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx index 383bfa7643..7bcdd9d0a3 100644 --- a/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx +++ b/libs/remix-ui/static-analyser/src/lib/remix-ui-static-analyser.tsx @@ -169,12 +169,14 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { type: 'warning', useSpan: true, errFile: fileName, + fileName, errLine: row, errCol: column, item: item, name: result.name, locationString, - more: item.more + more: item.more, + location: location } warningErrors.push(options) setWarning({ msg, hasWarning: true, options, warningErrors: warningErrors }) @@ -314,7 +316,7 @@ export const RemixUiStaticAnalyser = (props: RemixUiStaticAnalyserProps) => { return (
-
+