agent-ecosystem/src/renderer/utils/mentionSuggestions.ts
iliya b6ec408451 feat: enhance error handling and reporting in ErrorBoundary component
- Added functionality to copy error details to clipboard and create GitHub issue reports directly from the error boundary.
- Introduced a new state variable to manage the copy confirmation status.
- Enhanced UI with buttons for copying error details and reporting bugs, improving user experience during error handling.
- Updated the rendering logic to display additional context about the error and the copied status.
- Refactored the component to ensure proper cleanup of timeouts on unmount.
2026-03-11 13:28:44 +02:00

27 lines
853 B
TypeScript

import type { MentionSuggestion } from '@renderer/types/mention';
export function getSuggestionTriggerChar(suggestion: MentionSuggestion): '@' | '#' {
return suggestion.type === 'task' ? '#' : '@';
}
export function getSuggestionInsertionText(suggestion: MentionSuggestion): string {
return suggestion.insertText ?? suggestion.name;
}
export function doesSuggestionMatchQuery(suggestion: MentionSuggestion, query: string): boolean {
const normalizedQuery = query.trim().toLowerCase();
if (!normalizedQuery) return true;
const haystacks = [
suggestion.name,
suggestion.subtitle,
suggestion.relativePath,
suggestion.searchText,
suggestion.teamDisplayName,
suggestion.teamName,
]
.filter(Boolean)
.map((value) => value!.toLowerCase());
return haystacks.some((value) => value.includes(normalizedQuery));
}