-
Notifications
You must be signed in to change notification settings - Fork 36.7k
Closed
Labels
Milestone
Description
For Copilot CLI Sessions to be restored properly we need a way to convert ChatPromptReference back to IChatRequestVariableEntry
Today we have a way to convert IChatRequestVariableEntry into ChatPromptReference
export namespace ChatPromptReference {
export function to(variable: IChatRequestVariableEntry, diagnostics: readonly [vscode.Uri, readonly vscode.Diagnostic[]][], logService: ILogService): vscode.ChatPromptReference | undefined {
}
}The current approach is not sufficient, and only handles file and generic
It is not a lossless conversion.
private convertReferenceToVariable(ref: vscode.ChatPromptReference) {
const value = ref.value && typeof ref.value === 'object' && 'uri' in ref.value && 'range' in ref.value
? typeConvert.Location.from(ref.value as vscode.Location)
: ref.value;
const range = ref.range ? { start: ref.range[0], endExclusive: ref.range[1] } : undefined;
const isFile = URI.isUri(value) || (value && typeof value === 'object' && 'uri' in value);
return {
id: ref.id,
name: ref.id,
value,
modelDescription: ref.modelDescription,
range,
kind: isFile ? 'file' as const : 'generic' as const
};
}