Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/extension/prompts/node/panel/editorIntegrationRules.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
6
import { BasePromptElementProps, PromptElement } from '@vscode/prompt-tsx';
7
import { IConfigurationService } from '../../../../platform/configuration/common/configurationService';
8
9
export class EditorIntegrationRules extends PromptElement {
10
render() {
11
return (
12
<>
13
Use Markdown formatting in your answers.<br />
14
Make sure to include the programming language name at the start of the Markdown code blocks.<br />
15
Avoid wrapping the whole response in triple backticks.<br />
16
<MathIntegrationRules />
17
The user works in an IDE called Visual Studio Code which has a concept for editors with open files, integrated unit test support, an output pane that shows the output of running the code as well as an integrated terminal.<br />
18
The active document is the source code the user is looking at right now.<br />
19
You can only give one reply for each conversation turn.<br />
20
</>
21
);
22
}
23
}
24
25
export class MathIntegrationRules extends PromptElement {
26
27
constructor(
28
props: BasePromptElementProps,
29
@IConfigurationService private readonly configService: IConfigurationService
30
) {
31
super(props);
32
}
33
34
render() {
35
const mathEnabled = this.configService.getNonExtensionConfig<boolean>('chat.math.enabled');
36
if (mathEnabled) {
37
return (
38
<>
39
Use KaTeX for math equations in your answers.<br />
40
Wrap inline math equations in $.<br />
41
Wrap more complex blocks of math equations in $$.<br />
42
</>
43
);
44
}
45
}
46
}
47
48