microsoft/vscode · error · Error
Open a file to add code.
Error message
Open a file to add code.
What it means
Error "Open a file to add code." thrown in microsoft/vscode.
Source
Thrown at extensions/copilot/src/extension/intents/node/generateCodeIntent.ts:33
export class GenerateCodeIntent implements IIntent {
static readonly ID = Intent.Generate;
readonly id = GenerateCodeIntent.ID;
readonly description = l10n.t('Generate new code');
readonly locations = [ChatLocation.Editor];
readonly commandInfo: IIntentSlashCommandInfo = { hiddenFromUser: true };
constructor(
@IInstantiationService private readonly instantiationService: IInstantiationService,
@IEndpointProvider private readonly endpointProvider: IEndpointProvider,
) { }
async invoke(invocationContext: IIntentInvocationContext): Promise<IIntentInvocation> {
const { location, documentContext, request } = invocationContext;
if (!documentContext) {
throw new Error('Open a file to add code.');
}
const endpoint = await this.endpointProvider.getChatEndpoint(request);
return this.instantiationService.createInstance(GenericInlineIntentInvocation, this, location, endpoint, documentContext, EditStrategy.ForceInsertion);
}
}
View on GitHub (pinned to a94b963a32)
When it happens
Trigger: Thrown at extensions/copilot/src/extension/intents/node/generateCodeIntent.ts:33 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of microsoft/vscode@a94b963a32 (2026-08-12).
Data as JSON: /api/errors/c3114c5fe8a1fbbb.
Report an issue: GitHub.