mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 03:29:00 +01:00
Correctly mark WorkingCopyCapabilities.Untitled for custom editors
Fixes #108143
This commit is contained in:
@@ -362,7 +362,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
||||
}
|
||||
|
||||
public get capabilities(): WorkingCopyCapabilities {
|
||||
return WorkingCopyCapabilities.None;
|
||||
return this.isUntitled() ? WorkingCopyCapabilities.Untitled : WorkingCopyCapabilities.None;
|
||||
}
|
||||
|
||||
public isDirty(): boolean {
|
||||
@@ -375,6 +375,10 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
||||
return this._fromBackup;
|
||||
}
|
||||
|
||||
private isUntitled() {
|
||||
return this._editorResource.scheme === Schemas.untitled;
|
||||
}
|
||||
|
||||
private readonly _onDidChangeDirty: Emitter<void> = this._register(new Emitter<void>());
|
||||
readonly onDidChangeDirty: Event<void> = this._onDidChangeDirty.event;
|
||||
|
||||
@@ -504,7 +508,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
||||
return undefined;
|
||||
}
|
||||
|
||||
if (this._editorResource.scheme === Schemas.untitled) {
|
||||
if (this.isUntitled()) {
|
||||
const targetUri = await this.suggestUntitledSavePath(options);
|
||||
if (!targetUri) {
|
||||
return undefined;
|
||||
@@ -535,7 +539,7 @@ class MainThreadCustomEditorModel extends Disposable implements ICustomEditorMod
|
||||
}
|
||||
|
||||
private suggestUntitledSavePath(options: ISaveOptions | undefined): Promise<URI | undefined> {
|
||||
if (this._editorResource.scheme !== Schemas.untitled) {
|
||||
if (!this.isUntitled()) {
|
||||
throw new Error('Resource is not untitled');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user