mirror of
https://github.com/pacnpal/Roo-Code.git
synced 2025-12-20 12:21:13 -05:00
Add 'No results' type to context menu
This commit is contained in:
@@ -92,6 +92,10 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
|
||||
const handleMentionSelect = useCallback(
|
||||
(type: string, value: string) => {
|
||||
if (type === "noResults") {
|
||||
return
|
||||
}
|
||||
|
||||
if (value === "file" || value === "folder") {
|
||||
setSelectedType(type.toLowerCase())
|
||||
setSearchQuery("")
|
||||
@@ -147,7 +151,9 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
if (optionsLength === 0) return prevIndex
|
||||
|
||||
// Find selectable options (non-URL types)
|
||||
const selectableOptions = options.filter((option) => option.type !== "url")
|
||||
const selectableOptions = options.filter(
|
||||
(option) => option.type !== "url" && option.type !== "noResults"
|
||||
)
|
||||
|
||||
if (selectableOptions.length === 0) return -1 // No selectable options
|
||||
|
||||
@@ -170,7 +176,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
const selectedOption = getContextMenuOptions(searchQuery, selectedType, searchPaths)[
|
||||
selectedMenuIndex
|
||||
]
|
||||
if (selectedOption && selectedOption.type !== "url") {
|
||||
if (selectedOption && selectedOption.type !== "url" && selectedOption.type !== "noResults") {
|
||||
handleMentionSelect(selectedOption.type, selectedOption.value)
|
||||
}
|
||||
return
|
||||
@@ -297,6 +303,7 @@ const ChatTextArea = forwardRef<HTMLTextAreaElement, ChatTextAreaProps>(
|
||||
const newCursorPosition = cursorPosition + trimmedUrl.length + 1
|
||||
setCursorPosition(newCursorPosition)
|
||||
setIntendedCursorPosition(newCursorPosition)
|
||||
setShowContextMenu(false)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
|
||||
case "folder":
|
||||
case "problems":
|
||||
case "url":
|
||||
case "noResults":
|
||||
return (
|
||||
<span
|
||||
style={{
|
||||
@@ -67,7 +68,7 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
|
||||
? "Problems"
|
||||
: option.value === "url"
|
||||
? "Paste URL to scrape"
|
||||
: ""}
|
||||
: "No results found"}
|
||||
</span>
|
||||
)
|
||||
default:
|
||||
@@ -113,21 +114,25 @@ const ContextMenu: React.FC<ContextMenuProps> = ({
|
||||
{filteredOptions.map((option, index) => (
|
||||
<div
|
||||
key={option.value}
|
||||
onClick={() => option.type !== "url" && onSelect(option.type, option.value)}
|
||||
onClick={() =>
|
||||
option.type !== "url" && option.type !== "noResults" && onSelect(option.type, option.value)
|
||||
}
|
||||
style={{
|
||||
padding: "8px 12px",
|
||||
cursor: option.type !== "url" ? "pointer" : "default",
|
||||
cursor: option.type !== "url" && option.type !== "noResults" ? "pointer" : "default",
|
||||
color: "var(--vscode-dropdown-foreground)",
|
||||
borderBottom: "1px solid var(--vscode-dropdown-border)",
|
||||
display: "flex",
|
||||
alignItems: "center",
|
||||
justifyContent: "space-between",
|
||||
backgroundColor:
|
||||
index === selectedIndex && option.type !== "url"
|
||||
index === selectedIndex && option.type !== "url" && option.type !== "noResults"
|
||||
? "var(--vscode-list-activeSelectionBackground)"
|
||||
: "",
|
||||
}}
|
||||
onMouseEnter={() => option.type !== "url" && setSelectedIndex(index)}>
|
||||
onMouseEnter={() =>
|
||||
option.type !== "url" && option.type !== "noResults" && setSelectedIndex(index)
|
||||
}>
|
||||
<div
|
||||
style={{
|
||||
display: "flex",
|
||||
|
||||
Reference in New Issue
Block a user