Skip to content

Commit e7dc78c

Browse files
authored
Merge pull request microsoft#210265 from microsoft/roblou/xenogeneic-leech
Fix participant publisher showing "undefined" after reload
2 parents fc72077 + e3a5070 commit e7dc78c

File tree

5 files changed

+32
-54
lines changed

5 files changed

+32
-54
lines changed

src/vs/workbench/contrib/chat/common/chatModel.ts

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -821,20 +821,7 @@ export class ChatModel extends Disposable implements IChatModel {
821821
followups: r.response?.followups,
822822
isCanceled: r.response?.isCanceled,
823823
vote: r.response?.vote,
824-
agent: r.response?.agent ?
825-
// May actually be the full IChatAgent instance, just take the data props. slashCommands don't matter here.
826-
{
827-
id: r.response.agent.id,
828-
name: r.response.agent.name,
829-
description: r.response.agent.description,
830-
extensionId: r.response.agent.extensionId,
831-
metadata: r.response.agent.metadata,
832-
slashCommands: [],
833-
locations: r.response.agent.locations,
834-
isDefault: r.response.agent.isDefault,
835-
extensionPublisher: r.response.agent.extensionPublisher
836-
}
837-
: undefined,
824+
agent: r.response?.agent,
838825
slashCommand: r.response?.slashCommand,
839826
usedContext: r.response?.usedContext,
840827
contentReferences: r.response?.contentReferences

src/vs/workbench/contrib/chat/common/chatParserTypes.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -81,23 +81,6 @@ export class ChatRequestAgentPart implements IParsedChatRequestPart {
8181
get promptText(): string {
8282
return '';
8383
}
84-
85-
/**
86-
* Don't stringify all the agent methods, just data.
87-
*/
88-
toJSON(): any {
89-
return {
90-
kind: this.kind,
91-
range: this.range,
92-
editorRange: this.editorRange,
93-
agent: {
94-
id: this.agent.id,
95-
name: this.agent.name,
96-
description: this.agent.description,
97-
metadata: this.agent.metadata
98-
}
99-
};
100-
}
10184
}
10285

10386
/**

src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_deserialize.0.snap

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
text: "@ChatProviderWithUsedContext test request",
1212
parts: [
1313
{
14-
kind: "agent",
1514
range: {
1615
start: 0,
1716
endExclusive: 28
@@ -23,11 +22,18 @@
2322
endColumn: 29
2423
},
2524
agent: {
26-
id: "ChatProviderWithUsedContext",
2725
name: "ChatProviderWithUsedContext",
28-
description: undefined,
29-
metadata: { }
30-
}
26+
id: "ChatProviderWithUsedContext",
27+
extensionId: {
28+
value: "nullExtensionDescription",
29+
_lower: "nullextensiondescription"
30+
},
31+
extensionPublisher: "",
32+
locations: [ "panel" ],
33+
metadata: { },
34+
slashCommands: [ ]
35+
},
36+
kind: "agent"
3137
},
3238
{
3339
range: {
@@ -52,18 +58,16 @@
5258
isCanceled: false,
5359
vote: undefined,
5460
agent: {
55-
id: "ChatProviderWithUsedContext",
5661
name: "ChatProviderWithUsedContext",
57-
description: undefined,
62+
id: "ChatProviderWithUsedContext",
5863
extensionId: {
5964
value: "nullExtensionDescription",
6065
_lower: "nullextensiondescription"
6166
},
62-
metadata: { },
63-
slashCommands: [ ],
67+
extensionPublisher: "",
6468
locations: [ "panel" ],
65-
isDefault: undefined,
66-
extensionPublisher: ""
69+
metadata: { },
70+
slashCommands: [ ]
6771
},
6872
slashCommand: undefined,
6973
usedContext: {

src/vs/workbench/contrib/chat/test/common/__snapshots__/ChatService_can_serialize.1.snap

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
message: {
1111
parts: [
1212
{
13-
kind: "agent",
1413
range: {
1514
start: 0,
1615
endExclusive: 28
@@ -22,14 +21,21 @@
2221
endColumn: 29
2322
},
2423
agent: {
25-
id: "ChatProviderWithUsedContext",
2624
name: "ChatProviderWithUsedContext",
27-
description: undefined,
25+
id: "ChatProviderWithUsedContext",
26+
extensionId: {
27+
value: "nullExtensionDescription",
28+
_lower: "nullextensiondescription"
29+
},
30+
extensionPublisher: "",
31+
locations: [ "panel" ],
2832
metadata: {
2933
requester: { name: "test" },
3034
fullName: "test"
31-
}
32-
}
35+
},
36+
slashCommands: [ ]
37+
},
38+
kind: "agent"
3339
},
3440
{
3541
range: {
@@ -55,21 +61,19 @@
5561
isCanceled: false,
5662
vote: undefined,
5763
agent: {
58-
id: "ChatProviderWithUsedContext",
5964
name: "ChatProviderWithUsedContext",
60-
description: undefined,
65+
id: "ChatProviderWithUsedContext",
6166
extensionId: {
6267
value: "nullExtensionDescription",
6368
_lower: "nullextensiondescription"
6469
},
70+
extensionPublisher: "",
71+
locations: [ "panel" ],
6572
metadata: {
6673
requester: { name: "test" },
6774
fullName: "test"
6875
},
69-
slashCommands: [ ],
70-
locations: [ "panel" ],
71-
isDefault: undefined,
72-
extensionPublisher: ""
76+
slashCommands: [ ]
7377
},
7478
slashCommand: undefined,
7579
usedContext: {

src/vs/workbench/contrib/chat/test/common/chatService.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ suite('ChatService', () => {
163163

164164
await response.responseCompletePromise;
165165

166-
serializedChatData = chatModel1.toJSON();
166+
serializedChatData = JSON.parse(JSON.stringify(chatModel1));
167167
}
168168

169169
// try deserializing the state into a new service

0 commit comments

Comments
 (0)