Skip to content

Commit ba4e922

Browse files
Copilotjoshspicer
andcommitted
Address code review feedback: remove unused parameter and rename function
Co-authored-by: joshspicer <23246594+joshspicer@users.noreply.github.com>
1 parent cb39ae7 commit ba4e922

4 files changed

Lines changed: 25 additions & 11 deletions

File tree

src/@types/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ declare module 'vscode' {
103103
isConfirmed?: boolean;
104104
isComplete?: boolean;
105105
toolSpecificData?: ChatTerminalToolInvocationData;
106+
fromSubAgent?: boolean;
106107

107108
constructor(toolName: string, toolCallId: string, isError?: boolean);
108109
}
@@ -646,7 +647,13 @@ declare module 'vscode' {
646647
}
647648

648649
export interface ChatRequest {
649-
modeInstructions?: string;
650-
modeInstructionsToolReferences?: readonly ChatLanguageModelToolReference[];
650+
readonly modeInstructions?: string;
651+
readonly modeInstructions2?: ChatRequestModeInstructions;
652+
}
653+
654+
export interface ChatRequestModeInstructions {
655+
readonly content: string;
656+
readonly toolReferences?: readonly ChatLanguageModelToolReference[];
657+
readonly metadata?: Record<string, boolean | string | number>;
651658
}
652659
}

src/@types/vscode.proposed.chatParticipantPrivate.d.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,8 @@ declare module 'vscode' {
187187

188188
isQuotaExceeded?: boolean;
189189

190+
isRateLimited?: boolean;
191+
190192
level?: ChatErrorLevel;
191193

192194
code?: string;
@@ -219,6 +221,10 @@ declare module 'vscode' {
219221
chatSessionId?: string;
220222
chatInteractionId?: string;
221223
terminalCommand?: string;
224+
/**
225+
* Lets us add some nicer UI to toolcalls that came from a sub-agent, but in the long run, this should probably just be rendered in a similar way to thinking text + tool call groups
226+
*/
227+
fromSubAgent?: boolean;
222228
}
223229

224230
export interface LanguageModelToolInvocationPrepareOptions<T> {
@@ -233,12 +239,13 @@ declare module 'vscode' {
233239

234240
export interface PreparedToolInvocation {
235241
pastTenseMessage?: string | MarkdownString;
236-
presentation?: 'hidden' | undefined;
242+
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
237243
}
238244

239245
export class ExtendedLanguageModelToolResult extends LanguageModelToolResult {
240246
toolResultMessage?: string | MarkdownString;
241247
toolResultDetails?: Array<Uri | Location>;
248+
toolMetadata?: unknown;
242249
}
243250

244251
// #region Chat participant detection

src/github/copilotRemoteAgent.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ export class CopilotRemoteAgentManager extends Disposable {
350350
}
351351

352352
async isAssignable(): Promise<boolean> {
353-
const cacheAndReturn = (b: boolean) => {
353+
const setCachedResult = (b: boolean) => {
354354
this._isAssignable = b;
355355
return b;
356356
};
@@ -361,7 +361,7 @@ export class CopilotRemoteAgentManager extends Disposable {
361361

362362
const repoInfo = await this.repoInfo();
363363
if (!repoInfo) {
364-
return cacheAndReturn(false);
364+
return setCachedResult(false);
365365
}
366366

367367
const { fm } = repoInfo;
@@ -372,12 +372,12 @@ export class CopilotRemoteAgentManager extends Disposable {
372372
const allAssignableUsers = fm.getAllAssignableUsers();
373373

374374
if (!allAssignableUsers) {
375-
return cacheAndReturn(false);
375+
return setCachedResult(false);
376376
}
377-
return cacheAndReturn(allAssignableUsers.some(user => COPILOT_LOGINS.includes(user.login)));
377+
return setCachedResult(allAssignableUsers.some(user => COPILOT_LOGINS.includes(user.login)));
378378
} catch (error) {
379379
// If there's an error fetching assignable users, assume not assignable
380-
return cacheAndReturn(false);
380+
return setCachedResult(false);
381381
}
382382
}
383383

src/issues/issueTodoProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export class IssueTodoProvider implements vscode.CodeActionProvider, vscode.Code
3030
this.expression = triggers.length > 0 ? new RegExp(triggers.map(trigger => escapeRegExp(trigger)).join('|')) : undefined;
3131
}
3232

33-
private findTodoInLine(lineNumber: number, line: string): { match: RegExpMatchArray; search: number; insertIndex: number } | undefined {
33+
private findTodoInLine(line: string): { match: RegExpMatchArray; search: number; insertIndex: number } | undefined {
3434
const truncatedLine = line.substring(0, MAX_LINE_LENGTH);
3535
const matches = truncatedLine.match(ISSUE_OR_URL_EXPRESSION);
3636
if (matches) {
@@ -61,7 +61,7 @@ export class IssueTodoProvider implements vscode.CodeActionProvider, vscode.Code
6161
let lineNumber = range.start.line;
6262
do {
6363
const line = document.lineAt(lineNumber).text;
64-
const todoInfo = this.findTodoInLine(lineNumber, line);
64+
const todoInfo = this.findTodoInLine(line);
6565
if (todoInfo) {
6666
const { match, search, insertIndex } = todoInfo;
6767
// Create GitHub Issue action
@@ -115,7 +115,7 @@ export class IssueTodoProvider implements vscode.CodeActionProvider, vscode.Code
115115
const codeLenses: vscode.CodeLens[] = [];
116116
for (let lineNumber = 0; lineNumber < document.lineCount; lineNumber++) {
117117
const line = document.lineAt(lineNumber).text;
118-
const todoInfo = this.findTodoInLine(lineNumber, line);
118+
const todoInfo = this.findTodoInLine(line);
119119
if (todoInfo) {
120120
const { match, search, insertIndex } = todoInfo;
121121
const range = new vscode.Range(lineNumber, search, lineNumber, search + match[0].length);

0 commit comments

Comments
 (0)