Fix slash command highlighting (#6325)

This commit is contained in:
Matt Rubens 2025-07-28 19:52:25 -04:00 committed by GitHub
parent 7b756e391f
commit ddb9950776
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -410,7 +410,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
const selectableOptions = options.filter(
(option) =>
option.type !== ContextMenuOptionType.URL &&
option.type !== ContextMenuOptionType.NoResults,
option.type !== ContextMenuOptionType.NoResults &&
option.type !== ContextMenuOptionType.SectionHeader,
)
if (selectableOptions.length === 0) return -1 // No selectable options
@ -443,7 +444,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
if (
selectedOption &&
selectedOption.type !== ContextMenuOptionType.URL &&
selectedOption.type !== ContextMenuOptionType.NoResults
selectedOption.type !== ContextMenuOptionType.NoResults &&
selectedOption.type !== ContextMenuOptionType.SectionHeader
) {
handleMentionSelect(selectedOption.type, selectedOption.value)
}
@ -559,7 +561,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
// Handle slash command - request fresh commands
const query = newValue
setSearchQuery(query)
setSelectedMenuIndex(0)
// Set to first selectable item (skip section headers)
setSelectedMenuIndex(1) // Section header is at 0, first command is at 1
// Request commands fresh each time slash menu is shown
vscode.postMessage({ type: "requestCommands" })
} else {