Move 'variableName' form of 'reference' to chatParticipantAdditions.d.ts (#212648)

Because this is confusing, and might be less relevant in the future
This commit is contained in:
Rob Lourens 2024-05-13 20:45:26 -07:00 committed by GitHub
parent 597cd68a41
commit bbc4ba1eff
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 11 additions and 5 deletions

View file

@ -153,6 +153,10 @@ class ChatAgentResponseStream {
reference(value, iconPath) {
throwIfDone(this.reference);
if ('variableName' in value) {
checkProposedApiEnabled(that._extension, 'chatParticipantAdditions');
}
if ('variableName' in value && !value.value) {
// The participant used this variable. Does that variable have any references to pull in?
const matchingVarData = that._request.variables.variables.find(v => v.name === value.variableName);

View file

@ -2439,7 +2439,7 @@ export namespace ChatResponseTextEditPart {
}
export namespace ChatResponseReferencePart {
export function from(part: vscode.ChatResponseReferencePart): Dto<IChatContentReference> {
export function from(part: types.ChatResponseReferencePart): Dto<IChatContentReference> {
const iconPath = ThemeIcon.isThemeIcon(part.iconPath) ? part.iconPath
: URI.isUri(part.iconPath) ? { light: URI.revive(part.iconPath) }
: (part.iconPath && 'light' in part.iconPath && 'dark' in part.iconPath && URI.isUri(part.iconPath.light) && URI.isUri(part.iconPath.dark) ? { light: URI.revive(part.iconPath.light), dark: URI.revive(part.iconPath.dark) }
@ -2478,7 +2478,7 @@ export namespace ChatResponseReferencePart {
value: value.reference.value && mapValue(value.reference.value)
} :
mapValue(value.reference)
);
) as vscode.ChatResponseReferencePart; // 'value' is extended with variableName
}
}

View file

@ -358,7 +358,7 @@ declare module 'vscode' {
* @param iconPath Icon for the reference shown in UI
* @returns This stream.
*/
reference(value: Uri | Location | { variableName: string; value?: Uri | Location }, iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri }): ChatResponseStream;
reference(value: Uri | Location, iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri }): ChatResponseStream;
/**
* Pushes a part to this stream.
@ -400,9 +400,9 @@ declare module 'vscode' {
}
export class ChatResponseReferencePart {
value: Uri | Location | { variableName: string; value?: Uri | Location };
value: Uri | Location;
iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri };
constructor(value: Uri | Location | { variableName: string; value?: Uri | Location }, iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri });
constructor(value: Uri | Location, iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri });
}
export class ChatResponseCommandButtonPart {

View file

@ -160,6 +160,8 @@ declare module 'vscode' {
*/
warning(message: string | MarkdownString): ChatResponseStream;
reference(value: Uri | Location | { variableName: string; value?: Uri | Location }, iconPath?: Uri | ThemeIcon | { light: Uri; dark: Uri }): ChatResponseStream;
push(part: ExtendedChatResponsePart): ChatResponseStream;
}