Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/src/vs/platform/agentHost/common/diffComputeService.ts
13394 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { createDecorator } from '../../instantiation/common/instantiation.js';
7
8
export interface IDiffCountResult {
9
added: number;
10
removed: number;
11
}
12
13
export const IDiffComputeService = createDecorator<IDiffComputeService>('diffComputeService');
14
15
/** Default timeout for diff computation in milliseconds. */
16
export const DEFAULT_DIFF_TIMEOUT_MS = 5000;
17
18
/**
19
* Service that computes line diff counts (added/removed) between two
20
* text strings. Implementations may offload computation to a worker
21
* thread to avoid blocking the main thread.
22
*/
23
export interface IDiffComputeService {
24
readonly _serviceBrand: undefined;
25
26
/**
27
* Computes line-level diff counts between two text strings.
28
* @param timeoutMs - Maximum time in milliseconds before aborting. Defaults to {@link DEFAULT_DIFF_TIMEOUT_MS}.
29
*/
30
computeDiffCounts(original: string, modified: string, timeoutMs?: number): Promise<IDiffCountResult>;
31
}
32
33