This commit is contained in:
bkellam 2025-11-20 16:03:38 -08:00
parent bddbb76a6a
commit ceee66ed46
22 changed files with 39 additions and 24 deletions

View file

@ -6,7 +6,7 @@ import { memo, useEffect, useMemo, useState } from 'react'
import { useCodeMirrorHighlighter } from '@/hooks/useCodeMirrorHighlighter'
import tailwind from '@/tailwind'
import { measure } from '@/lib/utils'
import { SourceRange } from '@/features/search/types'
import { SourceRange } from '@/features/search'
// Define a plain text language
const plainTextLanguage = StreamLanguage.define({

View file

@ -5,7 +5,7 @@ import { Suggestion, SuggestionMode } from "./searchSuggestionsBox";
import { getRepos, search } from "@/app/api/(client)/client";
import { getSearchContexts } from "@/actions";
import { useMemo } from "react";
import { SearchSymbol } from "@/features/search/types";
import { SearchSymbol } from "@/features/search";
import { languageMetadataMap } from "@/lib/languageMetadata";
import {
VscSymbolClass,

View file

@ -3,7 +3,7 @@
import { EditorContextMenu } from "@/app/[domain]/components/editorContextMenu";
import { Button } from "@/components/ui/button";
import { ScrollArea } from "@/components/ui/scroll-area";
import { SearchResultChunk } from "@/features/search/types";
import { SearchResultChunk } from "@/features/search";
import { useCodeMirrorTheme } from "@/hooks/useCodeMirrorTheme";
import { useKeymapExtension } from "@/hooks/useKeymapExtension";
import { useCodeMirrorLanguageExtension } from "@/hooks/useCodeMirrorLanguageExtension";

View file

@ -2,7 +2,7 @@
import { useQuery } from "@tanstack/react-query";
import { CodePreview } from "./codePreview";
import { SearchResultFile } from "@/features/search/types";
import { SearchResultFile } from "@/features/search";
import { SymbolIcon } from "@radix-ui/react-icons";
import { SetStateAction, Dispatch, useMemo } from "react";
import { unwrapServiceError } from "@/lib/utils";

View file

@ -1,7 +1,7 @@
'use client';
import { FileIcon } from "@/components/ui/fileIcon";
import { RepositoryInfo, SearchResultFile } from "@/features/search/types";
import { RepositoryInfo, SearchResultFile } from "@/features/search";
import { cn, getCodeHostInfoForRepo } from "@/lib/utils";
import { LaptopIcon } from "@radix-ui/react-icons";
import Image from "next/image";

View file

@ -1,6 +1,6 @@
'use client';
import { SearchResultFile } from "@/features/search/types";
import { SearchResultFile } from "@/features/search";
import { useMemo } from "react";
import { useGetSelectedFromQuery } from "./useGetSelectedFromQuery";

View file

@ -11,7 +11,7 @@ import {
} from "@/components/ui/resizable";
import { Separator } from "@/components/ui/separator";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { RepositoryInfo, SearchResultFile, SearchStats } from "@/features/search/types";
import { RepositoryInfo, SearchResultFile, SearchStats } from "@/features/search";
import useCaptureEvent from "@/hooks/useCaptureEvent";
import { useDomain } from "@/hooks/useDomain";
import { useNonEmptyQueryParam } from "@/hooks/useNonEmptyQueryParam";

View file

@ -1,6 +1,6 @@
'use client';
import { SearchResultFile, SearchResultChunk } from "@/features/search/types";
import { SearchResultFile, SearchResultChunk } from "@/features/search";
import { LightweightCodeHighlighter } from "@/app/[domain]/components/lightweightCodeHighlighter";
import Link from "next/link";
import { getBrowsePath } from "@/app/[domain]/browse/hooks/utils";

View file

@ -5,7 +5,7 @@ import { Separator } from "@/components/ui/separator";
import { DoubleArrowDownIcon, DoubleArrowUpIcon } from "@radix-ui/react-icons";
import { useMemo } from "react";
import { FileMatch } from "./fileMatch";
import { RepositoryInfo, SearchResultFile } from "@/features/search/types";
import { RepositoryInfo, SearchResultFile } from "@/features/search";
import { Button } from "@/components/ui/button";
export const MAX_MATCHES_TO_PREVIEW = 3;

View file

@ -1,6 +1,6 @@
'use client';
import { RepositoryInfo, SearchResultFile } from "@/features/search/types";
import { RepositoryInfo, SearchResultFile } from "@/features/search";
import { useVirtualizer, VirtualItem } from "@tanstack/react-virtual";
import { useDebounce } from "@uidotdev/usehooks";
import { forwardRef, useCallback, useEffect, useImperativeHandle, useRef } from "react";

View file

@ -1,6 +1,6 @@
'use client';
import { RepositoryInfo, SearchRequest, SearchResultFile, SearchStats, StreamedSearchResponse } from '@/features/search/types';
import { RepositoryInfo, SearchRequest, SearchResultFile, SearchStats, StreamedSearchResponse } from '@/features/search';
import { useState, useCallback, useRef, useEffect } from 'react';
import * as Sentry from '@sentry/nextjs';

View file

@ -4,10 +4,12 @@ import { ServiceError } from "@/lib/serviceError";
import { GetVersionResponse, GetReposResponse } from "@/lib/types";
import { isServiceError } from "@/lib/utils";
import {
FileSourceResponse,
FileSourceRequest,
SearchRequest,
SearchResponse,
} from "@/features/search";
import {
FileSourceRequest,
FileSourceResponse,
} from "@/features/search/types";
import {
FindRelatedSymbolsRequest,

View file

@ -1,10 +1,9 @@
'use server';
import { search } from "@/features/search/searchApi";
import { search, searchRequestSchema } from "@/features/search";
import { isServiceError } from "@/lib/utils";
import { NextRequest } from "next/server";
import { schemaValidationError, serviceErrorResponse } from "@/lib/serviceError";
import { searchRequestSchema } from "@/features/search/types";
export const POST = async (request: NextRequest) => {
const body = await request.json();

View file

@ -1,7 +1,6 @@
'use server';
import { streamSearch } from '@/features/search/searchApi';
import { searchRequestSchema } from '@/features/search/types';
import { streamSearch, searchRequestSchema } from '@/features/search';
import { schemaValidationError, serviceErrorResponse } from '@/lib/serviceError';
import { isServiceError } from '@/lib/utils';
import { NextRequest } from 'next/server';

View file

@ -4,7 +4,7 @@ import { getBrowsePath } from "@/app/[domain]/browse/hooks/utils";
import { PathHeader } from "@/app/[domain]/components/pathHeader";
import { LightweightCodeHighlighter } from "@/app/[domain]/components/lightweightCodeHighlighter";
import { FindRelatedSymbolsResponse } from "@/features/codeNav/types";
import { RepositoryInfo, SourceRange } from "@/features/search/types";
import { RepositoryInfo, SourceRange } from "@/features/search";
import { useMemo, useRef } from "react";
import useCaptureEvent from "@/hooks/useCaptureEvent";
import { useVirtualizer } from "@tanstack/react-virtual";

View file

@ -2,7 +2,7 @@ import { Badge } from "@/components/ui/badge";
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { LightweightCodeHighlighter } from "@/app/[domain]/components/lightweightCodeHighlighter";
import { useMemo } from "react";
import { SourceRange } from "@/features/search/types";
import { SourceRange } from "@/features/search";
interface SymbolDefinitionPreviewProps {
symbolDefinition: {

View file

@ -1,5 +1,5 @@
import { findSearchBasedSymbolDefinitions } from "@/app/api/(client)/client";
import { SourceRange } from "@/features/search/types";
import { SourceRange } from "@/features/search";
import { useDomain } from "@/hooks/useDomain";
import { unwrapServiceError } from "@/lib/utils";
import { useQuery } from "@tanstack/react-query";

View file

@ -1,5 +1,5 @@
import { z } from "zod"
import { search } from "@/features/search/searchApi"
import { search } from "@/features/search"
import { InferToolInput, InferToolOutput, InferUITool, tool, ToolUIPart } from "ai";
import { isServiceError } from "@/lib/utils";
import { getFileSource } from "../search/fileSourceApi";

View file

@ -1,7 +1,7 @@
import 'server-only';
import { sew } from "@/actions";
import { search } from "@/features/search/searchApi";
import { search } from "@/features/search";
import { ServiceError } from "@/lib/serviceError";
import { isServiceError } from "@/lib/utils";
import { withOptionalAuthV2 } from "@/withAuthV2";

View file

@ -8,7 +8,7 @@ import { withOptionalAuthV2 } from "@/withAuthV2";
import { QueryIR } from './ir';
// @todo (bkellam) #574 : We should really be using `git show <hash>:<path>` to fetch file contents here.
// This will allow us to support permalinks to files at a specific revision that may not be indexed
// by zoekt.
// by zoekt. We should also refactor this out of the /search folder.
export const getFileSource = async ({ fileName, repository, branch }: FileSourceRequest): Promise<FileSourceResponse | ServiceError> => sew(() =>
withOptionalAuthV2(async () => {

View file

@ -0,0 +1,15 @@
export { search, streamSearch } from './searchApi';
export {
searchRequestSchema,
} from './types';
export type {
SourceRange,
SearchSymbol,
RepositoryInfo,
SearchRequest,
SearchResultFile,
SearchStats,
StreamedSearchResponse,
SearchResultChunk,
SearchResponse,
} from './types';

View file

@ -1,6 +1,6 @@
import { EditorSelection, Extension, StateEffect, StateField, Text, Transaction } from "@codemirror/state";
import { Decoration, DecorationSet, EditorView } from "@codemirror/view";
import { SourceRange } from "@/features/search/types";
import { SourceRange } from "@/features/search";
const setMatchState = StateEffect.define<{
selectedMatchIndex: number,