Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompts/node/git/gitChanges.tsx
13405 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
import { BasePromptElementProps, PromptElement } from '@vscode/prompt-tsx';
6
import { Diff } from '../../../../platform/git/common/gitDiffService';
7
import { basename } from '../../../../util/vs/base/common/path';
8
import { FilePathMode, FileVariable } from '../panel/fileVariable';
9
import { UnsafeCodeBlock } from '../panel/unsafeElements';
10
11
export interface GitChangesProps extends BasePromptElementProps {
12
readonly diffs: Diff[];
13
}
14
15
export class GitChanges extends PromptElement<GitChangesProps> {
16
render() {
17
return (
18
<>
19
{this.props.diffs.map((diff) => (
20
<>
21
<FileVariable passPriority={true} variableName={basename(diff.uri.toString())} variableValue={diff.uri} filePathMode={FilePathMode.AsComment} omitReferences />
22
<UnsafeCodeBlock passPriority={true} code={diff.diff} languageId='diff' /><br />
23
</>
24
))}
25
26
</>
27
);
28
}
29
}
30
31