From cbfc7d4eee4261d4cc6788cf7d16365ddbf7cf00 Mon Sep 17 00:00:00 2001 From: Devansh Jain <31609257+devanshrj@users.noreply.github.com> Date: Mon, 15 Dec 2025 18:02:50 -0800 Subject: [PATCH] fix: Tab completion for slash commands (#224) --- src/cli/components/InputAssist.tsx | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/cli/components/InputAssist.tsx b/src/cli/components/InputAssist.tsx index 982f955..3080d9e 100644 --- a/src/cli/components/InputAssist.tsx +++ b/src/cli/components/InputAssist.tsx @@ -1,4 +1,5 @@ import { Box } from "ink"; +import { useEffect } from "react"; import { AgentInfoBar } from "./AgentInfoBar"; import { FileAutocomplete } from "./FileAutocomplete"; import { SlashCommandAutocomplete } from "./SlashCommandAutocomplete"; @@ -30,8 +31,23 @@ export function InputAssist({ agentName, serverUrl, }: InputAssistProps) { + const showFileAutocomplete = currentInput.includes("@"); + const showCommandAutocomplete = + !showFileAutocomplete && currentInput.startsWith("/"); + + // Reset active state when no autocomplete is being shown + useEffect(() => { + if (!showFileAutocomplete && !showCommandAutocomplete) { + onAutocompleteActiveChange(false); + } + }, [ + showFileAutocomplete, + showCommandAutocomplete, + onAutocompleteActiveChange, + ]); + // Show file autocomplete when @ is present - if (currentInput.includes("@")) { + if (showFileAutocomplete) { return (