Skip to content

Commit c3d12cc

Browse files
committed
Merge branch '0.34/sessions' into ben/early-sloth
2 parents 52126b6 + 3c34714 commit c3d12cc

File tree

7 files changed

+61
-22
lines changed

7 files changed

+61
-22
lines changed

.github/workflows/pr.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88
branches:
99
- main
1010
- 'release/*'
11+
- '0.34/sessions'
1112

1213
permissions:
1314
contents: read

package.json

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4595,11 +4595,6 @@
45954595
"command": "github.copilot.cloud.sessions.proxy.closeChatSessionPullRequest",
45964596
"when": "chatSessionType == copilot-cloud-agent",
45974597
"group": "context"
4598-
},
4599-
{
4600-
"command": "github.copilot.cli.sessions.delete",
4601-
"when": "chatSessionType == copilotcli && config.chat.agentSessionsViewLocation == 'single-view'",
4602-
"group": "context"
46034598
}
46044599
]
46054600
},

src/extension/agents/copilotcli/common/copilotCLITools.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,14 @@ export function buildChatHistoryFromEvents(sessionId: string, events: readonly S
384384
const editId = details?.toolIdEditMap ? details.toolIdEditMap[toolCall.toolCallId] : undefined;
385385
const editedUris = getAffectedUrisForEditTool(toolCall);
386386
if (isCopilotCliEditToolCall(toolCall) && editId && editedUris.length > 0) {
387+
responsePart.presentation = 'hidden';
388+
currentResponseParts.push(responsePart);
387389
for (const uri of editedUris) {
388390
currentResponseParts.push(new ChatResponseMarkdownPart('\n````\n'));
389391
currentResponseParts.push(new ChatResponseCodeblockUriPart(uri, true, editId));
390-
currentResponseParts.push(new ChatResponseMarkdownPart('\n````\n'));
391392
currentResponseParts.push(new ChatResponseTextEditPart(uri, []));
392393
currentResponseParts.push(new ChatResponseTextEditPart(uri, true));
394+
currentResponseParts.push(new ChatResponseMarkdownPart('\n````\n'));
393395
}
394396
} else {
395397
currentResponseParts.push(responsePart);

src/extension/chatSessions/vscode-node/copilotCloudSessionsProvider.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -381,6 +381,20 @@ export class CopilotCloudSessionsProvider extends Disposable implements vscode.C
381381
const prResults = await Promise.all(prFetches);
382382
const prMap = new Map(prResults.filter(r => r.pr).map(r => [r.globalId, r.pr!]));
383383

384+
const validateISOTimestamp = (date: string | undefined): number | undefined => {
385+
try {
386+
if (!date) {
387+
return;
388+
}
389+
const time = new Date(date)?.getTime();
390+
if (time > 0) {
391+
return time;
392+
}
393+
} catch { }
394+
};
395+
396+
const createdAt = validateISOTimestamp(sessions[0].created_at);
397+
384398
// Create session items from latest sessions
385399
const sessionItems = await Promise.all(Array.from(latestSessionsMap.values()).map(async sessionItem => {
386400
const pr = prMap.get(sessionItem.resource_global_id);
@@ -394,10 +408,12 @@ export class CopilotCloudSessionsProvider extends Disposable implements vscode.C
394408
status: this.getSessionStatusFromSession(sessionItem),
395409
description: this.getPullRequestDescription(pr),
396410
tooltip: this.createPullRequestTooltip(pr),
397-
timing: {
398-
startTime: new Date(sessionItem.created_at).getTime(),
399-
endTime: sessionItem.completed_at ? new Date(sessionItem.completed_at).getTime() : undefined
400-
},
411+
...(createdAt ? {
412+
timing: {
413+
startTime: createdAt,
414+
endTime: validateISOTimestamp(sessionItem.completed_at),
415+
}
416+
} : {}),
401417
changes: {
402418
files: pr.files.totalCount,
403419
insertions: pr.additions,

src/extension/inlineEdits/vscode-node/jointInlineCompletionProvider.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,14 @@ class JointCompletionsProvider extends Disposable implements vscode.InlineComple
267267
}
268268
//#endregion
269269

270+
//#region Model picker
271+
public readonly onDidChangeModelInfo = this._inlineEditProvider?.onDidChangeModelInfo;
272+
public readonly setCurrentModelId = this._inlineEditProvider?.setCurrentModelId?.bind(this._inlineEditProvider);
273+
public get modelInfo(): InlineCompletionModelInfo | undefined {
274+
return this._inlineEditProvider?.modelInfo;
275+
}
276+
//#endregion
277+
270278
constructor(
271279
private readonly _completionsProvider: CopilotInlineCompletionItemProvider | undefined,
272280
private readonly _inlineEditProvider: InlineCompletionProviderImpl | undefined,

src/extension/vscode.proposed.chatParticipantAdditions.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ declare module 'vscode' {
105105
isComplete?: boolean;
106106
toolSpecificData?: ChatTerminalToolInvocationData;
107107
fromSubAgent?: boolean;
108+
presentation?: 'hidden' | 'hiddenAfterComplete' | undefined;
108109

109110
constructor(toolName: string, toolCallId: string, isError?: boolean);
110111
}

src/util/vs/editor/common/core/text/positionToOffsetImpl.ts

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -75,27 +75,43 @@ export function _setPositionOffsetTransformerDependencies(deps: IDeps): void {
7575
}
7676

7777
export class PositionOffsetTransformer extends PositionOffsetTransformerBase {
78-
private readonly lineStartOffsetByLineIdx: number[];
79-
private readonly lineEndOffsetByLineIdx: number[];
78+
private _lineStartOffsetByLineIdx: number[] | undefined;
79+
private _lineEndOffsetByLineIdx: number[] | undefined;
8080

8181
constructor(public readonly text: string) {
8282
super();
83+
}
84+
85+
private get lineStartOffsetByLineIdx(): number[] {
86+
if (!this._lineStartOffsetByLineIdx) {
87+
this._computeLineOffsets();
88+
}
89+
return this._lineStartOffsetByLineIdx!;
90+
}
91+
92+
private get lineEndOffsetByLineIdx(): number[] {
93+
if (!this._lineEndOffsetByLineIdx) {
94+
this._computeLineOffsets();
95+
}
96+
return this._lineEndOffsetByLineIdx!;
97+
}
8398

84-
this.lineStartOffsetByLineIdx = [];
85-
this.lineEndOffsetByLineIdx = [];
99+
private _computeLineOffsets(): void {
100+
this._lineStartOffsetByLineIdx = [];
101+
this._lineEndOffsetByLineIdx = [];
86102

87-
this.lineStartOffsetByLineIdx.push(0);
88-
for (let i = 0; i < text.length; i++) {
89-
if (text.charAt(i) === '\n') {
90-
this.lineStartOffsetByLineIdx.push(i + 1);
91-
if (i > 0 && text.charAt(i - 1) === '\r') {
92-
this.lineEndOffsetByLineIdx.push(i - 1);
103+
this._lineStartOffsetByLineIdx.push(0);
104+
for (let i = 0; i < this.text.length; i++) {
105+
if (this.text.charAt(i) === '\n') {
106+
this._lineStartOffsetByLineIdx.push(i + 1);
107+
if (i > 0 && this.text.charAt(i - 1) === '\r') {
108+
this._lineEndOffsetByLineIdx.push(i - 1);
93109
} else {
94-
this.lineEndOffsetByLineIdx.push(i);
110+
this._lineEndOffsetByLineIdx.push(i);
95111
}
96112
}
97113
}
98-
this.lineEndOffsetByLineIdx.push(text.length);
114+
this._lineEndOffsetByLineIdx.push(this.text.length);
99115
}
100116

101117
override getOffset(position: Position): number {

0 commit comments

Comments
 (0)