Skip to content

smelt.files

Tier: Host - Available in every runtime, including headless mode.

Visibility: Public - Stable Lua API intended for user config and plugins.

Workspace file search. Owns background indexing, filesystem watching, and recent-selection ranking.

smelt.files.accept

fun(item: table, opts: table?): boolean, string?

Record a selected file result for recent-selection ranking. Options: { cwd? }. Returns (true, nil) or (false, err).

smelt.files.rescan

fun(opts: table?): boolean, string?

Trigger an asynchronous full rescan for the current workspace or opts.cwd. Returns (true, nil) or (false, err).

smelt.files.search

fun(query: string, opts: table?): table

Search workspace files. Returns { items, total_matched, total_files, total_dirs, scanned, scanning, searching, ready, status, message, root }. Items are { label, path, insert_text, kind, score }. Options: { limit?, offset?, include_dirs?, cwd? }.

smelt.files.status

fun(opts: table?): table

Return indexing status for the current workspace or opts.cwd: { root, initialized, files, scanned, scanning, watcher_ready, warmup_complete }.