提交 8281fa7f 编写于 作者: I isidor

do not attempt edit operation for for read-only editors

fixes #53257
上级 1cd75449
......@@ -42,4 +42,6 @@ export interface ITextEditorModel extends IEditorModel {
* Provides access to the underlying `ITextModel`.
*/
textEditorModel: ITextModel;
isReadonly(): boolean;
}
......@@ -69,6 +69,10 @@ export class SimpleModel implements ITextEditorModel {
return this.model;
}
public isReadonly(): boolean {
return false;
}
public dispose(): void {
this._onDispose.fire();
}
......
......@@ -180,6 +180,9 @@ class BulkEditModel implements IDisposable {
if (!model || !model.textEditorModel) {
throw new Error(`Cannot load file ${key}`);
}
if (model.isReadonly) {
throw new Error(localize('editorIsReadonly', "Cannot edit a read-only editor."));
}
let task: ModelEditTask;
if (this._editor && this._editor.getModel().uri.toString() === model.textEditorModel.uri.toString()) {
......
......@@ -254,8 +254,6 @@ export interface ITextFileEditorModel extends ITextEditorModel, IEncodingSupport
isResolved(): boolean;
isReadonly(): boolean;
isDisposed(): boolean;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册