omp packages

pi-autocomplete-style0.1.0

Renders Pi's autocomplete menu as a panel: a bar instead of the arrow, plus a background

mollehxh Published 2 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-autocomplete-style

A Pi package that restyles Pi's native autocomplete menu:

  • the → arrow is replaced by a full-height bar (▌) that marks the selected row;
  • every menu row gets a background, so the popup stands out from the transcript;
  • rows are padded to the full menu width, so the panel looks like a block instead of floating text.

Everything else stays native: the same editor, provider, keybindings, filters, scrolling, mouse handling and menu placement. Other SelectLists (model picker, settings, extension dialogs) keep their normal look.

 ▌ /model        Switch model
   /model-set    ...
   /help         Show help

Install

pi install ./pi-autocomplete-style          # local checkout
pi install npm:pi-autocomplete-style        # once published

Or try it for a single run without touching settings:

pi -e ./pi-autocomplete-style

Reload a running session with /reload.

How the colors are chosen

The extension wraps SelectList#render only for lists created by Editor#createAutocompleteList, and paints rows with the active theme's own tokens (via ctx.ui.theme), so it follows /settings theme changes and hot-reloaded palettes:

Part Token
Selected row background selectedBg
Other rows background toolPendingBg, then customMessageBg, then selectedBg as fallbacks
Bar and selected label accent
Descriptions muted
Scroll counter muted
"No matching commands" warning

toolPendingBg is the neutral panel color of the built-in themes; customMessageBg is only a fallback because it is tinted violet/blue in the built-in palettes. If a theme omits all background tokens, rows stay unpainted but keep the bar.

To use different colors or a different glyph, edit the constants at the top of src/render.ts (SELECTED_BAR, PANEL_BG_TOKENS, SELECTED_BG_TOKENS).

Compatibility

The extension patches two host prototypes (Editor#createAutocompleteList, SelectList#render) and reads a few runtime-private SelectList fields. It is designed to compose with packages that replace the editor, such as pi-autocomplete-above or a custom prompt UI, because it never takes the editor slot itself. See docs/supported-versions.md.

Development

npm install
npm run check     # tsc + vitest

test/render.test.ts covers the row renderer; test/editor-integration.test.ts drives a real pi-tui Editor, opens the menu, and asserts the rendered rows.