Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions packages/types/src/codebase-index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,35 @@ export const CODEBASE_INDEX_DEFAULTS = {
SEARCH_SCORE_STEP: 0.05,
} as const

/**
* List of directories that are excluded from codebase indexing.
* These directories are typically large and would slow down indexing.
* The list is shared between the indexer and the UI to provide transparency.
*/
export const EXCLUDED_INDEXING_DIRECTORIES = [
"node_modules",
"__pycache__",
"env",
"venv",
"target/dependency",
"build/dependencies",
"dist",
"out",
"bundle",
"vendor",
"tmp",
"temp",
"deps",
"pkg",
"Pods",
".git",
] as const

/**
* Pattern for hidden directories (directories starting with a dot)
*/
export const EXCLUDED_HIDDEN_DIRECTORY_PATTERN = ".*" as const

/**
* CodebaseIndexConfig
*/
Expand Down
42 changes: 41 additions & 1 deletion webview-ui/src/components/chat/CodeIndexPopover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ import {
import * as ProgressPrimitive from "@radix-ui/react-progress"
import { AlertTriangle } from "lucide-react"

import { CODEBASE_INDEX_DEFAULTS } from "@roo-code/types"
import {
CODEBASE_INDEX_DEFAULTS,
EXCLUDED_INDEXING_DIRECTORIES,
EXCLUDED_HIDDEN_DIRECTORY_PATTERN,
} from "@roo-code/types"

import type { EmbedderProvider } from "@roo/embeddingModels"
import type { IndexingStatus } from "@roo/ExtensionMessage"
Expand Down Expand Up @@ -194,6 +198,7 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
const [open, setOpen] = useState(false)
const [isAdvancedSettingsOpen, setIsAdvancedSettingsOpen] = useState(false)
const [isSetupSettingsOpen, setIsSetupSettingsOpen] = useState(false)
const [isExcludedDirsOpen, setIsExcludedDirsOpen] = useState(false)

const [indexingStatus, setIndexingStatus] = useState<IndexingStatus>(externalIndexingStatus)

Expand Down Expand Up @@ -1593,6 +1598,41 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
)}
</div>

{/* Excluded Directories Info Section */}
<div className="mt-4">
<button
onClick={() => setIsExcludedDirsOpen(!isExcludedDirsOpen)}
className="flex items-center text-xs text-vscode-foreground hover:text-vscode-textLink-foreground focus:outline-none"
aria-expanded={isExcludedDirsOpen}>
<span
className={`codicon codicon-${isExcludedDirsOpen ? "chevron-down" : "chevron-right"} mr-1`}></span>
<span className="text-base font-semibold">
{t("settings:codeIndex.excludedDirectories.title")}
</span>
</button>

{isExcludedDirsOpen && (
<div className="mt-2 space-y-2">
<p className="text-sm text-vscode-descriptionForeground">
{t("settings:codeIndex.excludedDirectories.description")}
</p>
<div className="flex flex-wrap gap-1">
{EXCLUDED_INDEXING_DIRECTORIES.map((dir) => (
<span
key={dir}
className="inline-flex items-center px-2 py-0.5 rounded text-xs font-mono bg-vscode-badge-background text-vscode-badge-foreground">
{dir}
</span>
))}
</div>
<p className="text-xs text-vscode-descriptionForeground italic">
{t("settings:codeIndex.excludedDirectories.hiddenDirectoriesNote")} (
{EXCLUDED_HIDDEN_DIRECTORY_PATTERN})
</p>
</div>
)}
</div>

{/* Action Buttons */}
<div className="flex items-center justify-between gap-2 pt-6">
<div className="flex gap-2">
Expand Down
7 changes: 6 additions & 1 deletion webview-ui/src/i18n/locales/en/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,12 @@
"baseUrlRequired": "Base URL is required",
"modelDimensionMinValue": "Model dimension must be greater than 0"
},
"optional": "optional"
"optional": "optional",
"excludedDirectories": {
"title": "Excluded Directories",
"description": "These directories are automatically excluded from indexing to improve performance. Files in these directories will not be indexed or searchable.",
"hiddenDirectoriesNote": "Additionally, all hidden directories (starting with a dot) are excluded."
}
},
"autoApprove": {
"description": "Run these actions without asking for permission. Only enable for actions you fully trust and if you understand the security risks.",
Expand Down
Loading