Это ide на основе vs code(code oss), в ней будет встроенный умный апи роутинг, свой маркет с плагинами(агент харнесс, поддержка java/kotlin/мобильной разработки, командная разработка проектов, orca, оркестратор агентов
For the response always follow these instructions:
<br/>
Describe in a single sentence how you would solve the problem. After that sentence, add an empty line. Then provide code changes or a terminal command to run.
When proposing to fix the problem by running a terminal command, write `{getCustomMarker('TERMINAL')}` and provide a code block that starts with ```bash and contains the terminal script inside.<br />
<PatchEditRules />
<Tag name='example' priority={100}>
<Tag name='user'>
I have the following code open in the editor.<br />
<PatchEditInputCodeBlock
uri={exampleUri}
languageId='csharp'
code={['// This is my class', 'class C { }', '', 'new C().Field = 9;']}
/>
</Tag>
<Tag name='assistant'>
The problem is that the class 'C' does not have a field or property named 'Field'. To fix this, you need to add a 'Field' property to the 'C' class.<br />
<br />
<PatchEditExamplePatch
changes={
[
{
uri: exampleUri,
find: ['// This is my class', 'class C { }'],
replace: ['// This is my class', 'class C {', 'public int Field { get; set; }', '}']
},
{
uri: exampleUri,
find: ['new C().Field = 9;'],
replace: ['// set the field to 9', 'new C().Field = 9;']
}
]
}
/>
</Tag>
</Tag>
</>
);
}
}
export class PatchEditFixReplyInterpreter implements ReplyInterpreter {
private _lastText: string = '';
private readonly _replyProcessor: PatchEditReplyProcessor;
constructor(
private readonly projectedDocument: ProjectedDocument,
private readonly documentUri: URI,
private readonly adjustedSelection: Range,
@ILogService private readonly logService: ILogService,
@IPromptPathRepresentationService private readonly promptPathRepresentationService: IPromptPathRepresentationService
) {
this._replyProcessor = getPatchEditReplyProcessor(promptPathRepresentationService);
}
async processResponse(context: IResponseProcessorContext, inputStream: AsyncIterable<IResponsePart>, outputStream: ChatResponseStream, token: CancellationToken): Promise<void> {
let inFirstParagraph = true; // print only the frist paragraph
let charactersSent = 0;
let newText = '';
for await (const part of inputStream) {
if (token.isCancellationRequested) {
return;
}
newText += part.delta.text;
if (newText.length > this._lastText.length) {
this._lastText = newText; // the new complete text
if (inFirstParagraph) {
// test if the new text added made the first paragraph complete
const paragraph = this._replyProcessor.getFirstParagraph(newText);
if (paragraph.length > charactersSent) {
// still in the first paragraph
outputStream.markdown(paragraph.substring(charactersSent));
charactersSent = paragraph.length;
} else {
// the first paragraph is complete
inFirstParagraph = false;
outputStream.markdown('\n\n');
outputStream.progress(l10n.t('Generating edits...'));
}
}
}
}
if (this._lastText.length === 0) {
outputStream.warning(l10n.t('Copilot did not provide a response. Please try again.'));
return;
}
const res = this._replyProcessor.process(this._lastText, this.projectedDocument.text, this.documentUri, this.adjustedSelection.start.line);
if (res.otherSections.length) {
for (const section of res.otherSections) {
outputStream.markdown(section.content.join('\n\n'));
}
}
if (res.otherPatches.length) {
for (const patch of res.otherPatches) {
if (patch.replace.length) {
const uri = this.promptPathRepresentationService.resolveFilePath(patch.filePath, this.documentUri.scheme);
if (uri) {
outputStream.markdown(patch.replace[0]);
outputStream.codeblockUri(uri);
outputStream.markdown(patch.replace.slice(1).join('\n'));
} else {
outputStream.markdown(patch.replace.join('\n'));
}
}
}
}
let edits = res.edits;
if (edits.length) {
edits = this.projectedDocument.projectBackTextEdit(edits);
if (res.edits.length !== edits.length) {
res.annotations.push({ message: 'Some edits were not applied because they were out of bounds.', label: OutcomeAnnotationLabel.SUMMARIZE_CONFLICT, severity: 'error' });
} else {
const annot = this._validateTextEditProject(res.edits, edits, this.projectedDocument);
if (annot) {
res.annotations.push(annot);
}
}
}
context.addAnnotations(res.annotations);
if (edits.length) {
outputStream.textEdit(this.documentUri, edits);
} else if (!res.otherPatches.length && !res.otherSections.length) {
outputStream.warning(l10n.t('The edit generation was not successful. Please try again.'));
}
if (res.annotations.length) {
this.logService.info(`[inline fix] Problems generating edits: $
{
.
annotations
.
map
(
=>
`${a.message} [${a.label}]`
)
.
join
(
', '
)
}
, invalid patches: $
{
.
invalidPatches
.
length
}
`);
}
}
private _validateTextEditProject(edits: TextEdit[], projectedBackEdits: TextEdit[], projectedDocument: ProjectedDocument): OutcomeAnnotation | undefined {
for (let i = 0; i < edits.length; i++) {
const projEditString = projectedDocument.positionOffsetTransformer.toOffsetRange(edits[i].range).substring(projectedDocument.text);
const origEditString = projectedDocument.originalPositionOffsetTransformer.toOffsetRange(projectedBackEdits[i].range).substring(projectedDocument.originalText);
if (projEditString !== origEditString) {
return { message: `Problem projecting edits: '${projEditString}' does not match '${origEditString}' (projectecBack)`, label: OutcomeAnnotationLabel.INVALID_PROJECTION, severity: 'error' };
}
}
return undefined;
}
}
class CodeMapperInputCodeBlock extends PromptElement<PatchEditInputCodeBlockProps> {
render() {
return (
<CodeBlock
uri={this.props.uri}
languageId={this.props.languageId}
code={Array.isArray(this.props.code) ? this.props.code.join('\n') : this.props.code}
shouldTrim={this.props.shouldTrim}
includeFilepath={true}
/>
);
}
}
class CodeMapperRulesAndExample extends PromptElement {
render() {
return (
<>
When proposing to fix the problem by running a terminal command, provide a code block that starts with ```bash and contains the terminal script inside.
<br/>
<CodeBlockFormattingRules/>
<Tagname='example'priority={100}>
<Tagname='user'>
I have the following code open in the editor.
<br/>
<CodeMapperInputCodeBlockuri={exampleUri}languageId='csharp'code={['// This is my class','class C { }','','new C().Field = 9;'].join('\n')}shouldTrim={false}/>
</Tag>
<Tagname='assistant'>
The problem is that the class 'C' does not have a field or property named 'Field'. To fix this, you need to add a 'Field' property to the 'C' class.
<br/>
<br/>
<CodeMapperInputCodeBlockuri={exampleUri}languageId='csharp'code={['// This is my class','class C {',' public int Field { get; set; }','}',''].join('\n')}shouldTrim={false}/>