Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commitdd348ac6c3

README.md

codeEditor

Code-editing variant of input. Defaults multiline = true, codeEditor = true, language = "lua", lineNumbers = true. The language opt dispatches to a Luau highlighter from zui.highlight.*; the resulting segments are passed to TextInput as props.segments so the renderer builds a coloured LayoutJob without a Rust-side highlighter call.

Exports

  • codeEditor(id: string?, value: any?, opts: CodeEditorOpts?) -> WidgetNode — build a code-editor widget node.

Types:

  • CodeEditorOpts = { multiline?, codeEditor?, lineNumbers?, folding?, language?, foldLanguage?, segments?, ... } — accepts any opts the underlying input widget supports.

Usage

local codeEditor = require("@builtin::modules.zui.widget.codeEditor")

codeEditor("editor1", "local x = 1\n", { language = "lua" })
codeEditor("editor1", code, { language = "lua", folding = true })

Notes

  • Folding is opt-in via folding = true. When combined with language = "lua", the wrapper sets foldLanguage = "lua" so the gutter UI runs the Rust-side fold detector on the editor's live text. Other languages can't fold (no detector implemented yet).
  • opts.language is consumed by the wrapper and never reaches input.module; the highlighter output lands in opts.segments instead.
  • The engine's built-in highlighters have been deleted — language→segments mapping lives entirely in Luau.