forked from microsoft/vscode-copilot-chat
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtodoListContextPrompt.tsx
More file actions
40 lines (36 loc) · 1.28 KB
/
Copy pathtodoListContextPrompt.tsx
File metadata and controls
40 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { BasePromptElementProps, PromptElement } from '@vscode/prompt-tsx';
import { ITodoListContextProvider } from '../../prompt/node/todoListContextProvider';
import { Tag } from '../../prompts/node/base/tag';
export interface TodoListContextPromptProps extends BasePromptElementProps {
sessionResource?: string;
}
/**
* A wrapper prompt element that provides todo list context
*/
export class TodoListContextPrompt extends PromptElement<TodoListContextPromptProps> {
constructor(
props: any,
@ITodoListContextProvider private readonly todoListContextProvider: ITodoListContextProvider,
) {
super(props);
}
async render() {
const sessionResource = this.props.sessionResource;
if (!sessionResource) {
return null;
}
const todoContext = await this.todoListContextProvider.getCurrentTodoContext(sessionResource);
if (!todoContext) {
return null;
}
return (
<Tag name='todoList'>
{todoContext}
</Tag>
);
}
}