Skip to content
Merged
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
2 changes: 2 additions & 0 deletions src/core/prompts/system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ The tool accepts these parameters:
- \`command\` (required): The CLI command to execute. Must be valid for the user's operating system.
- \`cwd\` (optional): The working directory to execute the command in. If not provided, the current working directory is used. Ensure this is always an absolute path, starting with \`/\`. If you are running the command in the root directly, skip this parameter. The command executor is defaulted to run in the root directory. You already have the Current Workspace Directory in <environment_details>.

CRITICAL: If the command is a very long running process, prefer to let the user to that they can run it manually in thier terminal. If the user specifically requests to run a long running command, you may proceed.

## search_files

The \`search_files\` tool allows you to search for patterns across files in a directory using regex.
Expand Down
34 changes: 12 additions & 22 deletions src/core/webview/webviewMessageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import {
TasksByIdRequestPayload,
UpdateGlobalStateMessage,
} from "../../shared/WebviewMessage"
import { myersDiff } from "../../services/continuedev/core/diff/myers"
// kilocode_change end

import {
Expand Down Expand Up @@ -1268,28 +1269,17 @@ export const webviewMessageHandler = async (

// Process each edit to accumulate diff stats
for (const editEntry of edit.edits) {
const beforeLines = (editEntry.originalContent || "").split("\n")
const afterLines = (editEntry.newContent || "").split("\n")

// Simple line-based diff calculation for each edit
if (beforeLines.length === 0 && afterLines.length > 0) {
// New content added
totalAdditions += afterLines.length
} else if (beforeLines.length > 0 && afterLines.length === 0) {
// Content deleted
totalDeletions += beforeLines.length
} else {
// Modified content - use simple line count difference
const lineDiff = afterLines.length - beforeLines.length
if (lineDiff > 0) {
totalAdditions += lineDiff
} else {
totalDeletions += Math.abs(lineDiff)
}
// If same line count, assume at least some lines changed
if (lineDiff === 0 && beforeLines.some((line, i) => line !== afterLines[i])) {
totalAdditions += 1
totalDeletions += 1
const beforeContent = editEntry.originalContent || ""
const afterContent = editEntry.newContent || ""

// Use proper diff algorithm to calculate changes
const diffLines = myersDiff(beforeContent, afterContent)

for (const diffLine of diffLines) {
if (diffLine.type === "new") {
totalAdditions++
} else if (diffLine.type === "old") {
totalDeletions++
}
}
}
Expand Down
38 changes: 12 additions & 26 deletions src/integrations/editor/FileEditReviewController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { promises as fs } from "fs"
import * as path from "path"

import { getReadablePath } from "../../utils/path"
import { myersDiff } from "../../services/continuedev/core/diff/myers"

type PendingFileEdit = {
relPath: string
Expand Down Expand Up @@ -282,32 +283,17 @@ export class FileEditReviewController implements vscode.Disposable {

for (const edit of this.pendingEdits.values()) {
for (const editEntry of edit.edits) {
const beforeLines = editEntry.originalContent ? editEntry.originalContent.split("\n") : []
const afterLines = editEntry.newContent ? editEntry.newContent.split("\n") : []

if (beforeLines.length === 0) {
// New content added
linesAdded += afterLines.length
} else if (afterLines.length === 0) {
// Content deleted
linesDeleted += beforeLines.length
} else {
// Modified content - count changed lines
const commonLength = Math.min(beforeLines.length, afterLines.length)
let changedInCommon = 0
for (let i = 0; i < commonLength; i++) {
if (beforeLines[i] !== afterLines[i]) {
changedInCommon++
}
}
linesUpdated += changedInCommon

// Account for added/deleted lines beyond common length
const diff = afterLines.length - beforeLines.length
if (diff > 0) {
linesAdded += diff
} else if (diff < 0) {
linesDeleted += Math.abs(diff)
const beforeContent = editEntry.originalContent || ""
const afterContent = editEntry.newContent || ""

// Use proper diff algorithm to calculate changes
const diffLines = myersDiff(beforeContent, afterContent)

for (const diffLine of diffLines) {
if (diffLine.type === "new") {
linesAdded++
} else if (diffLine.type === "old") {
linesDeleted++
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"displayName": "%extension.displayName%",
"description": "%extension.description%",
"publisher": "matterai",
"version": "5.2.4",
"version": "5.2.6",
"icon": "assets/icons/matterai-ic.png",
"galleryBanner": {
"color": "#FFFFFF",
Expand Down
Loading