Roo-Code/src/shared
roomote[bot] b6bded9818
feat: add configurable delay for Go diagnostics to prevent premature error reporting (#5863)
* feat: add configurable delay for Go diagnostics to prevent premature error reporting

- Add diagnosticsDelayMs setting (default: 2000ms) to allow linters time to process
- Add diagnosticsEnabled setting to optionally disable diagnostic checking entirely
- Update DiffViewProvider.saveChanges() to use configurable delay before checking diagnostics
- Update all tool files (writeToFile, searchAndReplace, insertContent, applyDiff, multiApplyDiff) to pass diagnostic settings
- Add comprehensive tests for new diagnostic functionality
- Fixes issue where Go diagnostics errors were submitted to LLM before linter could clean up unused imports

Resolves #5859

* fix: add missing TypeScript type definitions for diagnostic settings

- Add diagnosticsDelayMs and diagnosticsEnabled to globalSettingsSchema
- Include properties in ExtensionState Pick type
- Add default values to EVALS_SETTINGS
- Fix VSCode mock to include DiagnosticSeverity for tests
- Resolves compilation errors in ClineProvider and webviewMessageHandler

* fix: update test mocks to support diagnostic settings in tool tests

- Add providerRef mock to insertContentTool and writeToFileTool tests
- Update mocks to include diagnosticsEnabled and diagnosticsDelayMs settings
- Fix test expectations to match new implementation with diagnostic configuration
- Resolves failing unit tests for insertContentTool.spec.ts and writeToFileTool.spec.ts

* fix: remove package-lock.json file (project uses pnpm)

* refactor: use existing writeDelayMs instead of diagnosticsDelayMs

- Remove diagnosticsDelayMs setting in favor of existing writeDelayMs
- Add min(0) validation for writeDelayMs in global settings schema
- Add error handling around delay function calls in DiffViewProvider
- Create DEFAULT_WRITE_DELAY_MS constant (1000ms) to replace repeated defaults
- Update all tool files to pass writeDelayMs instead of diagnosticsDelayMs
- Remove diagnosticsDelayMs from webview message handlers and types
- Update test files to use writeDelayMs instead of diagnosticsDelayMs

This refactoring consolidates diagnostic delay functionality to use the
existing writeDelayMs setting as requested in PR feedback.

* fix: resolve failing unit tests and TypeScript compilation errors

- Fix DiffViewProvider test to expect correct default delay (1000ms instead of 2000ms)
- Fix TypeScript type errors in ClineProvider test mock state object
- Correct terminalPowershellCounter and terminalZdotdir types to boolean
- Fix pinnedApiConfigs type from array to Record<string, boolean>

* fix: remove unrelated changes from ClineProvider.spec.ts

- Removed extensive unrelated property additions to mock state
- Kept only diagnosticsEnabled property which is related to Go diagnostics delay feature
- Removed unused DEFAULT_WRITE_DELAY_MS import
- Restored original structure and organization of mock state object

This addresses the feedback to remove unrelated changes while preserving
the necessary diagnostic functionality for the Go diagnostics delay feature.

* refactor: move DEFAULT_WRITE_DELAY_MS to packages/types/src/global-settings.ts

- Move DEFAULT_WRITE_DELAY_MS constant from src/shared/constants.ts to packages/types/src/global-settings.ts
- Update all import statements in affected files to use @roo-code/types
- Delete src/shared/constants.ts file as it is no longer needed
- Files updated:
  - src/integrations/editor/DiffViewProvider.ts
  - src/core/webview/ClineProvider.ts
  - src/core/tools/multiApplyDiffTool.ts
  - src/core/tools/applyDiffTool.ts
  - src/core/tools/searchAndReplaceTool.ts
  - src/core/tools/insertContentTool.ts
  - src/core/tools/writeToFileTool.ts

---------

Co-authored-by: Roo Code <roomote@roocode.com>
2025-07-18 16:12:00 -04:00
..
__tests__ Update the max-token calculation in model-params to use the shared logic (#5720) 2025-07-15 02:20:22 -04:00
api.ts Update the max-token calculation in model-params to use the shared logic (#5720) 2025-07-15 02:20:22 -04:00
array.ts Initial streaming refactor 2024-10-09 01:49:54 -04:00
checkExistApiConfig.ts Remove Gemini CLI provider (#5223) 2025-06-28 23:48:28 -04:00
combineApiRequests.ts Add a new @roo-code/types package and use it everywhere (#3912) 2025-05-26 12:06:45 -07:00
combineCommandSequences.ts feat(mcp): improve mcp with McpExecution, make UX like terminal execute (#3485) 2025-06-12 00:46:07 -04:00
context-mentions.ts feat: Allow escaping of context mentions (#4362) 2025-06-12 11:49:19 -04:00
cost.ts Yield the cost in usage data for Anthropic (#4849) 2025-06-18 11:59:11 -07:00
embeddingModels.ts feat: add gemini-embedding-001 model to code-index service (#5698) 2025-07-14 14:10:40 -04:00
experiments.ts Fixes #4882: Remove experimental setting for command execution in attempt_completion (#4884) 2025-06-20 17:48:01 -04:00
ExtensionMessage.ts feat: add configurable delay for Go diagnostics to prevent premature error reporting (#5863) 2025-07-18 16:12:00 -04:00
getApiMetrics.ts fix: exclude cache tokens from context window calculation (#5603) 2025-07-11 16:54:51 -04:00
globalFileNames.ts Use yaml as default custom modes format (#3749) 2025-05-20 16:44:29 -04:00
language.ts feat: Indonesian translation (#4672) 2025-06-13 20:25:05 -04:00
mcp.ts feature: add toggle for disable mcp server tool from prompt (#3551) 2025-06-20 19:14:59 -04:00
modes.ts feat: Enable dynamic tool selection in architect mode for context discovery (#5607) 2025-07-11 22:47:45 -04:00
package.ts Add a new @roo-code/types package and use it everywhere (#3912) 2025-05-26 12:06:45 -07:00
ProfileValidator.ts Roo Code Cloud (#4069) 2025-05-28 20:43:30 -07:00
safeJsonParse.ts feat: vertex/gemini prompt caching (#2996) 2025-04-28 15:11:35 -07:00
support-prompt.ts Fix linter errors (#3821) 2025-05-21 23:16:43 -07:00
TelemetrySetting.ts Add telemetry and privacy policy 2025-03-07 03:03:44 -05:00
todo.ts add todo tool (#5182) 2025-07-07 14:07:39 -04:00
tools.ts add todo tool (#5182) 2025-07-07 14:07:39 -04:00
vsCodeSelectorUtils.ts Prettier backfill 2025-01-17 14:11:28 -05:00
WebviewMessage.ts feat: add configurable delay for Go diagnostics to prevent premature error reporting (#5863) 2025-07-18 16:12:00 -04:00