-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed as not planned
Labels
Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.Someone is actively working on this. Should link to a PR soon.enhancementNew feature or requestNew feature or requestproposal
Description
What specific problem does this solve?
Problem Statement (Show Package Names and File Paths during indexing)
Currently, when Roo-Code indexes files, it doesn't show what it is indexing. This is a confusing user experience. Also it in a multi-package workspace, it is unclear to the user whether all packages are getting indexed, or not. We should enhance the indexing status display to show package names and paths that are being indexed.
Plan
Files to Modify
1. src/services/code-index/state-manager.ts
Current Implementation:
public reportFileQueueProgress(processedFiles: number, totalFiles: number, currentFileBasename?: string): void {
const progressChanged = processedFiles !== this._processedItems || totalFiles !== this._totalItems
if (progressChanged || this._systemStatus !== "Indexing") {
this._processedItems = processedFiles
this._totalItems = totalFiles
this._currentItemUnit = "files"
this._systemStatus = "Indexing"
let message: string
if (totalFiles > 0 && processedFiles < totalFiles) {
message = `Processing ${processedFiles} / ${totalFiles} ${this._currentItemUnit}. Current: ${
currentFileBasename || "..."
}`
} else if (totalFiles > 0 && processedFiles === totalFiles) {
message = `Finished processing ${totalFiles} ${this._currentItemUnit} from queue.`
} else {
message = `File queue processed.`
}
}
}Proposed Changes:
- Update the function signature to accept full file path and package name
- Import the path module at the top of the file
- Enhance status message to include package name when available
// Add to imports
import * as path from "path"
// Update function signature
public reportFileQueueProgress(
processedFiles: number,
totalFiles: number,
currentFilePath?: string,
packageName?: string
): void {
const progressChanged = processedFiles !== this._processedItems || totalFiles !== this._totalItems
if (progressChanged || this._systemStatus !== "Indexing") {
this._processedItems = processedFiles
this._totalItems = totalFiles
this._currentItemUnit = "files"
this._systemStatus = "Indexing"
let message: string
if (totalFiles > 0 && processedFiles < totalFiles) {
// Extract file information for display
const fileBasename = currentFilePath ? path.basename(currentFilePath) : "..."
const packageDisplay = packageName ? `${packageName}` : ""
const pathDisplay = currentFilePath ? `${currentFilePath}` : ""
if (packageName) {
message = `Processing ${processedFiles} / ${totalFiles} ${this._currentItemUnit}. Package: ${packageDisplay}, File: ${fileBasename}`
} else {
message = `Processing ${processedFiles} / ${totalFiles} ${this._currentItemUnit}. Path: ${pathDisplay}`
}
} else if (totalFiles > 0 && processedFiles === totalFiles) {
message = `Finished processing ${totalFiles} ${this._currentItemUnit} from queue.`
} else {
message = `File queue processed.`
}
}
}2. src/services/code-index/orchestrator.ts
Current Implementation:
this.fileWatcher.onBatchProgressUpdate(({ processedInBatch, totalInBatch, currentFile }) => {
if (totalInBatch > 0 && this.stateManager.state !== "Indexing") {
this.stateManager.setSystemState("Indexing", "Processing file changes...")
}
this.stateManager.reportFileQueueProgress(
processedInBatch,
totalInBatch,
currentFile ? path.basename(currentFile) : undefined,
)
})Proposed Changes:
- Add package name extraction logic
- Pass the full file path and extracted package name to the state manager
this.fileWatcher.onBatchProgressUpdate(({ processedInBatch, totalInBatch, currentFile }) => {
if (totalInBatch > 0 && this.stateManager.state !== "Indexing") {
this.stateManager.setSystemState("Indexing", "Processing file changes...")
}
// Extract package name from file path if possible
let packageName = this.extractPackageName(currentFile)
this.stateManager.reportFileQueueProgress(
processedInBatch,
totalInBatch,
currentFile,
packageName
)
})- Add a new helper method at the end of the class:
/**
* Extracts package name from a file path
* @param filePath Path to extract package name from
* @returns Package name if identified, otherwise undefined
*/
private extractPackageName(filePath?: string): string | undefined {
if (!filePath) return undefined
// Check if path contains node_modules
const nodeModulesMatch = filePath.match(/node_modules[\/\\](@[^\/\\]+[\/\\][^\/\\]+|[^\/\\]+)/)
if (nodeModulesMatch && nodeModulesMatch[1]) {
return nodeModulesMatch[1]
}
// Check if path contains packages directory structure (monorepo)
const packagesMatch = filePath.match(/packages[\/\\]([^\/\\]+)/)
if (packagesMatch && packagesMatch[1]) {
return packagesMatch[1]
}
// Extract npm package name from package.json if close to the file
try {
const dirPath = path.dirname(filePath)
// Check if it's part of the src/ directory structure
const srcMatch = filePath.match(/src[\/\\]([^\/\\]+)/)
if (srcMatch && srcMatch[1]) {
return srcMatch[1]
}
} catch (error) {
// Ignore errors in package name extraction
}
return undefined
}3. src/services/code-index/processors/file-watcher.ts
Current Implementation:
The file watcher uses currentFile in several places when calling this._onBatchProgressUpdate.fire(), but it only shows the basename of the file, not the full path.
Proposed Changes:
Make sure all calls to this._onBatchProgressUpdate.fire() pass the full file path in the currentFile parameter.
Testing
- After implementing these changes, run Roo-Code and trigger an indexing operation
- Observe the indexing status in the UI
- Verify that package names and file paths are now displayed during indexing
- Test with various file types and directory structures to ensure package name extraction works correctly
Benefits
- Users will have more visibility into what is being indexed
- It will be easier to understand progress and identify any issues during indexing
- Better overall user experience with more informative status messages
Additional context (optional)
No response
Roo Code Task Links (Optional)
No response
Request checklist
- I've searched existing Issues and Discussions for duplicates
- This describes a specific problem with clear impact and context
Interested in implementing this?
- Yes, I'd like to help implement this feature
Implementation requirements
- I understand this needs approval before implementation begins
How should this be solved? (REQUIRED if contributing, optional otherwise)
No response
How will we know it works? (Acceptance Criteria - REQUIRED if contributing, optional otherwise)
No response
Technical considerations (REQUIRED if contributing, optional otherwise)
No response
Trade-offs and risks (REQUIRED if contributing, optional otherwise)
No response
Metadata
Metadata
Assignees
Labels
Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.Someone is actively working on this. Should link to a PR soon.enhancementNew feature or requestNew feature or requestproposal
Type
Projects
Status
Done