跳到主要内容

code-editor

<vs.code-editor>

基于 Monaco Editor 的代码编辑器。

Playground

Examples

Automatic layout - fit-content

Playground

Automatic layout - fit-container

Playground

Placeholder

Playground

Brick Next YAML

Playground

Brick Next YAML with highlight

Playground

Show CTX.DS

Playground

CEL

Playground

Properties

NameDescriptionTypeDefaultRequired
namestring
labelstring
valuestring
languagestring "plaintext"
theme

主题,支持 "auto" | "vs" | "vs-dark"

string "auto"
requiredboolean
readOnlyboolean
automaticLayout"fit-container" | "fit-content" | "none"
minLinesnumber 3
completers

仅对 language 为 brick_next_yaml 有效,设置第一层属性名的自动补全。

monaco.languages.CompletionItem[]
advancedCompleters

高级自动补全配置。

  • 设置为键值对时,仅对 language 为 brick_next_yaml 有效,设置任意的自动补全;
  • 设置为数组时,当前仅对 language 为 cel 有效。 未来将统一改为数组格式,废弃键值对格式的配置。
AdvancedCompleterMap | MixedCompleter[]
markersMarker[]
linksstring[]
maxLinesnumber Infinity
heightstring | number
messagestring
placeholderstring
showExpandButton

是否展示展开按钮

boolean
lineNumbers

行数配置

monaco.editor.LineNumbersType
tokenConfig

自定义高亮配置

TokenConfig
customValidationInBrickNextYaml

在 brick_next_yaml 中是否开启语义相关校验

boolean false
showCopyButton

是否展示复制按钮

boolean true
glyphMargin

显示字形边距

boolean false
extraLibs

额外声明的 lib 库

ExtraLib[]
fixedOverflowWidgetsboolean true
spellCheck

是否启用英语拼写检查

boolean true
knownWords

启用英语拼写检查时,除系统设置的词汇表外,指定其他的已知单词(小写)。

string[]
domLibsEnabled

是否启用 DOM 相关接口的自动提示。

boolean

Events

NameDescriptionEvent Detail
code.changestring
user.inputany
token.clickstring

Type references

MembersCompleter

NameDescriptionTypeDefaultRequired
type"members"
members

键为对象名称,值为对象属性名列表

Record<string, string[]>

Marker

NameDescriptionTypeDefaultRequired
tokenstring
levelkeyof typeof Level
messagestring
code{ value: string; target: string }
paramsstring[]

TokenConfig

NameDescriptionTypeDefaultRequired
showDSKeyboolean

ExtraLib

NameDescriptionTypeDefaultRequired
filePathstring
contentstring

AdvancedCompleterMap

Record<string, { triggerCharacter: string; completers: monaco.languages.CompletionItem[] }>

MixedCompleter

MembersCompleter