Path: blob/main/src/vs/platform/agentHost/common/diffComputeService.ts
13394 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/45import { createDecorator } from '../../instantiation/common/instantiation.js';67export interface IDiffCountResult {8added: number;9removed: number;10}1112export const IDiffComputeService = createDecorator<IDiffComputeService>('diffComputeService');1314/** Default timeout for diff computation in milliseconds. */15export const DEFAULT_DIFF_TIMEOUT_MS = 5000;1617/**18* Service that computes line diff counts (added/removed) between two19* text strings. Implementations may offload computation to a worker20* thread to avoid blocking the main thread.21*/22export interface IDiffComputeService {23readonly _serviceBrand: undefined;2425/**26* Computes line-level diff counts between two text strings.27* @param timeoutMs - Maximum time in milliseconds before aborting. Defaults to {@link DEFAULT_DIFF_TIMEOUT_MS}.28*/29computeDiffCounts(original: string, modified: string, timeoutMs?: number): Promise<IDiffCountResult>;30}313233