MCPcopy Index your code
hub / github.com/codeaashu/claude-code / GlobalSearchDialog

Function GlobalSearchDialog

src/components/GlobalSearchDialog.tsx:38–264  ·  view source on GitHub ↗
(t0)

Source from the content-addressed store, hash-verified

36 * Debounced ripgrep search across the workspace.
37 */
38export function GlobalSearchDialog(t0) {
39 const $ = _c(40);
40 const {
41 onDone,
42 onInsert
43 } = t0;
44 useRegisterOverlay("global-search");
45 const {
46 columns,
47 rows
48 } = useTerminalSize();
49 const previewOnRight = columns >= 140;
50 const visibleResults = Math.min(VISIBLE_RESULTS, Math.max(4, rows - 14));
51 let t1;
52 if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
53 t1 = [];
54 $[0] = t1;
55 } else {
56 t1 = $[0];
57 }
58 const [matches, setMatches] = useState(t1);
59 const [truncated, setTruncated] = useState(false);
60 const [isSearching, setIsSearching] = useState(false);
61 const [query, setQuery] = useState("");
62 const [focused, setFocused] = useState(undefined);
63 const [preview, setPreview] = useState(null);
64 const abortRef = useRef(null);
65 const timeoutRef = useRef(null);
66 let t2;
67 let t3;
68 if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
69 t2 = () => () => {
70 if (timeoutRef.current) {
71 clearTimeout(timeoutRef.current);
72 }
73 abortRef.current?.abort();
74 };
75 t3 = [];
76 $[1] = t2;
77 $[2] = t3;
78 } else {
79 t2 = $[1];
80 t3 = $[2];
81 }
82 useEffect(t2, t3);
83 let t4;
84 let t5;
85 if ($[3] !== focused) {
86 t4 = () => {
87 if (!focused) {
88 setPreview(null);
89 return;
90 }
91 const controller = new AbortController();
92 const absolute = resolvePath(getCwd(), focused.file);
93 const start = Math.max(0, focused.line - PREVIEW_CONTEXT_LINES - 1);
94 readFileInRange(absolute, start, PREVIEW_CONTEXT_LINES * 2 + 1, undefined, controller.signal).then(r => {
95 if (controller.signal.aborted) {

Callers

nothing calls this directly

Calls 12

useRegisterOverlayFunction · 0.85
useTerminalSizeFunction · 0.85
getCwdFunction · 0.85
readFileInRangeFunction · 0.85
openFileInExternalEditorFunction · 0.85
logEventFunction · 0.85
truncatePathMiddleFunction · 0.85
highlightMatchFunction · 0.85
truncateToWidthFunction · 0.85
maxMethod · 0.80
trimStartMethod · 0.80
onDoneFunction · 0.50

Tested by

no test coverage detected