From f462e11ae2ee9386e5d5bfb57caafceaa0615bec Mon Sep 17 00:00:00 2001 From: jialin Date: Mon, 22 Jul 2024 13:13:22 +0800 Subject: [PATCH] fix(style): editor code lint --- .../playground/components/view-code-modal.tsx | 29 ++++++++++++++++++- src/pages/playground/style/play-ground.less | 6 ++-- 2 files changed, 31 insertions(+), 4 deletions(-) diff --git a/src/pages/playground/components/view-code-modal.tsx b/src/pages/playground/components/view-code-modal.tsx index 778dc022..6c4d9b58 100644 --- a/src/pages/playground/components/view-code-modal.tsx +++ b/src/pages/playground/components/view-code-modal.tsx @@ -122,7 +122,15 @@ const ViewCodeModal: React.FC = (props) => { const handleEditorDidMount = (editor: any, monaco: any) => { editorRef.current = editor; setLoaded(true); - console.log('loaded===='); + console.log('loaded====', editor, monaco); + }; + + const handleBeforeMount = (monaco: any) => { + monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({ + noSemanticValidation: false, + noSyntaxValidation: false, + diagnosticCodesToIgnore: [80001] + }); }; const handleOnChangeLang = (value: string) => { @@ -186,6 +194,25 @@ const ViewCodeModal: React.FC = (props) => { language={lang} value={codeValue} options={editorConfig} + overrideServices={{ + quickSuggestions: { + other: false, + comments: false, + strings: false + }, + disableLayerHinting: true, + languages: { + typescript: { + moduleKind: '2', + diagnosticsOptions: { + noSemanticValidation: false, + noSyntaxValidation: false, + diagnosticCodesToIgnore: [80001] + } + } + } + }} + beforeMount={handleBeforeMount} onMount={handleEditorDidMount} /> diff --git a/src/pages/playground/style/play-ground.less b/src/pages/playground/style/play-ground.less index 596f19ec..25b2778c 100644 --- a/src/pages/playground/style/play-ground.less +++ b/src/pages/playground/style/play-ground.less @@ -10,8 +10,8 @@ .collapse-btn { position: absolute; - top: 0; - left: 0; + top: -7px; + left: -5px; z-index: 1; } @@ -20,7 +20,7 @@ &.collapse { width: 33px; padding-left: 32px; - overflow: hidden; + // overflow: hidden; transition: width 0.3s ease; } }