Fixes edge case (#158888)

This commit is contained in:
Henning Dieterichs 2022-08-23 15:23:48 +02:00 committed by GitHub
parent d5a59298e2
commit 9628fab4f8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 1 deletions

View file

@ -334,6 +334,10 @@ export class MergeEditorModel extends EditorModel {
return ModifiedBaseRangeState.conflicting; return ModifiedBaseRangeState.conflicting;
} }
public has(baseRange: ModifiedBaseRange): boolean {
return this.modifiedBaseRangeHandlingStateStores.get().has(baseRange);
}
public isHandled(baseRange: ModifiedBaseRange): IObservable<boolean> { public isHandled(baseRange: ModifiedBaseRange): IObservable<boolean> {
return this.modifiedBaseRangeHandlingStateStores.get().get(baseRange)!; return this.modifiedBaseRangeHandlingStateStores.get().get(baseRange)!;
} }

View file

@ -48,7 +48,6 @@ export class ModifiedBaseRange {
public readonly input1CombinedDiff = DetailedLineRangeMapping.join(this.input1Diffs); public readonly input1CombinedDiff = DetailedLineRangeMapping.join(this.input1Diffs);
public readonly input2CombinedDiff = DetailedLineRangeMapping.join(this.input2Diffs); public readonly input2CombinedDiff = DetailedLineRangeMapping.join(this.input2Diffs);
constructor( constructor(
public readonly baseRange: LineRange, public readonly baseRange: LineRange,
public readonly baseTextModel: ITextModel, public readonly baseTextModel: ITextModel,

View file

@ -131,6 +131,9 @@ export class InputCodeEditorView extends CodeEditorView {
className: derived('checkbox classnames', (reader) => { className: derived('checkbox classnames', (reader) => {
const classNames = []; const classNames = [];
const active = viewModel.activeModifiedBaseRange.read(reader); const active = viewModel.activeModifiedBaseRange.read(reader);
if (!model.has(baseRange)) {
return ''; // Invalid state, should only be observed temporarily
}
const isHandled = model.isHandled(baseRange).read(reader); const isHandled = model.isHandled(baseRange).read(reader);
if (isHandled) { if (isHandled) {
classNames.push('handled'); classNames.push('handled');