mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
fix: address PR review comments
- Add missing response for 'start' command in worker - Move crypto import to top level for better performance - Remove unused .gitignore instance in worker - Move ignore instance creation outside loop in scanner for better performance
This commit is contained in:
parent
b7140e814b
commit
a92993504f
2 changed files with 9 additions and 14 deletions
|
|
@ -327,6 +327,9 @@ export class Scanner {
|
|||
const files: string[] = []
|
||||
let processedCount = 0
|
||||
|
||||
// Create ignore instance once, outside the loop
|
||||
const ig = ignore().add(allExcludePatterns)
|
||||
|
||||
for (const pattern of allIncludePatterns) {
|
||||
const matches = await glob(pattern, {
|
||||
cwd: this.workspacePath,
|
||||
|
|
@ -339,7 +342,6 @@ export class Scanner {
|
|||
for (const file of matches) {
|
||||
// Double-check exclusion patterns using ignore
|
||||
const relativePath = path.relative(this.workspacePath, file)
|
||||
const ig = ignore().add(allExcludePatterns)
|
||||
const isExcluded = relativePath ? ig.ignores(relativePath) : false
|
||||
|
||||
if (!isExcluded && !files.includes(file)) {
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import ignore from "ignore"
|
|||
import * as fs from "fs/promises"
|
||||
import * as path from "path"
|
||||
import { v5 as uuidv5 } from "uuid"
|
||||
import { createHash } from "crypto"
|
||||
|
||||
// Import embedders and vector store directly
|
||||
import { OpenAiEmbedder } from "../services/code-index/embedders/openai"
|
||||
|
|
@ -32,7 +33,6 @@ class IndexingWorker {
|
|||
private fileWatcher: FileWatcher | null = null
|
||||
private embedder: any = null
|
||||
private vectorStore: any = null
|
||||
private ignoreInstance: any = null
|
||||
private rooIgnoreController: RooIgnoreController | null = null
|
||||
|
||||
constructor() {
|
||||
|
|
@ -55,6 +55,11 @@ class IndexingWorker {
|
|||
|
||||
case "start":
|
||||
await this.startIndexing()
|
||||
this.sendResponse(id, {
|
||||
type: "status",
|
||||
state: "Indexed",
|
||||
message: "Indexing completed successfully",
|
||||
})
|
||||
break
|
||||
|
||||
case "stop":
|
||||
|
|
@ -141,17 +146,6 @@ class IndexingWorker {
|
|||
// Initialize vector store
|
||||
this.vectorStore = this.createVectorStore(config)
|
||||
|
||||
// Load .gitignore
|
||||
this.ignoreInstance = ignore()
|
||||
const ignorePath = path.join(config.workspacePath, ".gitignore")
|
||||
try {
|
||||
const content = await fs.readFile(ignorePath, "utf8")
|
||||
this.ignoreInstance.add(content)
|
||||
this.ignoreInstance.add(".gitignore")
|
||||
} catch (error) {
|
||||
// Ignore error if .gitignore doesn't exist
|
||||
}
|
||||
|
||||
// Initialize RooIgnoreController
|
||||
this.rooIgnoreController = new RooIgnoreController(config.workspacePath)
|
||||
await this.rooIgnoreController.initialize()
|
||||
|
|
@ -277,7 +271,6 @@ class IndexingWorker {
|
|||
const content = await fs.readFile(filePath, "utf8")
|
||||
|
||||
// Calculate hash
|
||||
const { createHash } = await import("crypto")
|
||||
const fileHash = createHash("sha256").update(content).digest("hex")
|
||||
|
||||
// Check cache
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue