mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-07 08:26:51 +00:00
fix: rename setting to respectGitIgnore, add restart tracking, remove dead params
This commit is contained in:
parent
d13e039c19
commit
7973a571f5
12 changed files with 30 additions and 21 deletions
|
|
@ -51,7 +51,7 @@ export const codebaseIndexConfigSchema = z.object({
|
|||
// OpenRouter specific fields
|
||||
codebaseIndexOpenRouterSpecificProvider: z.string().optional(),
|
||||
// Gitignore behavior
|
||||
codebaseIndexRespectGitIgnore: z.boolean().optional(),
|
||||
respectGitIgnore: z.boolean().optional(),
|
||||
})
|
||||
|
||||
export type CodebaseIndexConfig = z.infer<typeof codebaseIndexConfigSchema>
|
||||
|
|
|
|||
|
|
@ -695,7 +695,7 @@ export interface WebviewMessage {
|
|||
codebaseIndexSearchMaxResults?: number
|
||||
codebaseIndexSearchMinScore?: number
|
||||
codebaseIndexOpenRouterSpecificProvider?: string // OpenRouter provider routing
|
||||
codebaseIndexRespectGitIgnore?: boolean // Whether to respect .gitignore when listing files
|
||||
respectGitIgnore?: boolean // Whether to respect .gitignore when listing files
|
||||
|
||||
// Secret settings
|
||||
codeIndexOpenAiKey?: string
|
||||
|
|
|
|||
|
|
@ -270,7 +270,7 @@ export async function getEnvironmentDetails(cline: Task, includeFileDetails: boo
|
|||
if (maxFiles === 0) {
|
||||
details += "(Workspace files context disabled. Use list_files to explore if needed.)"
|
||||
} else {
|
||||
const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
|
||||
const respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true
|
||||
const [files, didHitLimit] = await listFiles(cline.cwd, true, maxFiles, respectGitIgnore)
|
||||
const { showRooIgnoredFiles = false } = state ?? {}
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ export class ListFilesTool extends BaseTool<"list_files"> {
|
|||
const isOutsideWorkspace = isPathOutsideWorkspace(absolutePath)
|
||||
|
||||
const state = await task.providerRef.deref()?.getState()
|
||||
const respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
|
||||
const respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true
|
||||
const [files, didHitLimit] = await listFiles(absolutePath, recursive || false, 200, respectGitIgnore)
|
||||
const { showRooIgnoredFiles = false } = state ?? {}
|
||||
|
||||
|
|
|
|||
|
|
@ -2211,7 +2211,7 @@ export class ClineProvider
|
|||
codebaseIndexBedrockRegion: codebaseIndexConfig?.codebaseIndexBedrockRegion,
|
||||
codebaseIndexBedrockProfile: codebaseIndexConfig?.codebaseIndexBedrockProfile,
|
||||
codebaseIndexOpenRouterSpecificProvider: codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider,
|
||||
codebaseIndexRespectGitIgnore: codebaseIndexConfig?.codebaseIndexRespectGitIgnore,
|
||||
respectGitIgnore: codebaseIndexConfig?.respectGitIgnore,
|
||||
},
|
||||
// Only set mdmCompliant if there's an actual MDM policy
|
||||
// undefined means no MDM policy, true means compliant, false means non-compliant
|
||||
|
|
@ -2451,7 +2451,7 @@ export class ClineProvider
|
|||
codebaseIndexBedrockProfile: stateValues.codebaseIndexConfig?.codebaseIndexBedrockProfile,
|
||||
codebaseIndexOpenRouterSpecificProvider:
|
||||
stateValues.codebaseIndexConfig?.codebaseIndexOpenRouterSpecificProvider,
|
||||
codebaseIndexRespectGitIgnore: stateValues.codebaseIndexConfig?.codebaseIndexRespectGitIgnore,
|
||||
respectGitIgnore: stateValues.codebaseIndexConfig?.respectGitIgnore,
|
||||
},
|
||||
profileThresholds: stateValues.profileThresholds ?? {},
|
||||
includeDiagnosticMessages: stateValues.includeDiagnosticMessages ?? true,
|
||||
|
|
|
|||
|
|
@ -2543,7 +2543,7 @@ export const webviewMessageHandler = async (
|
|||
codebaseIndexSearchMaxResults: settings.codebaseIndexSearchMaxResults,
|
||||
codebaseIndexSearchMinScore: settings.codebaseIndexSearchMinScore,
|
||||
codebaseIndexOpenRouterSpecificProvider: settings.codebaseIndexOpenRouterSpecificProvider,
|
||||
codebaseIndexRespectGitIgnore: settings.codebaseIndexRespectGitIgnore,
|
||||
respectGitIgnore: settings.respectGitIgnore,
|
||||
}
|
||||
|
||||
// Save global state first
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class WorkspaceTracker {
|
|||
let respectGitIgnore = true
|
||||
try {
|
||||
const state = await this.providerRef.deref()?.getState()
|
||||
respectGitIgnore = state?.codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
|
||||
respectGitIgnore = state?.codebaseIndexConfig?.respectGitIgnore ?? true
|
||||
} catch {
|
||||
// Fall back to default (respect .gitignore) if state is not available
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export class CodeIndexConfigManager {
|
|||
private qdrantApiKey?: string
|
||||
private searchMinScore?: number
|
||||
private searchMaxResults?: number
|
||||
private respectGitIgnore: boolean = true
|
||||
|
||||
constructor(private readonly contextProxy: ContextProxy) {
|
||||
// Initialize with current configuration to avoid false restart triggers
|
||||
|
|
@ -86,6 +87,7 @@ export class CodeIndexConfigManager {
|
|||
this.qdrantApiKey = qdrantApiKey ?? ""
|
||||
this.searchMinScore = codebaseIndexSearchMinScore
|
||||
this.searchMaxResults = codebaseIndexSearchMaxResults
|
||||
this.respectGitIgnore = codebaseIndexConfig.respectGitIgnore ?? true
|
||||
|
||||
// Validate and set model dimension
|
||||
const rawDimension = codebaseIndexConfig.codebaseIndexEmbedderModelDimension
|
||||
|
|
@ -194,6 +196,7 @@ export class CodeIndexConfigManager {
|
|||
openRouterSpecificProvider: this.openRouterOptions?.specificProvider ?? "",
|
||||
qdrantUrl: this.qdrantUrl ?? "",
|
||||
qdrantApiKey: this.qdrantApiKey ?? "",
|
||||
respectGitIgnore: this.respectGitIgnore,
|
||||
}
|
||||
|
||||
// Refresh secrets from VSCode storage to ensure we have the latest values
|
||||
|
|
@ -410,6 +413,12 @@ export class CodeIndexConfigManager {
|
|||
return true
|
||||
}
|
||||
|
||||
// respectGitIgnore change
|
||||
const prevRespectGitIgnore = prev?.respectGitIgnore ?? true
|
||||
if (prevRespectGitIgnore !== this.respectGitIgnore) {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -45,4 +45,5 @@ export type PreviousConfigSnapshot = {
|
|||
openRouterSpecificProvider?: string
|
||||
qdrantUrl?: string
|
||||
qdrantApiKey?: string
|
||||
respectGitIgnore?: boolean
|
||||
}
|
||||
|
|
|
|||
|
|
@ -316,7 +316,7 @@ export class CodeIndexManager {
|
|||
let respectGitIgnore = true
|
||||
try {
|
||||
const codebaseIndexConfig = this._configManager!.getContextProxy()?.getGlobalState("codebaseIndexConfig")
|
||||
respectGitIgnore = codebaseIndexConfig?.codebaseIndexRespectGitIgnore ?? true
|
||||
respectGitIgnore = codebaseIndexConfig?.respectGitIgnore ?? true
|
||||
} catch {
|
||||
// Fall back to default (respect .gitignore) if config proxy is not available
|
||||
}
|
||||
|
|
|
|||
|
|
@ -233,20 +233,20 @@ function buildRipgrepArgs(dirPath: string, recursive: boolean, respectGitIgnore:
|
|||
}
|
||||
|
||||
if (recursive) {
|
||||
return [...args, ...buildRecursiveArgs(dirPath, respectGitIgnore), dirPath]
|
||||
return [...args, ...buildRecursiveArgs(dirPath), dirPath]
|
||||
} else {
|
||||
return [...args, ...buildNonRecursiveArgs(respectGitIgnore), dirPath]
|
||||
return [...args, ...buildNonRecursiveArgs(), dirPath]
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Build ripgrep arguments for recursive directory traversal
|
||||
*/
|
||||
function buildRecursiveArgs(dirPath: string, respectGitIgnore: boolean = true): string[] {
|
||||
function buildRecursiveArgs(dirPath: string): string[] {
|
||||
const args: string[] = []
|
||||
|
||||
// In recursive mode, respect .gitignore by default
|
||||
// (ripgrep does this automatically when respectGitIgnore is true)
|
||||
// (ripgrep does this automatically; --no-ignore-vcs is added at buildRipgrepArgs level when needed)
|
||||
|
||||
// Check if we're explicitly targeting a hidden directory
|
||||
// Normalize the path first to handle edge cases
|
||||
|
|
@ -307,7 +307,7 @@ function buildRecursiveArgs(dirPath: string, respectGitIgnore: boolean = true):
|
|||
/**
|
||||
* Build ripgrep arguments for non-recursive directory listing
|
||||
*/
|
||||
function buildNonRecursiveArgs(respectGitIgnore: boolean = true): string[] {
|
||||
function buildNonRecursiveArgs(): string[] {
|
||||
const args: string[] = []
|
||||
|
||||
// For non-recursive, limit to the current directory level
|
||||
|
|
@ -315,8 +315,7 @@ function buildNonRecursiveArgs(respectGitIgnore: boolean = true): string[] {
|
|||
args.push("--maxdepth", "1") // ripgrep uses maxdepth, not max-depth
|
||||
|
||||
// Respect .gitignore in non-recursive mode too
|
||||
// (ripgrep respects .gitignore by default when respectGitIgnore is true;
|
||||
// --no-ignore-vcs is added at a higher level when respectGitIgnore is false)
|
||||
// (ripgrep respects .gitignore by default; --no-ignore-vcs is added at buildRipgrepArgs level when needed)
|
||||
|
||||
// Apply directory exclusions for non-recursive searches
|
||||
for (const dir of DIRS_TO_IGNORE) {
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ interface LocalCodeIndexSettings {
|
|||
codebaseIndexVercelAiGatewayApiKey?: string
|
||||
codebaseIndexOpenRouterApiKey?: string
|
||||
codebaseIndexOpenRouterSpecificProvider?: string
|
||||
codebaseIndexRespectGitIgnore?: boolean
|
||||
respectGitIgnore?: boolean
|
||||
}
|
||||
|
||||
// Validation schema for codebase index settings
|
||||
|
|
@ -226,7 +226,7 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
|
|||
codebaseIndexVercelAiGatewayApiKey: "",
|
||||
codebaseIndexOpenRouterApiKey: "",
|
||||
codebaseIndexOpenRouterSpecificProvider: "",
|
||||
codebaseIndexRespectGitIgnore: true,
|
||||
respectGitIgnore: true,
|
||||
})
|
||||
|
||||
// Initial settings state - stores the settings when popover opens
|
||||
|
|
@ -267,7 +267,7 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
|
|||
codebaseIndexOpenRouterApiKey: "",
|
||||
codebaseIndexOpenRouterSpecificProvider:
|
||||
codebaseIndexConfig.codebaseIndexOpenRouterSpecificProvider || "",
|
||||
codebaseIndexRespectGitIgnore: codebaseIndexConfig.codebaseIndexRespectGitIgnore ?? true,
|
||||
respectGitIgnore: codebaseIndexConfig.respectGitIgnore ?? true,
|
||||
}
|
||||
setInitialSettings(settings)
|
||||
setCurrentSettings(settings)
|
||||
|
|
@ -1593,9 +1593,9 @@ export const CodeIndexPopover: React.FC<CodeIndexPopoverProps> = ({
|
|||
<div className="space-y-2">
|
||||
<div className="flex items-center gap-2">
|
||||
<VSCodeCheckbox
|
||||
checked={currentSettings.codebaseIndexRespectGitIgnore ?? true}
|
||||
checked={currentSettings.respectGitIgnore ?? true}
|
||||
onChange={(e: any) =>
|
||||
updateSetting("codebaseIndexRespectGitIgnore", e.target.checked)
|
||||
updateSetting("respectGitIgnore", e.target.checked)
|
||||
}>
|
||||
<span className="font-medium">
|
||||
{t("settings:codeIndex.respectGitIgnoreLabel")}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue