Skip to content

Commit ddb9950

Browse files
authored
Fix slash command highlighting (#6325)
1 parent 7b756e3 commit ddb9950

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

webview-ui/src/components/chat/ChatTextArea.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
410410
const selectableOptions = options.filter(
411411
(option) =>
412412
option.type !== ContextMenuOptionType.URL &&
413-
option.type !== ContextMenuOptionType.NoResults,
413+
option.type !== ContextMenuOptionType.NoResults &&
414+
option.type !== ContextMenuOptionType.SectionHeader,
414415
)
415416

416417
if (selectableOptions.length === 0) return -1 // No selectable options
@@ -443,7 +444,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
443444
if (
444445
selectedOption &&
445446
selectedOption.type !== ContextMenuOptionType.URL &&
446-
selectedOption.type !== ContextMenuOptionType.NoResults
447+
selectedOption.type !== ContextMenuOptionType.NoResults &&
448+
selectedOption.type !== ContextMenuOptionType.SectionHeader
447449
) {
448450
handleMentionSelect(selectedOption.type, selectedOption.value)
449451
}
@@ -559,7 +561,8 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
559561
// Handle slash command - request fresh commands
560562
const query = newValue
561563
setSearchQuery(query)
562-
setSelectedMenuIndex(0)
564+
// Set to first selectable item (skip section headers)
565+
setSelectedMenuIndex(1) // Section header is at 0, first command is at 1
563566
// Request commands fresh each time slash menu is shown
564567
vscode.postMessage({ type: "requestCommands" })
565568
} else {

0 commit comments

Comments
 (0)