Skip to content

Slash command autocomplete doesn't trigger for commands starting with . or - #422

@scruffymongrel

Description

@scruffymongrel

Problem

Custom slash commands with names starting with . (e.g., .land, .status) don't appear in autocomplete when typing /..

Root Cause

In pi-tui/dist/components/editor.js, the autocomplete continuation only triggers for alphanumeric characters:

else if (/[a-zA-Z0-9]/.test(char)) {
    const currentLine = this.state.lines[this.state.cursorLine] || "";
    const textBeforeCursor = currentLine.slice(0, this.state.cursorCol);
    // Check if we're in a slash command (with or without space for arguments)
    if (textBeforeCursor.trimStart().startsWith("/")) {
        this.tryTriggerAutocomplete();
    }
    // ...
}

When typing /., the . character doesn't match [a-zA-Z0-9], so autocomplete isn't triggered/updated.

Use Case

Prefixing custom commands with . is useful for:

  1. Grouping - visually separates project-specific commands from built-in ones
  2. Sorting - . sorts before letters, so custom commands appear first in the list
  3. Ergonomics - / and . are adjacent keys, making /. a fast combo for accessing custom commands

Expected Behavior

Typing /. should show commands whose names start with . (e.g., .land, .rpi, .status).

Suggested Fix

Expand the regex to include common command name characters:

else if (/[a-zA-Z0-9.\-_]/.test(char)) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions