Skip to content

Commit 79bdee6

Browse files
authored
1 parent d434e27 commit 79bdee6

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffEditorInput.ts

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import { LazyStatefulPromise, raceTimeout } from 'vs/base/common/async';
77
import { onUnexpectedError } from 'vs/base/common/errors';
8+
import { IMarkdownString } from 'vs/base/common/htmlContent';
89
import { IDisposable, DisposableStore, toDisposable } from 'vs/base/common/lifecycle';
910
import { deepClone } from 'vs/base/common/objects';
1011
import { isDefined, isObject } from 'vs/base/common/types';
@@ -114,7 +115,12 @@ export class MultiDiffEditorInput extends EditorInput implements ILanguageSuppor
114115
modified: r.modifiedRef ? r.modifiedRef.object.textEditorModel : r.modifiedModel!,
115116
title: r.title,
116117
get options() {
117-
return computeOptions(textResourceConfigurationService.getValue(uri));
118+
r.modifiedRef?.object.isReadonly;
119+
120+
return {
121+
...getReadonlyConfiguration(r.modifiedRef?.object.isReadonly() ?? true),
122+
...computeOptions(textResourceConfigurationService.getValue(uri)),
123+
} satisfies IDiffEditorOptions;
118124
},
119125
onOptionsDidChange: h => this._textResourceConfigurationService.onDidChangeConfiguration(e => {
120126
if (e.affectsConfiguration(uri, 'editor') || e.affectsConfiguration(uri, 'diffEditor')) {
@@ -127,6 +133,13 @@ export class MultiDiffEditorInput extends EditorInput implements ILanguageSuppor
127133
}
128134
}
129135

136+
function getReadonlyConfiguration(isReadonly: boolean | IMarkdownString | undefined): { readOnly: boolean; readOnlyMessage: IMarkdownString | undefined } {
137+
return {
138+
readOnly: !!isReadonly,
139+
readOnlyMessage: typeof isReadonly !== 'boolean' ? isReadonly : undefined
140+
};
141+
}
142+
130143
function computeOptions(configuration: IEditorConfiguration): IDiffEditorOptions {
131144
const editorConfiguration = deepClone(configuration.editor);
132145

0 commit comments

Comments
 (0)