notebook - saveAs should not ask for file path if model has associated file path

This commit is contained in:
Benjamin Pasero 2021-08-06 08:33:19 +02:00
parent 7a8b42f0e0
commit f68d4571b6
No known key found for this signature in database
GPG key ID: E6380CC4C8219E65

View file

@ -154,11 +154,15 @@ export class NotebookEditorInput extends AbstractResourceEditorInput {
return undefined;
}
const dialogPath = this.hasCapability(EditorInputCapabilities.Untitled) ? await this._suggestName(this.labelService.getUriBasenameLabel(this.resource)) : this._editorModelReference.object.resource;
const target = await this._fileDialogService.pickFileToSave(dialogPath, options?.availableFileSystems);
if (!target) {
return undefined; // save cancelled
const pathCandidate = this.hasCapability(EditorInputCapabilities.Untitled) ? await this._suggestName(this.labelService.getUriBasenameLabel(this.resource)) : this._editorModelReference.object.resource;
let target: URI | undefined;
if (this._editorModelReference.object.hasAssociatedFilePath()) {
target = pathCandidate;
} else {
target = await this._fileDialogService.pickFileToSave(pathCandidate, options?.availableFileSystems);
if (!target) {
return undefined; // save cancelled
}
}
if (!provider.matches(target)) {