send inline chat variable as dedicated hidden variable (#211285)

https://github.com/microsoft/vscode-copilot/issues/5236
This commit is contained in:
Johannes Rieken
2024-04-24 11:00:45 -07:00
committed by GitHub
parent deb95fb02c
commit 71ebcf973c

View File

@@ -229,6 +229,7 @@ export class InlineChatError extends Error {
const _bridgeAgentId = 'brigde.editor';
const _inlineChatContext = '_inlineChatContext';
const _inlineChatDocument = '_inlineChatDocument';
class InlineChatContext {
@@ -392,6 +393,17 @@ export class InlineChatSessionServiceImpl implements IInlineChatSessionService {
return undefined;
}
));
this._store.add(chatVariableService.registerVariable(
{ name: _inlineChatDocument, description: '', hidden: true },
async (_message, _arg, model) => {
for (const [, data] of this._sessions) {
if (data.session.chatModel === model) {
return [{ level: 'full', value: data.session.textModelN.uri }];
}
}
return undefined;
}
));
}