Ensure untitled notebook document is identified for edit session. (#242002)

This commit is contained in:
Peng Lyu
2025-02-25 22:04:56 -08:00
committed by GitHub
parent 5aa928a9f6
commit 90732c28df
2 changed files with 6 additions and 1 deletions
@@ -112,7 +112,7 @@ export class ChatEditingModifiedNotebookEntry extends AbstractChatEditingModifie
const loggingService = accessor.get(INotebookLoggingService);
const resourceRef: IReference<IResolvedNotebookEditorModel> = await resolver.resolve(uri);
const notebook = resourceRef.object.notebook;
const originalUri = ChatEditingNotebookFileSystemProvider.getSnapshotFileURI(telemetryInfo.requestId, notebook.uri.path);
const originalUri = ChatEditingNotebookFileSystemProvider.getSnapshotFileURI(telemetryInfo.requestId, notebook.uri.scheme === Schemas.untitled ? `/${notebook.uri.path}` : notebook.uri.path);
const [options, buffer] = await Promise.all([
notebookService.withNotebookDataProvider(resourceRef.object.notebook.notebookType),
notebookService.createNotebookTextDocumentSnapshot(notebook.uri, SnapshotContext.Backup, CancellationToken.None).then(s => streamToBuffer(s))
@@ -871,6 +871,11 @@ export class NotebookService extends Disposable implements INotebookService {
}
hasSupportedNotebooks(resource: URI): boolean {
if (this._models.has(resource)) {
// it might be untitled
return true;
}
const contribution = this.notebookProviderInfoStore.getContributedNotebook(resource);
if (!contribution.length) {
return false;