Documentation
¶
Overview ¶
Package codeview composes the egui2 CodeViewJob primitive with the project's SQL, JSON, and Go highlighters into a small set of retained- holder builders. The three highlighters share the same shape — palette intern at init → run highlighter → emit one CodeViewJob.Section per span → Keep — so they live in one package.
Naming convention: Build* re-tokenises every call (use for dynamic strings); Prepare* is a documented alias for static / global content where the retained holder is constructed once and reused across frames.
The Go view additionally exposes BuildGoLines / PrepareGoLines, which render a byte slice covering a 1-based [firstLine, lastLine] window with a right-aligned line-number gutter. The line-window machinery is internally generic; SQL/JSON equivalents can be added when a caller needs them.
Index ¶
- Variables
- func BuildGo(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func BuildGoLines(src string, firstLine int32, lastLine int32) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func BuildJson(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func BuildMarkdown(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func BuildSql(sql string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func PrepareGo(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func PrepareGoLines(src string, firstLine int32, lastLine int32) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func PrepareJson(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func PrepareMarkdown(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
- func PrepareSql(sql string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
Constants ¶
This section is empty.
Variables ¶
var PackageProps = packageprops.Props{ WASMWASI: packageprops.WASMBlocked, WASMJS: packageprops.WASMBlocked, WASMFreestanding: packageprops.WASMCompiles, }
PackageProps records this package's curated properties (ADR-0080). Seeded by `wasmsurvey props generate`; curate by hand, then `wasmsurvey props verify`.
Functions ¶
func BuildGo ¶
func BuildGo(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
BuildGo highlights Go source and returns a retained CodeViewJob. Each call re-highlights; use PrepareGo for static snippets.
func BuildGoLines ¶
func BuildGoLines(src string, firstLine int32, lastLine int32) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
BuildGoLines highlights src and renders the byte slice covering 1-based lines [firstLine, lastLine] (inclusive) with a right-aligned line-number gutter prefixed to each line. The full source is parsed so AST refinement applies — spans that cross the window boundary are clipped at the edges.
firstLine/lastLine are clamped to the source's line range. An out-of-bounds window returns an empty retained holder.
func BuildJson ¶
func BuildJson(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
BuildJson highlights JSON and returns a retained CodeViewJob. Each call re-tokenises; use PrepareJson for static documents.
func BuildMarkdown ¶
func BuildMarkdown(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
BuildMarkdown canonicalises and highlights markdown source, returning a retained CodeViewJob. Each call re-renders; use PrepareMarkdown for static documents.
IMPORTANT: the rendered text is a *canonical* form of the input, not the source verbatim. gofmt-style: lists become `-`, emphasis becomes `*` / `**`, frontmatter keys sort alphabetically, indented code blocks lose their 4-space marker. The text displayed in the CodeView is what this function returns, not what was passed in. See package markdownhighlight for the full canonicalisation rules.
func BuildSql ¶
func BuildSql(sql string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
BuildSql highlights SQL and returns a retained CodeViewJob. Each call re-tokenises; use PrepareSql for static SQL.
func PrepareGo ¶
func PrepareGo(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
PrepareGo is identical to BuildGo — use this name for static / global Go snippets where the retained holder is built once and reused across frames.
func PrepareGoLines ¶
func PrepareGoLines(src string, firstLine int32, lastLine int32) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
PrepareGoLines is identical to BuildGoLines — use this name for static / global slices so it is clear the retained holder is built once and reused across frames.
func PrepareJson ¶
func PrepareJson(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
PrepareJson is identical to BuildJson — use this name for static / global documents where the retained holder is built once and reused across frames.
func PrepareMarkdown ¶
func PrepareMarkdown(src string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
PrepareMarkdown is identical to BuildMarkdown — use this name for static / global markdown where the retained holder is built once and reused across frames.
func PrepareSql ¶
func PrepareSql(sql string) typed.RetainedFffiHolderTyped[c.CodeViewJobS]
PrepareSql is identical to BuildSql — use this name for static / global SQL where the retained holder is built once and reused across frames.
Types ¶
This section is empty.