// 以 umi 为例
import MonacoEditorWebpackPlugin from 'monaco-editor-webpack-plugin';
export default {
chainWebpack: (memo) => {
memo
.plugin('monaco-editor-webpack-plugin')
.use(new MonacoEditorWebpackPlugin(), [['sql']]); // 其他语言增加其他的
},
};
import { Kind, SQLEditor } from '@baic/code-editor';
const hintData = {
databases: [
{
content: 'bigdata',
kind: Kind.Struct,
tables: [
{
content: 'auth',
fields: [
{
content: 'id',
kind: Kind.Field,
},
],
kind: Kind.Folder,
},
{
content: 'role',
fields: [
{
content: 'id',
kind: Kind.Field,
},
],
kind: Kind.Folder,
},
],
},
],
keywords: [
{
content: 'SELECT',
kind: Kind.Keyword,
},
{
content: 'INSERT',
kind: Kind.Keyword,
},
{
content: 'UPDATE',
kind: Kind.Keyword,
},
],
};
export default () => (
<div
style={{
height: 500,
}}
>
<SQLEditor hintData={hintData} />
</div>
);