Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
cedc8ce
🤖 Add full-text search to Review tab
ammar-agent Oct 19, 2025
67f24c0
🤖 Restructure ReviewPanel filtering as explicit two-tier pipeline
ammar-agent Oct 19, 2025
cbdba54
🤖 Add Ctrl/Cmd+F keybind to focus Review search input
ammar-agent Oct 19, 2025
dd0be75
🤖 Add regex toggle button to Review search
ammar-agent Oct 19, 2025
45bac26
🤖 Add Match Case button and workspace-scoped search state
ammar-agent Oct 19, 2025
f61ec9a
🤖 Improve Review search UI: unified state, greyscale buttons, and too…
ammar-agent Oct 19, 2025
d268877
🤖 Break review comment tooltip into two lines for better fit
ammar-agent Oct 20, 2025
ea8a0b8
🤖 Fix search controls alignment: consistent height and visible borders
ammar-agent Oct 20, 2025
083ceeb
🤖 Refactor search controls with cleaner CSS architecture
ammar-agent Oct 20, 2025
a04584d
🤖 Reduce search debounce from 300ms to 150ms for faster response
ammar-agent Oct 20, 2025
e81beed
🤖 Add search term highlighting in Review tab
ammar-agent Oct 20, 2025
4e868c4
🤖 Optimize search highlighting performance with caching and memoization
ammar-agent Oct 20, 2025
0fddc70
🤖 Use LRUCache for regex patterns for consistency
ammar-agent Oct 20, 2025
347cf50
🤖 Cache parsed DOM instead of highlighted HTML for better performance
ammar-agent Oct 20, 2025
aa1b291
🤖 Highlight search matches in file paths
ammar-agent Oct 20, 2025
7430f0e
🤖 Move search highlight CSS to global styles for consistency
ammar-agent Oct 20, 2025
9d7b494
🤖 Enhance active search button styling with blue highlight
ammar-agent Oct 20, 2025
4360451
🤖 Fix DOMParser instantiation for test environments
ammar-agent Oct 20, 2025
ad9f5da
🤖 Fix WrongDocumentError by using workingDoc for node creation
ammar-agent Oct 20, 2025
33b1e40
🤖 Use nullish coalescing assignment for ESLint compliance
ammar-agent Oct 20, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,14 @@ const globalStyles = css`
z-index: 1000;
pointer-events: none;
}

/* Search term highlighting - global for consistent styling across components */
mark.search-highlight {
background: rgba(255, 215, 0, 0.3);
color: inherit;
padding: 0;
border-radius: 2px;
}
`;

// Styled Components
Expand Down
20 changes: 18 additions & 2 deletions src/components/RightSidebar/CodeReview/HunkViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@
* HunkViewer - Displays a single diff hunk with syntax highlighting
*/

import React, { useState } from "react";
import React, { useState, useMemo } from "react";
import styled from "@emotion/styled";
import type { DiffHunk } from "@/types/review";
import { SelectableDiffRenderer } from "../../shared/DiffRenderer";
import {
type SearchHighlightConfig,
highlightSearchMatches,
} from "@/utils/highlighting/highlightSearchTerms";
import { escapeHtml } from "@/utils/highlighting/highlightDiffChunk";
import { Tooltip, TooltipWrapper } from "../../Tooltip";
import { usePersistedState } from "@/hooks/usePersistedState";
import { getReviewExpandStateKey } from "@/constants/storage";
Expand All @@ -21,6 +26,7 @@ interface HunkViewerProps {
onToggleRead?: (e: React.MouseEvent<HTMLElement>) => void;
onRegisterToggleExpand?: (hunkId: string, toggleFn: () => void) => void;
onReviewNote?: (note: string) => void;
searchConfig?: SearchHighlightConfig;
}

const HunkContainer = styled.div<{ isSelected: boolean; isRead: boolean }>`
Expand Down Expand Up @@ -186,6 +192,7 @@ export const HunkViewer = React.memo<HunkViewerProps>(
onToggleRead,
onRegisterToggleExpand,
onReviewNote,
searchConfig,
}) => {
// Parse diff lines (memoized - only recompute if hunk.content changes)
// Must be done before state initialization to determine initial collapse state
Expand All @@ -200,6 +207,14 @@ export const HunkViewer = React.memo<HunkViewerProps>(
};
}, [hunk.content]);

// Highlight filePath if search is active
const highlightedFilePath = useMemo(() => {
if (!searchConfig) {
return hunk.filePath;
}
return highlightSearchMatches(escapeHtml(hunk.filePath), searchConfig);
}, [hunk.filePath, searchConfig]);

// Persist manual expand/collapse state across remounts per workspace
// Maps hunkId -> isExpanded for user's manual preferences
// Enable listener to synchronize updates across all HunkViewer instances
Expand Down Expand Up @@ -291,7 +306,7 @@ export const HunkViewer = React.memo<HunkViewerProps>(
</Tooltip>
</TooltipWrapper>
)}
<FilePath>{hunk.filePath}</FilePath>
<FilePath dangerouslySetInnerHTML={{ __html: highlightedFilePath }} />
<LineInfo>
{!isPureRename && (
<LocStats>
Expand Down Expand Up @@ -339,6 +354,7 @@ export const HunkViewer = React.memo<HunkViewerProps>(
} as unknown as React.MouseEvent<HTMLElement>;
onClick?.(syntheticEvent);
}}
searchConfig={searchConfig}
/>
</HunkContent>
) : (
Expand Down
Loading