Skip to content
Closed
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
8 changes: 5 additions & 3 deletions packages/types/src/global-settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ import { languagesSchema } from "./vscode.js"

/**
* Default delay in milliseconds after writes to allow diagnostics to detect potential problems.
* This delay is particularly important for Go and other languages where tools like goimports
* need time to automatically clean up unused imports.
* Defaults to 0: the write path adds no artificial pacing by default, and post-save
* diagnostics are reported after the (zero) delay. Users who rely on auto-formatters that
* settle asynchronously (e.g. goimports for Go) can raise this setting to give formatters
* time to settle before diagnostics are captured.
*/
export const DEFAULT_WRITE_DELAY_MS = 1000
export const DEFAULT_WRITE_DELAY_MS = 0

/**
* Default values for the "auto-close files Zoo opened" settings.
Expand Down
2 changes: 0 additions & 2 deletions src/core/tools/WriteToFileTool.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from "path"
import delay from "delay"
import fs from "fs/promises"

import { type ClineSayTool, DEFAULT_WRITE_DELAY_MS } from "@roo-code/types"
Expand Down Expand Up @@ -146,7 +145,6 @@ export class WriteToFileTool extends BaseTool<"write_to_file"> {
true,
)

await delay(300)
task.diffViewProvider.scrollToFirstDiff()

let unified = fileExists
Expand Down
4 changes: 2 additions & 2 deletions src/core/webview/__tests__/ClineProvider.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1409,14 +1409,14 @@ describe("ClineProvider", () => {
expect(state.language).toBe("pt-BR")
})

test("writeDelayMs defaults to 1000ms", async () => {
test("writeDelayMs defaults to DEFAULT_WRITE_DELAY_MS", async () => {
// Mock globalState.get to return undefined for writeDelayMs
;(mockContext.globalState.get as any).mockImplementation((key: string) => {
return key === "writeDelayMs" ? undefined : null
})

const state = await provider.getState()
expect(state.writeDelayMs).toBe(1000)
expect(state.writeDelayMs).toBe(DEFAULT_WRITE_DELAY_MS)
})

test("getState applies fallback defaults for write, diff, and terminal settings", async () => {
Expand Down
Loading