Skip to content

[Feature] Autocomplete layer for input-field and editor #38

@fissible

Description

@fissible

Summary

Composable autocomplete that layers a filtered suggestion popup on top of an input field or editor. Not domain-specific — the suggestion source is a callback provided by the consumer.

Effort: M (~half day)
Deps: input-field.sh, context-menu.sh (both exist)

Requirements

  • SHELLFRAME_AC_PROVIDER — name of a function that takes (prefix, out_array) and populates the array with matching suggestions
  • SHELLFRAME_AC_TRIGGER"auto" (filter on every keystroke) | "tab" (Tab triggers)
  • Popup rendered as a context-menu widget anchored below the input cursor
  • Typing filters the list; Enter or Tab accepts the selected suggestion
  • Esc dismisses popup without accepting
  • Popup auto-hides when 0 matches remain
  • If only 1 match, Tab auto-completes without showing popup

Public API

shellframe_ac_attach ctx            # attach to an input-field or editor context
shellframe_ac_detach ctx            # remove autocomplete from a context
shellframe_ac_on_key key → 0|1     # intercept keys when popup is visible
shellframe_ac_render top left w h   # render popup if visible
shellframe_ac_dismiss               # hide popup

Design notes

  • Consumer provides the provider function (e.g., shellql provides SQL-aware suggestions)
  • Shellframe provides the UI mechanics (popup positioning, filtering, selection)
  • Works with both input-field (single-line) and editor (multi-line, cursor-anchored)

Risk: bash 3.2 compatibility

The natural implementation uses associative arrays (bash 4+), but shellframe targets bash 3.2+. The Worker should design the filtering/matching with flat arrays or a bash-3.2-compatible pattern. Could inflate effort if not planned for upfront.

Consumers

  • shellql: SQL autocomplete (table names, column names)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions