Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions evals/packages/types/src/roo-code-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const rooCodeDefaults: RooCodeSettings = {
apiProvider: "openrouter",
openRouterUseMiddleOutTransform: false,

lastShownAnnouncementId: "apr-30-2025-3-15",
lastShownAnnouncementId: "may-06-2025-3-16",

pinnedApiConfigs: {},

Expand Down Expand Up @@ -42,7 +42,7 @@ export const rooCodeDefaults: RooCodeSettings = {
terminalZshP10k: false,
terminalZdotdir: true,
terminalCompressProgressBar: true,
terminalShellIntegrationDisabled: true,
terminalShellIntegrationDisabled: false,

diffEnabled: true,
fuzzyMatchThreshold: 1,
Expand All @@ -53,7 +53,7 @@ export const rooCodeDefaults: RooCodeSettings = {
maxOpenTabsContext: 20,
maxWorkspaceFiles: 200,
showRooIgnoredFiles: true,
maxReadFileLine: 500,
maxReadFileLine: 500, // -1 to enable full file reading.

language: "en",
telemetrySetting: "enabled",
Expand Down
7 changes: 5 additions & 2 deletions src/core/tools/applyDiffTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export async function applyDiffTool(
const sharedMessageProps: ClineSayTool = {
tool: "appliedDiff",
path: getReadablePath(cline.cwd, removeClosingTag("path", relPath)),
diff: diffContent,
}

try {
Expand All @@ -46,8 +47,10 @@ export async function applyDiffTool(
return
}

const partialMessage = JSON.stringify(sharedMessageProps)
await cline.ask("tool", partialMessage, block.partial, toolProgressStatus).catch(() => {})
await cline
.ask("tool", JSON.stringify(sharedMessageProps), block.partial, toolProgressStatus)
.catch(() => {})

return
} else {
if (!relPath) {
Expand Down
21 changes: 11 additions & 10 deletions src/core/tools/insertContentTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ export async function insertContentTool(
const sharedMessageProps: ClineSayTool = {
tool: "insertContent",
path: getReadablePath(cline.cwd, removeClosingTag("path", relPath)),
diff: content,
lineNumber: line ? parseInt(line, 10) : undefined,
}

try {
if (block.partial) {
const partialMessage = JSON.stringify(sharedMessageProps)
await cline.ask("tool", partialMessage, block.partial).catch(() => {})
await cline.ask("tool", JSON.stringify(sharedMessageProps), block.partial).catch(() => {})
return
}

Expand Down Expand Up @@ -145,14 +145,15 @@ export async function insertContentTool(
return
}

const userFeedbackDiff = JSON.stringify({
tool: "insertContent",
path: getReadablePath(cline.cwd, relPath),
lineNumber: lineNumber,
diff: userEdits,
} satisfies ClineSayTool)

await cline.say("user_feedback_diff", userFeedbackDiff)
await cline.say(
"user_feedback_diff",
JSON.stringify({
tool: "insertContent",
path: getReadablePath(cline.cwd, relPath),
diff: userEdits,
lineNumber: lineNumber,
} satisfies ClineSayTool),
)

pushToolResult(
`The user made the following updates to your content:\n\n${userEdits}\n\n` +
Expand Down
15 changes: 8 additions & 7 deletions src/core/tools/searchAndReplaceTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,13 +226,14 @@ export async function searchAndReplaceTool(
return
}

const userFeedbackDiff = JSON.stringify({
tool: "appliedDiff",
path: getReadablePath(cline.cwd, relPath),
diff: userEdits,
} satisfies ClineSayTool)

await cline.say("user_feedback_diff", userFeedbackDiff)
await cline.say(
"user_feedback_diff",
JSON.stringify({
tool: "appliedDiff",
path: getReadablePath(cline.cwd, relPath),
diff: userEdits,
} satisfies ClineSayTool),
)

// Format and send response with user's updates
const resultMessage = [
Expand Down
1 change: 1 addition & 0 deletions src/core/tools/writeToFileTool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export async function writeToFileTool(
const sharedMessageProps: ClineSayTool = {
tool: fileExists ? "editedExistingFile" : "newFileCreated",
path: getReadablePath(cline.cwd, removeClosingTag("path", relPath)),
content: newContent,
isOutsideWorkspace,
}

Expand Down
64 changes: 15 additions & 49 deletions src/integrations/diagnostics/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import * as vscode from "vscode"
import * as path from "path"

import * as vscode from "vscode"
import deepEqual from "fast-deep-equal"

export function getNewDiagnostics(
Expand All @@ -21,68 +22,31 @@ export function getNewDiagnostics(
return newProblems
}

// Usage:
// const oldDiagnostics = // ... your old diagnostics array
// const newDiagnostics = // ... your new diagnostics array
// const newProblems = getNewDiagnostics(oldDiagnostics, newDiagnostics);
// Expected output:
// New problems:
// File: /path/to/file1.ts
// - New error in file1 (2:2)
// File: /path/to/file3.ts
// - New error in file3 (1:1)

// Example usage with mocks:
//
// // Mock old diagnostics
// const oldDiagnostics: [vscode.Uri, vscode.Diagnostic[]][] = [
// [vscode.Uri.file("/path/to/file1.ts"), [
// new vscode.Diagnostic(new vscode.Range(0, 0, 0, 10), "Old error in file1", vscode.DiagnosticSeverity.Error)
// ]],
// [vscode.Uri.file("/path/to/file2.ts"), [
// new vscode.Diagnostic(new vscode.Range(5, 5, 5, 15), "Old warning in file2", vscode.DiagnosticSeverity.Warning)
// ]]
// ];
//
// // Mock new diagnostics
// const newDiagnostics: [vscode.Uri, vscode.Diagnostic[]][] = [
// [vscode.Uri.file("/path/to/file1.ts"), [
// new vscode.Diagnostic(new vscode.Range(0, 0, 0, 10), "Old error in file1", vscode.DiagnosticSeverity.Error),
// new vscode.Diagnostic(new vscode.Range(2, 2, 2, 12), "New error in file1", vscode.DiagnosticSeverity.Error)
// ]],
// [vscode.Uri.file("/path/to/file2.ts"), [
// new vscode.Diagnostic(new vscode.Range(5, 5, 5, 15), "Old warning in file2", vscode.DiagnosticSeverity.Warning)
// ]],
// [vscode.Uri.file("/path/to/file3.ts"), [
// new vscode.Diagnostic(new vscode.Range(1, 1, 1, 11), "New error in file3", vscode.DiagnosticSeverity.Error)
// ]]
// ];
//
// const newProblems = getNewProblems(oldDiagnostics, newDiagnostics);
//
// console.log("New problems:");
// for (const [uri, diagnostics] of newProblems) {
// console.log(`File: ${uri.fsPath}`);
// for (const diagnostic of diagnostics) {
// console.log(`- ${diagnostic.message} (${diagnostic.range.start.line}:${diagnostic.range.start.character})`);
// }
// }
//
// // Expected output:
// // New problems:
// // File: /path/to/file1.ts
// // - New error in file1 (2:2)
// // File: /path/to/file3.ts
// // - New error in file3 (1:1)

// will return empty string if no problems with the given severity are found
// Will return empty string if no problems with the given severity are found.
export async function diagnosticsToProblemsString(
diagnostics: [vscode.Uri, vscode.Diagnostic[]][],
severities: vscode.DiagnosticSeverity[],
cwd: string,
): Promise<string> {
const documents = new Map<vscode.Uri, vscode.TextDocument>()
let result = ""

for (const [uri, fileDiagnostics] of diagnostics) {
const problems = fileDiagnostics.filter((d) => severities.includes(d.severity))

if (problems.length > 0) {
result += `\n\n${path.relative(cwd, uri.fsPath).toPosix()}`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling .toPosix() on a string is non‐standard. Consider using path.posix.relative or a dedicated utility for POSIX path conversion.

Suggested change
result += `\n\n${path.relative(cwd, uri.fsPath).toPosix()}`
result += `\n\n${path.posix.relative(cwd, uri.fsPath)}`


for (const diagnostic of problems) {
let label: string

switch (diagnostic.severity) {
case vscode.DiagnosticSeverity.Error:
label = "Error"
Expand All @@ -99,6 +63,7 @@ export async function diagnosticsToProblemsString(
default:
label = "Diagnostic"
}

const line = diagnostic.range.start.line + 1 // VSCode lines are 0-indexed
const source = diagnostic.source ? `${diagnostic.source} ` : ""
const document = documents.get(uri) || (await vscode.workspace.openTextDocument(uri))
Expand All @@ -108,5 +73,6 @@ export async function diagnosticsToProblemsString(
}
}
}

return result.trim()
}
Loading