Fix(command): line/block Comments Incorrectly Parsed as Slash Commands (#6957)

Co-authored-by: Abhi <43648792+abhipatel12@users.noreply.github.com>
This commit is contained in:
fuyou
2025-08-26 11:51:27 +08:00
committed by GitHub
parent 97ce197f38
commit 45fff8f9f7
9 changed files with 157 additions and 9 deletions
@@ -12,6 +12,7 @@ import {
} from '@google/gemini-cli-core';
import type { Content, GenerateContentConfig } from '@google/genai';
import type { TextBuffer } from '../components/shared/text-buffer.js';
import { isSlashCommand } from '../utils/commandUtils.js';
export const PROMPT_COMPLETION_MIN_LENGTH = 5;
export const PROMPT_COMPLETION_DEBOUNCE_MS = 250;
@@ -81,7 +82,7 @@ export function usePromptCompletion({
if (
trimmedText.length < PROMPT_COMPLETION_MIN_LENGTH ||
!geminiClient ||
trimmedText.startsWith('/') ||
isSlashCommand(trimmedText) ||
trimmedText.includes('@') ||
!isPromptCompletionEnabled
) {
@@ -237,7 +238,7 @@ export function usePromptCompletion({
const trimmedText = buffer.text.trim();
return (
trimmedText.length >= PROMPT_COMPLETION_MIN_LENGTH &&
!trimmedText.startsWith('/') &&
!isSlashCommand(trimmedText) &&
!trimmedText.includes('@')
);
}, [buffer.text, isPromptCompletionEnabled, isCursorAtEnd]);