From bbd1d81645deeb7085405910f8360932dd0c8b98 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 2 Aug 2018 21:40:06 +0200 Subject: [PATCH] readonly files: append decoration to label fixes #53022 --- .../parts/files/common/editors/fileEditorInput.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts index 1d0e661bdb6..7be9e9f8a2c 100644 --- a/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts +++ b/src/vs/workbench/parts/files/common/editors/fileEditorInput.ts @@ -127,7 +127,7 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { this.name = resources.basenameOrAuthority(this.resource); } - return this.decorateOrphanedFiles(this.name); + return this.decorateLabel(this.name); } @memoize @@ -192,14 +192,17 @@ export class FileEditorInput extends EditorInput implements IFileEditorInput { break; } - return this.decorateOrphanedFiles(title); + return this.decorateLabel(title); } - private decorateOrphanedFiles(label: string): string { + private decorateLabel(label: string): string { const model = this.textFileService.models.get(this.resource); if (model && model.hasState(ModelState.ORPHAN)) { return localize('orphanedFile', "{0} (deleted from disk)", label); } + if (model && model.isReadonly) { + return localize('readonlyFile', "{0} (read-only)", label); + } return label; }