-
Notifications
You must be signed in to change notification settings - Fork 29.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot accept both sides for conflicts that cannot be merged semi-automatically #157632
Comments
You can set the checkboxes on both sides. |
NO! If I'd be able to do it I'd not open an issue. |
developer have to make decision about what merge and how to merge. NOT IDE! IDE has to help to do merge or replace! |
I have to switch to GoLand because of your "smart" merge........ |
Or change the |
Pinging @hediet |
Can you share details of your merge conflict? |
In this case, you cannot accept both sides automatically. |
why? I want to accept both cases and then edit them both in bottom (result) pane. |
Well, I was also harmed by this change. I have a file with a list od itens, that is incremented in each branch differently, so when merge more than one branch this file always has conflicts that I have to accept both, because the final branch should have the list with all itens that each branch wrote... Before I just had to click one button, and now I have to copy and past manually. Change git.mergeEditor really not a good idea.... please put this feature back. |
@danilomourelle see above and elsewhere for how to switch back to the previous way. |
Solution provide is to manually copy the lines? VC detailsVersion: 1.70.0 (user setup)
|
@Aldo-f thanks for your screen recording! These gifs help us a lot to understand UI issues of the new merge editor.
Actually, this is an issue about the diffing algorithm we use. In the upcoming release of VS Code (1.71), you can enable it in your settings like this:
This is the result: @isidorn FYI, this is an example of where bad diffing causes confusion. |
Thanks @hediet. Nice thing to consider swapping. ;) |
@Aldo-f what's your impression of the improvements we did in VS Insiders now that you tried it out? |
in any cases allow to select both checkboxes and add both cases to result pane. IDE can warn coder but not forbid to select both cases. |
Implemented in d3a7d7d Verification steps: {
"languageId": "typescript",
"base": "\nexport class InputCodeEditorView extends CodeEditorView {\n\tprivate readonly decorations = derived(`input${this.inputNumber}.decorations`, reader => {\n\t\tconst viewModel = this.viewModel.read(reader);\n\t\tif (!viewModel) {\n\t\t\treturn [];\n\t\t}\n\t\tconst model = viewModel.model;\n\n\t\tconst activeModifiedBaseRange = viewModel.activeModifiedBaseRange.read(reader);\n\n\t\tconst result = new Array<IModelDeltaDecoration>();\n\t\tfor (const modifiedBaseRange of model.modifiedBaseRanges.read(reader)) {\n\n\t\t\tconst range = modifiedBaseRange.getInputRange(this.inputNumber);\n\t\t\tif (range && !range.isEmpty) {\n\t\t\t\tconst blockClassNames = ['merge-editor-block'];\n\t\t\t\tconst isHandled = model.isHandled(modifiedBaseRange).read(reader);\n\t\t\t\tif (isHandled) {\n\t\t\t\t\tblockClassNames.push('handled');\n\t\t\t\t}\n\t\t\t\tif (modifiedBaseRange === activeModifiedBaseRange) {\n\t\t\t\t\tblockClassNames.push('focused');\n\t\t\t\t}\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\n\t\t\t\t\tblockClassNames.push('conflicting');\n\t\t\t\t}\n\t\t\t\tconst inputClassName = this.inputNumber === 1 ? 'input1' : 'input2';\n\t\t\t\tblockClassNames.push(inputClassName);\n\n\t\t\t\tresult.push({\n\t\t\t\t\trange: range.toInclusiveRange()!,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tisWholeLine: true,\n\t\t\t\t\t\tblockClassName: blockClassNames.join(' '),\n\t\t\t\t\t\tdescription: 'Merge Editor',\n\t\t\t\t\t\tminimap: {\n\t\t\t\t\t\t\tposition: MinimapPosition.Gutter,\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\n\t\t\t\t\t\t},\n\t\t\t\t\t\toverviewRuler: modifiedBaseRange.isConflicting ? {\n\t\t\t\t\t\t\tposition: OverviewRulerLane.Center,\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\n\t\t\t\t\t\t} : undefined\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\n\t\t\t\t\tconst inputDiffs = modifiedBaseRange.getInputDiffs(this.inputNumber);\n\t\t\t\t\tfor (const diff of inputDiffs) {\n\t\t\t\t\t\tconst range = diff.outputRange.toInclusiveRange();\n\t\t\t\t\t\tif (range) {\n\t\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\t\trange,\n\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff ${inputClassName}`,\n\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor',\n\t\t\t\t\t\t\t\t\tisWholeLine: true,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (diff.rangeMappings) {\n\t\t\t\t\t\t\tfor (const d of diff.rangeMappings) {\n\t\t\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\t\t\trange: d.outputRange,\n\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff-word ${inputClassName}`,\n\t\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t});\n\n\tprivate readonly modifiedBaseRangeGutterItemInfos = derived(`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`, reader => {\n\t\tconst viewModel = this.viewModel.read(reader);\n\t\tif (!viewModel) { return []; }\n\t\tconst model = viewModel.model;\n\t\tconst inputNumber = this.inputNumber;\n\n\t\treturn model.modifiedBaseRanges.read(reader)\n\t\t\t.filter((r) => r.getInputDiffs(this.inputNumber).length > 0)\n\t\t\t.map<ModifiedBaseRangeGutterItemInfo>((baseRange, idx) => ({\n\t\t\t\tid: idx.toString(),\n\t\t\t\trange: baseRange.getInputRange(this.inputNumber),\n\t\t\t\tenabled: model.isUpToDate,\n\t\t\t\ttoggleState: derived('checkbox is checked', (reader) => {\n\t\t\t\t\tconst input = model\n\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t.read(reader)\n\t\t\t\t\t\t.getInput(this.inputNumber);\n\t\t\t\t\treturn input === InputState.second && !baseRange.isOrderRelevant\n\t\t\t\t\t\t? InputState.first\n\t\t\t\t\t\t: input;\n\t\t\t\t}\n\t\t\t\t),\n\t\t\t\tclassName: derived('checkbox classnames', (reader) => {\n\t\t\t\t\tconst classNames = [];\n\t\t\t\t\tconst active = viewModel.activeModifiedBaseRange.read(reader);\n\t\t\t\t\tif (!model.has(baseRange)) {\n\t\t\t\t\t\treturn ''; // Invalid state, should only be observed temporarily\n\t\t\t\t\t}\n\t\t\t\t\tconst isHandled = model.isHandled(baseRange).read(reader);\n\t\t\t\t\tif (isHandled) {\n\t\t\t\t\t\tclassNames.push('handled');\n\t\t\t\t\t}\n\t\t\t\t\tif (baseRange === active) {\n\t\t\t\t\t\tclassNames.push('focused');\n\t\t\t\t\t}\n\t\t\t\t\treturn classNames.join(' ');\n\t\t\t\t}),\n\t\t\t\tsetState: (value, tx) => viewModel.setState(\n\t\t\t\t\tbaseRange,\n\t\t\t\t\tmodel\n\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t.get()\n\t\t\t\t\t\t.withInputValue(this.inputNumber, value),\n\t\t\t\t\ttx\n\t\t\t\t),\n\t\t\t\ttoggleBothSides() {\n\t\t\t\t\ttransaction(tx => {\n\t\t\t\t\t\t/** @description Context Menu: toggle both sides */\n\t\t\t\t\t\tconst state = model\n\t\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t\t.get();\n\t\t\t\t\t\tmodel.setState(\n\t\t\t\t\t\t\tbaseRange,\n\t\t\t\t\t\t\tstate\n\t\t\t\t\t\t\t\t.toggle(inputNumber)\n\t\t\t\t\t\t\t\t.toggle(inputNumber === 1 ? 2 : 1),\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\ttx\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tgetContextMenuActions: () => {\n\t\t\t\t\tconst state = model.getState(baseRange).get();\n\t\t\t\t\tconst handled = model.isHandled(baseRange).get();\n\n\t\t\t\t\tconst update = (newState: ModifiedBaseRangeState) => {\n\t\t\t\t\t\ttransaction(tx => {\n\t\t\t\t\t\t\t/** @description Context Menu: Update Base Range State */\n\t\t\t\t\t\t\treturn viewModel.setState(baseRange, newState, tx);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tfunction action(id: string, label: string, targetState: ModifiedBaseRangeState, checked: boolean) {\n\t\t\t\t\t\tconst action = new Action(id, label, undefined, true, () => {\n\t\t\t\t\t\t\tupdate(targetState);\n\t\t\t\t\t\t});\n\t\t\t\t\t\taction.checked = checked;\n\t\t\t\t\t\treturn action;\n\t\t\t\t\t}\n\t\t\t\t\tconst both = state.input1 && state.input2;\n\n\t\t\t\t\treturn [\n\t\t\t\t\t\tbaseRange.input1Diffs.length > 0\n\t\t\t\t\t\t\t? action(\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput1',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input1.title),\n\t\t\t\t\t\t\t\tstate.toggle(1),\n\t\t\t\t\t\t\t\tstate.input1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tbaseRange.input2Diffs.length > 0\n\t\t\t\t\t\t\t? action(\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput2',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input2.title),\n\t\t\t\t\t\t\t\tstate.toggle(2),\n\t\t\t\t\t\t\t\tstate.input2\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tbaseRange.isConflicting\n\t\t\t\t\t\t\t? setFields(\n\t\t\t\t\t\t\t\taction(\n\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\n\t\t\t\t\t\t\t\t\tlocalize(\n\t\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\n\t\t\t\t\t\t\t\t\t\t'Accept Both'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tstate.withInput1(!both).withInput2(!both),\n\t\t\t\t\t\t\t\t\tboth\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ enabled: baseRange.canBeCombined }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tnew Separator(),\n\t\t\t\t\t\tbaseRange.isConflicting\n\t\t\t\t\t\t\t? setFields(\n\t\t\t\t\t\t\t\taction(\n\t\t\t\t\t\t\t\t\t'mergeEditor.swap',\n\t\t\t\t\t\t\t\t\tlocalize('mergeEditor.swap', 'Swap'),\n\t\t\t\t\t\t\t\t\tstate.swap(),\n\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ enabled: !state.isEmpty && (!both || baseRange.isOrderRelevant) }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\n\t\t\t\t\t\tsetFields(\n\t\t\t\t\t\t\tnew Action(\n\t\t\t\t\t\t\t\t'mergeEditor.markAsHandled',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.markAsHandled', 'Mark as Handled'),\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\ttransaction((tx) => {\n\t\t\t\t\t\t\t\t\t\t/** @description Context Menu: Mark as handled */\n\t\t\t\t\t\t\t\t\t\tmodel.setHandled(baseRange, !handled, tx);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{ checked: handled }\n\t\t\t\t\t\t),\n\t\t\t\t\t].filter(isDefined);\n\t\t\t\t}\n\t\t\t}));\n\t});\n\n\tconstructor(\n\t\tpublic readonly inputNumber: 1 | 2,\n\t\ttitleMenuId: MenuId,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@IMenuService menuService: IMenuService,\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper(instantiationService);\n\n\t\tthis._register(applyObservableDecorations(this.editor, this.decorations));\n\n\t\tthis._register(\n\t\t\tnew EditorGutter(this.editor, this.htmlElements.gutterDiv, {\n\t\t\t\tgetIntersectingGutterItems: (range, reader) => {\n\t\t\t\t\treturn this.modifiedBaseRangeGutterItemInfos.read(reader);\n\t\t\t\t},\n\t\t\t\tcreateView: (item, target) => new MergeConflictGutterItemView(item, target, contextMenuService, themeService),\n\t\t\t})\n\t\t);\n\n\t\t// title menu\n\t\tconst titleMenu = menuService.createMenu(titleMenuId, contextKeyService);\n\t\tconst toolBar = new ToolBar(this.htmlElements.toolbar, contextMenuService);\n\t\tconst toolBarUpdate = () => {\n\t\t\tconst secondary: IAction[] = [];\n\t\t\tcreateAndFillInActionBarActions(titleMenu, { renderShortTitle: true }, secondary);\n\t\t\ttoolBar.setActions([], secondary);\n\t\t};\n\t\tthis._store.add(toolBar);\n\t\tthis._store.add(titleMenu);\n\t\tthis._store.add(titleMenu.onDidChange(toolBarUpdate));\n\t\ttoolBarUpdate();\n\t}\n\n\tprotected override getEditorContributions(): IEditorContributionDescription[] | undefined {\n\t\treturn EditorExtensionsRegistry.getEditorContributions().filter(c => c.id !== CodeLensContribution.ID);\n\t}\n}",
"input1": "\nexport class InputCodeEditorView extends CodeEditorView {\n\tconstructor(\n\t\tpublic readonly inputNumber: 1 | 2,\n\t\ttitleMenuId: MenuId,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@IMenuService menuService: IMenuService,\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper(instantiationService);\n\n\t\tthis._register(applyObservableDecorations(this.editor, this.decorations));\n\n\t\tthis._register(\n\t\t\tnew EditorGutter(this.editor, this.htmlElements.gutterDiv, {\n\t\t\t\tgetIntersectingGutterItems: (range, reader) => {\n\t\t\t\t\treturn this.modifiedBaseRangeGutterItemInfos.read(reader);\n\t\t\t\t},\n\t\t\t\tcreateView: (item, target) => new MergeConflictGutterItemView(item, target, contextMenuService, themeService),\n\t\t\t})\n\t\t);\n\n\t\tthis._register(\n\t\t\tcreateSelectionsAutorun(this, (baseRange, viewModel) =>\n\t\t\t\tviewModel.model.translateBaseRangeToInput(this.inputNumber, baseRange)\n\t\t\t)\n\t\t);\n\n\t\t// title menu\n\t\tconst titleMenu = menuService.createMenu(titleMenuId, contextKeyService);\n\t\tconst toolBar = new ToolBar(this.htmlElements.toolbar, contextMenuService);\n\t\tconst toolBarUpdate = () => {\n\t\t\tconst secondary: IAction[] = [];\n\t\t\tcreateAndFillInActionBarActions(titleMenu, { renderShortTitle: true }, secondary);\n\t\t\ttoolBar.setActions([], secondary);\n\t\t};\n\t\tthis._store.add(toolBar);\n\t\tthis._store.add(titleMenu);\n\t\tthis._store.add(titleMenu.onDidChange(toolBarUpdate));\n\t\ttoolBarUpdate();\n\t}\n\n\tprivate readonly modifiedBaseRangeGutterItemInfos = derived(`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`, reader => {\n\t\tconst viewModel = this.viewModel.read(reader);\n\t\tif (!viewModel) { return []; }\n\t\tconst model = viewModel.model;\n\t\tconst inputNumber = this.inputNumber;\n\n\t\treturn model.modifiedBaseRanges.read(reader)\n\t\t\t.filter((r) => r.getInputDiffs(this.inputNumber).length > 0)\n\t\t\t.map<ModifiedBaseRangeGutterItemInfo>((baseRange, idx) => ({\n\t\t\t\tid: idx.toString(),\n\t\t\t\trange: baseRange.getInputRange(this.inputNumber),\n\t\t\t\tenabled: model.isUpToDate,\n\t\t\t\ttoggleState: derived('checkbox is checked', (reader) => {\n\t\t\t\t\tconst input = model\n\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t.read(reader)\n\t\t\t\t\t\t.getInput(this.inputNumber);\n\t\t\t\t\treturn input === InputState.second && !baseRange.isOrderRelevant\n\t\t\t\t\t\t? InputState.first\n\t\t\t\t\t\t: input;\n\t\t\t\t}\n\t\t\t\t),\n\t\t\t\tclassName: derived('checkbox classnames', (reader) => {\n\t\t\t\t\tconst classNames = [];\n\t\t\t\t\tconst active = viewModel.activeModifiedBaseRange.read(reader);\n\t\t\t\t\tif (!model.hasBaseRange(baseRange)) {\n\t\t\t\t\t\treturn ''; // Invalid state, should only be observed temporarily\n\t\t\t\t\t}\n\t\t\t\t\tconst isHandled = model.isHandled(baseRange).read(reader);\n\t\t\t\t\tif (isHandled) {\n\t\t\t\t\t\tclassNames.push('handled');\n\t\t\t\t\t}\n\t\t\t\t\tif (baseRange === active) {\n\t\t\t\t\t\tclassNames.push('focused');\n\t\t\t\t\t}\n\t\t\t\t\treturn classNames.join(' ');\n\t\t\t\t}),\n\t\t\t\tsetState: (value, tx) => viewModel.setState(\n\t\t\t\t\tbaseRange,\n\t\t\t\t\tmodel\n\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t.get()\n\t\t\t\t\t\t.withInputValue(this.inputNumber, value),\n\t\t\t\t\ttx\n\t\t\t\t),\n\t\t\t\ttoggleBothSides() {\n\t\t\t\t\ttransaction(tx => {\n\t\t\t\t\t\t/** @description Context Menu: toggle both sides */\n\t\t\t\t\t\tconst state = model\n\t\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t\t.get();\n\t\t\t\t\t\tmodel.setState(\n\t\t\t\t\t\t\tbaseRange,\n\t\t\t\t\t\t\tstate\n\t\t\t\t\t\t\t\t.toggle(inputNumber)\n\t\t\t\t\t\t\t\t.toggle(inputNumber === 1 ? 2 : 1),\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\ttx\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tgetContextMenuActions: () => {\n\t\t\t\t\tconst state = model.getState(baseRange).get();\n\t\t\t\t\tconst handled = model.isHandled(baseRange).get();\n\n\t\t\t\t\tconst update = (newState: ModifiedBaseRangeState) => {\n\t\t\t\t\t\ttransaction(tx => {\n\t\t\t\t\t\t\t/** @description Context Menu: Update Base Range State */\n\t\t\t\t\t\t\treturn viewModel.setState(baseRange, newState, tx);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tfunction action(id: string, label: string, targetState: ModifiedBaseRangeState, checked: boolean) {\n\t\t\t\t\t\tconst action = new Action(id, label, undefined, true, () => {\n\t\t\t\t\t\t\tupdate(targetState);\n\t\t\t\t\t\t});\n\t\t\t\t\t\taction.checked = checked;\n\t\t\t\t\t\treturn action;\n\t\t\t\t\t}\n\t\t\t\t\tconst both = state.input1 && state.input2;\n\n\t\t\t\t\treturn [\n\t\t\t\t\t\tbaseRange.input1Diffs.length > 0\n\t\t\t\t\t\t\t? action(\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput1',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input1.title),\n\t\t\t\t\t\t\t\tstate.toggle(1),\n\t\t\t\t\t\t\t\tstate.input1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tbaseRange.input2Diffs.length > 0\n\t\t\t\t\t\t\t? action(\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput2',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input2.title),\n\t\t\t\t\t\t\t\tstate.toggle(2),\n\t\t\t\t\t\t\t\tstate.input2\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tbaseRange.isConflicting\n\t\t\t\t\t\t\t? setFields(\n\t\t\t\t\t\t\t\taction(\n\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\n\t\t\t\t\t\t\t\t\tlocalize(\n\t\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\n\t\t\t\t\t\t\t\t\t\t'Accept Both'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tstate.withInput1(!both).withInput2(!both),\n\t\t\t\t\t\t\t\t\tboth\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ enabled: baseRange.canBeCombined }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tnew Separator(),\n\t\t\t\t\t\tbaseRange.isConflicting\n\t\t\t\t\t\t\t? setFields(\n\t\t\t\t\t\t\t\taction(\n\t\t\t\t\t\t\t\t\t'mergeEditor.swap',\n\t\t\t\t\t\t\t\t\tlocalize('mergeEditor.swap', 'Swap'),\n\t\t\t\t\t\t\t\t\tstate.swap(),\n\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ enabled: !state.isEmpty && (!both || baseRange.isOrderRelevant) }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\n\t\t\t\t\t\tsetFields(\n\t\t\t\t\t\t\tnew Action(\n\t\t\t\t\t\t\t\t'mergeEditor.markAsHandled',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.markAsHandled', 'Mark as Handled'),\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\ttransaction((tx) => {\n\t\t\t\t\t\t\t\t\t\t/** @description Context Menu: Mark as handled */\n\t\t\t\t\t\t\t\t\t\tmodel.setHandled(baseRange, !handled, tx);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{ checked: handled }\n\t\t\t\t\t\t),\n\t\t\t\t\t].filter(isDefined);\n\t\t\t\t}\n\t\t\t}));\n\t});\n\n\tprivate readonly decorations = derived(`input${this.inputNumber}.decorations`, reader => {\n\t\tconst viewModel = this.viewModel.read(reader);\n\t\tif (!viewModel) {\n\t\t\treturn [];\n\t\t}\n\t\tconst model = viewModel.model;\n\n\t\tconst activeModifiedBaseRange = viewModel.activeModifiedBaseRange.read(reader);\n\n\t\tconst result = new Array<IModelDeltaDecoration>();\n\n\t\tfor (const modifiedBaseRange of model.modifiedBaseRanges.read(reader)) {\n\n\t\t\tconst range = modifiedBaseRange.getInputRange(this.inputNumber);\n\t\t\tif (range && !range.isEmpty) {\n\t\t\t\tconst blockClassNames = ['merge-editor-block'];\n\t\t\t\tconst isHandled = model.isHandled(modifiedBaseRange).read(reader);\n\t\t\t\tif (isHandled) {\n\t\t\t\t\tblockClassNames.push('handled');\n\t\t\t\t}\n\t\t\t\tif (modifiedBaseRange === activeModifiedBaseRange) {\n\t\t\t\t\tblockClassNames.push('focused');\n\t\t\t\t}\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\n\t\t\t\t\tblockClassNames.push('conflicting');\n\t\t\t\t}\n\t\t\t\tconst inputClassName = this.inputNumber === 1 ? 'input1' : 'input2';\n\t\t\t\tblockClassNames.push(inputClassName);\n\n\t\t\t\tresult.push({\n\t\t\t\t\trange: range.toInclusiveRange()!,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tisWholeLine: true,\n\t\t\t\t\t\tblockClassName: blockClassNames.join(' '),\n\t\t\t\t\t\tdescription: 'Merge Editor',\n\t\t\t\t\t\tminimap: {\n\t\t\t\t\t\t\tposition: MinimapPosition.Gutter,\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\n\t\t\t\t\t\t},\n\t\t\t\t\t\toverviewRuler: modifiedBaseRange.isConflicting ? {\n\t\t\t\t\t\t\tposition: OverviewRulerLane.Center,\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\n\t\t\t\t\t\t} : undefined\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (modifiedBaseRange.isConflicting || !model.isHandled(modifiedBaseRange).read(reader)) {\n\t\t\t\t\tconst inputDiffs = modifiedBaseRange.getInputDiffs(this.inputNumber);\n\t\t\t\t\tfor (const diff of inputDiffs) {\n\t\t\t\t\t\tconst range = diff.outputRange.toInclusiveRange();\n\t\t\t\t\t\tif (range) {\n\t\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\t\trange,\n\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff ${inputClassName}`,\n\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor',\n\t\t\t\t\t\t\t\t\tisWholeLine: true,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (diff.rangeMappings) {\n\t\t\t\t\t\t\tfor (const d of diff.rangeMappings) {\n\t\t\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\t\t\trange: d.outputRange,\n\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff-word ${inputClassName}`,\n\t\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t});\n\n\tprotected override getEditorContributions(): IEditorContributionDescription[] | undefined {\n\t\treturn EditorExtensionsRegistry.getEditorContributions().filter(c => c.id !== CodeLensContribution.ID);\n\t}\n}",
"input2": "\nexport class InputCodeEditorView extends CodeEditorView {\n\tprivate readonly decorations = derived(`input${this.inputNumber}.decorations`, reader => {\n\t\tconst viewModel = this.viewModel.read(reader);\n\t\tif (!viewModel) {\n\t\t\treturn [];\n\t\t}\n\t\tconst model = viewModel.model;\n\n\t\tconst activeModifiedBaseRange = viewModel.activeModifiedBaseRange.read(reader);\n\n\t\tconst result = new Array<IModelDeltaDecoration>();\n\t\tfor (const modifiedBaseRange of model.modifiedBaseRanges.read(reader)) {\n\n\t\t\tconst range = modifiedBaseRange.getInputRange(this.inputNumber);\n\t\t\tif (range && !range.isEmpty) {\n\t\t\t\tconst blockClassNames = ['merge-editor-block'];\n\t\t\t\tconst isHandled = model.isHandled(modifiedBaseRange).read(reader);\n\t\t\t\tif (isHandled) {\n\t\t\t\t\tblockClassNames.push('handled');\n\t\t\t\t}\n\t\t\t\tif (modifiedBaseRange === activeModifiedBaseRange) {\n\t\t\t\t\tblockClassNames.push('focused');\n\t\t\t\t}\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\n\t\t\t\t\tblockClassNames.push('conflicting');\n\t\t\t\t}\n\t\t\t\tconst inputClassName = this.inputNumber === 1 ? 'input1' : 'input2';\n\t\t\t\tblockClassNames.push(inputClassName);\n\n\t\t\t\tresult.push({\n\t\t\t\t\trange: range.toInclusiveRange()!,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tisWholeLine: true,\n\t\t\t\t\t\tblockClassName: blockClassNames.join(' '),\n\t\t\t\t\t\tdescription: 'Merge Editor',\n\t\t\t\t\t\tminimap: {\n\t\t\t\t\t\t\tposition: MinimapPosition.Gutter,\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\n\t\t\t\t\t\t},\n\t\t\t\t\t\toverviewRuler: modifiedBaseRange.isConflicting ? {\n\t\t\t\t\t\t\tposition: OverviewRulerLane.Center,\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\n\t\t\t\t\t\t} : undefined\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\n\t\t\t\t\tconst inputDiffs = modifiedBaseRange.getInputDiffs(this.inputNumber);\n\t\t\t\t\tfor (const diff of inputDiffs) {\n\t\t\t\t\t\tconst range = diff.outputRange.toInclusiveRange();\n\t\t\t\t\t\tif (range) {\n\t\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\t\trange,\n\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff ${inputClassName}`,\n\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor',\n\t\t\t\t\t\t\t\t\tisWholeLine: true,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (diff.rangeMappings) {\n\t\t\t\t\t\t\tfor (const d of diff.rangeMappings) {\n\t\t\t\t\t\t\t\tresult.push({\n\t\t\t\t\t\t\t\t\trange: d.outputRange,\n\t\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff-word ${inputClassName}`,\n\t\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor'\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn result;\n\t});\n\n\tprivate readonly modifiedBaseRangeGutterItemInfos = derived(`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`, reader => {\n\t\tconst viewModel = this.viewModel.read(reader);\n\t\tif (!viewModel) { return []; }\n\t\tconst model = viewModel.model;\n\t\tconst inputNumber = this.inputNumber;\n\n\t\treturn model.modifiedBaseRanges.read(reader)\n\t\t\t.filter((r) => r.getInputDiffs(this.inputNumber).length > 0)\n\t\t\t.map<ModifiedBaseRangeGutterItemInfo>((baseRange, idx) => ({\n\t\t\t\tid: idx.toString(),\n\t\t\t\trange: baseRange.getInputRange(this.inputNumber),\n\t\t\t\tenabled: model.isUpToDate,\n\t\t\t\ttoggleState: derived('checkbox is checked', (reader) => {\n\t\t\t\t\tconst input = model\n\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t.read(reader)\n\t\t\t\t\t\t.getInput(this.inputNumber);\n\t\t\t\t\treturn input === InputState.second && !baseRange.isOrderRelevant\n\t\t\t\t\t\t? InputState.first\n\t\t\t\t\t\t: input;\n\t\t\t\t}\n\t\t\t\t),\n\t\t\t\tclassName: derived('checkbox classnames', (reader) => {\n\t\t\t\t\tconst classNames = [];\n\t\t\t\t\tconst active = viewModel.activeModifiedBaseRange.read(reader);\n\t\t\t\t\tif (!model.has(baseRange)) {\n\t\t\t\t\t\treturn ''; // Invalid state, should only be observed temporarily\n\t\t\t\t\t}\n\t\t\t\t\tconst isHandled = model.isHandled(baseRange).read(reader);\n\t\t\t\t\tif (isHandled) {\n\t\t\t\t\t\tclassNames.push('handled');\n\t\t\t\t\t}\n\t\t\t\t\tif (baseRange === active) {\n\t\t\t\t\t\tclassNames.push('focused');\n\t\t\t\t\t}\n\t\t\t\t\treturn classNames.join(' ');\n\t\t\t\t}),\n\t\t\t\tsetState: (value, tx) => viewModel.setState(\n\t\t\t\t\tbaseRange,\n\t\t\t\t\tmodel\n\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t.get()\n\t\t\t\t\t\t.withInputValue(this.inputNumber, value),\n\t\t\t\t\ttx\n\t\t\t\t),\n\t\t\t\ttoggleBothSides() {\n\t\t\t\t\ttransaction(tx => {\n\t\t\t\t\t\t/** @description Context Menu: toggle both sides */\n\t\t\t\t\t\tconst state = model\n\t\t\t\t\t\t\t.getState(baseRange)\n\t\t\t\t\t\t\t.get();\n\t\t\t\t\t\tmodel.setState(\n\t\t\t\t\t\t\tbaseRange,\n\t\t\t\t\t\t\tstate\n\t\t\t\t\t\t\t\t.toggle(inputNumber)\n\t\t\t\t\t\t\t\t.toggle(inputNumber === 1 ? 2 : 1),\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\ttx\n\t\t\t\t\t\t);\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t\tgetContextMenuActions: () => {\n\t\t\t\t\tconst state = model.getState(baseRange).get();\n\t\t\t\t\tconst handled = model.isHandled(baseRange).get();\n\n\t\t\t\t\tconst update = (newState: ModifiedBaseRangeState) => {\n\t\t\t\t\t\ttransaction(tx => {\n\t\t\t\t\t\t\t/** @description Context Menu: Update Base Range State */\n\t\t\t\t\t\t\treturn viewModel.setState(baseRange, newState, tx);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tfunction action(id: string, label: string, targetState: ModifiedBaseRangeState, checked: boolean) {\n\t\t\t\t\t\tconst action = new Action(id, label, undefined, true, () => {\n\t\t\t\t\t\t\tupdate(targetState);\n\t\t\t\t\t\t});\n\t\t\t\t\t\taction.checked = checked;\n\t\t\t\t\t\treturn action;\n\t\t\t\t\t}\n\t\t\t\t\tconst both = state.input1 && state.input2;\n\n\t\t\t\t\treturn [\n\t\t\t\t\t\tbaseRange.input1Diffs.length > 0\n\t\t\t\t\t\t\t? action(\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput1',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input1.title),\n\t\t\t\t\t\t\t\tstate.toggle(1),\n\t\t\t\t\t\t\t\tstate.input1\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tbaseRange.input2Diffs.length > 0\n\t\t\t\t\t\t\t? action(\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput2',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input2.title),\n\t\t\t\t\t\t\t\tstate.toggle(2),\n\t\t\t\t\t\t\t\tstate.input2\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tbaseRange.isConflicting\n\t\t\t\t\t\t\t? setFields(\n\t\t\t\t\t\t\t\taction(\n\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\n\t\t\t\t\t\t\t\t\tlocalize(\n\t\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\n\t\t\t\t\t\t\t\t\t\t'Accept Both'\n\t\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t\tstate.withInput1(!both).withInput2(!both),\n\t\t\t\t\t\t\t\t\tboth\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ enabled: baseRange.canBeCombined }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t\tnew Separator(),\n\t\t\t\t\t\tbaseRange.isConflicting\n\t\t\t\t\t\t\t? setFields(\n\t\t\t\t\t\t\t\taction(\n\t\t\t\t\t\t\t\t\t'mergeEditor.swap',\n\t\t\t\t\t\t\t\t\tlocalize('mergeEditor.swap', 'Swap'),\n\t\t\t\t\t\t\t\t\tstate.swap(),\n\t\t\t\t\t\t\t\t\tfalse\n\t\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t\t{ enabled: !state.isEmpty && (!both || baseRange.isOrderRelevant) }\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t: undefined,\n\n\t\t\t\t\t\tsetFields(\n\t\t\t\t\t\t\tnew Action(\n\t\t\t\t\t\t\t\t'mergeEditor.markAsHandled',\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.markAsHandled', 'Mark as Handled'),\n\t\t\t\t\t\t\t\tundefined,\n\t\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t\t\t() => {\n\t\t\t\t\t\t\t\t\ttransaction((tx) => {\n\t\t\t\t\t\t\t\t\t\t/** @description Context Menu: Mark as handled */\n\t\t\t\t\t\t\t\t\t\tmodel.setHandled(baseRange, !handled, tx);\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t\t{ checked: handled }\n\t\t\t\t\t\t),\n\t\t\t\t\t].filter(isDefined);\n\t\t\t\t}\n\t\t\t}));\n\t});\n\n\tconstructor(\n\t\tpublic readonly inputNumber: 1 | 2,\n\t\t@IInstantiationService instantiationService: IInstantiationService,\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\n\t\t@IThemeService themeService: IThemeService,\n\t\t@IMenuService menuService: IMenuService,\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\n\t) {\n\t\tsuper(instantiationService);\n\n\t\tthis._register(applyObservableDecorations(this.editor, this.decorations));\n\n\t\tthis._register(\n\t\t\tnew EditorGutter(this.editor, this.htmlElements.gutterDiv, {\n\t\t\t\tgetIntersectingGutterItems: (range, reader) => {\n\t\t\t\t\treturn this.modifiedBaseRangeGutterItemInfos.read(reader);\n\t\t\t\t},\n\t\t\t\tcreateView: (item, target) => new MergeConflictGutterItemView(item, target, contextMenuService, themeService),\n\t\t\t})\n\t\t);\n\n\t\tthis._register(\n\t\t\tinstantiationService.createInstance(\n\t\t\t\tTitleMenu,\n\t\t\t\tinputNumber === 1 ? MenuId.MergeInput1Toolbar : MenuId.MergeInput2Toolbar,\n\t\t\t\tthis.htmlElements.title\n\t\t\t)\n\t\t);\n\t}\n\n\tprotected override getEditorContributions(): IEditorContributionDescription[] | undefined {\n\t\treturn EditorExtensionsRegistry.getEditorContributions().filter(c => c.id !== CodeLensContribution.ID);\n\t}\n}",
"result": "\r\nexport class InputCodeEditorView extends CodeEditorView {\r\n\tconstructor(\r\n\t\tpublic readonly inputNumber: 1 | 2,\r\n\t\ttitleMenuId: MenuId,\r\n\t\t@IInstantiationService instantiationService: IInstantiationService,\r\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\r\n\t\t@IThemeService themeService: IThemeService,\r\n\t\t@IMenuService menuService: IMenuService,\r\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\r\n\t) {\r\n\t\tsuper(instantiationService);\r\n\r\n\t\tthis._register(applyObservableDecorations(this.editor, this.decorations));\r\n\r\n\t\tthis._register(\r\n\t\t\tnew EditorGutter(this.editor, this.htmlElements.gutterDiv, {\r\n\t\t\t\tgetIntersectingGutterItems: (range, reader) => {\r\n\t\t\t\t\treturn this.modifiedBaseRangeGutterItemInfos.read(reader);\r\n\t\t\t\t},\r\n\t\t\t\tcreateView: (item, target) => new MergeConflictGutterItemView(item, target, contextMenuService, themeService),\r\n\t\t\t})\r\n\t\t);\r\n\r\n\t\tthis._register(\r\n\t\t\tcreateSelectionsAutorun(this, (baseRange, viewModel) =>\r\n\t\t\t\tviewModel.model.translateBaseRangeToInput(this.inputNumber, baseRange)\r\n\t\t\t)\r\n\t\t);\r\n\r\n\t\t// title menu\r\n\t\tconst titleMenu = menuService.createMenu(titleMenuId, contextKeyService);\r\n\t\tconst toolBar = new ToolBar(this.htmlElements.toolbar, contextMenuService);\r\n\t\tconst toolBarUpdate = () => {\r\n\t\t\tconst secondary: IAction[] = [];\r\n\t\t\tcreateAndFillInActionBarActions(titleMenu, { renderShortTitle: true }, secondary);\r\n\t\t\ttoolBar.setActions([], secondary);\r\n\t\t};\r\n\t\tthis._store.add(toolBar);\r\n\t\tthis._store.add(titleMenu);\r\n\t\tthis._store.add(titleMenu.onDidChange(toolBarUpdate));\r\n\t\ttoolBarUpdate();\r\n\t}\r\n\r\n\tprivate readonly modifiedBaseRangeGutterItemInfos = derived(`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`, reader => {\r\n\t\tconst viewModel = this.viewModel.read(reader);\r\n\t\tif (!viewModel) { return []; }\r\n\t\tconst model = viewModel.model;\r\n\t\tconst inputNumber = this.inputNumber;\r\n\r\n\t\treturn model.modifiedBaseRanges.read(reader)\r\n\t\t\t.filter((r) => r.getInputDiffs(this.inputNumber).length > 0)\r\n\t\t\t.map<ModifiedBaseRangeGutterItemInfo>((baseRange, idx) => ({\r\n\t\t\t\tid: idx.toString(),\r\n\t\t\t\trange: baseRange.getInputRange(this.inputNumber),\r\n\t\t\t\tenabled: model.isUpToDate,\r\n\t\t\t\ttoggleState: derived('checkbox is checked', (reader) => {\r\n\t\t\t\t\tconst input = model\r\n\t\t\t\t\t\t.getState(baseRange)\r\n\t\t\t\t\t\t.read(reader)\r\n\t\t\t\t\t\t.getInput(this.inputNumber);\r\n\t\t\t\t\treturn input === InputState.second && !baseRange.isOrderRelevant\r\n\t\t\t\t\t\t? InputState.first\r\n\t\t\t\t\t\t: input;\r\n\t\t\t\t}\r\n\t\t\t\t),\r\n\t\t\t\tclassName: derived('checkbox classnames', (reader) => {\r\n\t\t\t\t\tconst classNames = [];\r\n\t\t\t\t\tconst active = viewModel.activeModifiedBaseRange.read(reader);\r\n\t\t\t\t\tif (!model.hasBaseRange(baseRange)) {\r\n\t\t\t\t\t\treturn ''; // Invalid state, should only be observed temporarily\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst isHandled = model.isHandled(baseRange).read(reader);\r\n\t\t\t\t\tif (isHandled) {\r\n\t\t\t\t\t\tclassNames.push('handled');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (baseRange === active) {\r\n\t\t\t\t\t\tclassNames.push('focused');\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn classNames.join(' ');\r\n\t\t\t\t}),\r\n\t\t\t\tsetState: (value, tx) => viewModel.setState(\r\n\t\t\t\t\tbaseRange,\r\n\t\t\t\t\tmodel\r\n\t\t\t\t\t\t.getState(baseRange)\r\n\t\t\t\t\t\t.get()\r\n\t\t\t\t\t\t.withInputValue(this.inputNumber, value),\r\n\t\t\t\t\ttx\r\n\t\t\t\t),\r\n\t\t\t\ttoggleBothSides() {\r\n\t\t\t\t\ttransaction(tx => {\r\n\t\t\t\t\t\t/** @description Context Menu: toggle both sides */\r\n\t\t\t\t\t\tconst state = model\r\n\t\t\t\t\t\t\t.getState(baseRange)\r\n\t\t\t\t\t\t\t.get();\r\n\t\t\t\t\t\tmodel.setState(\r\n\t\t\t\t\t\t\tbaseRange,\r\n\t\t\t\t\t\t\tstate\r\n\t\t\t\t\t\t\t\t.toggle(inputNumber)\r\n\t\t\t\t\t\t\t\t.toggle(inputNumber === 1 ? 2 : 1),\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttx\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tgetContextMenuActions: () => {\r\n\t\t\t\t\tconst state = model.getState(baseRange).get();\r\n\t\t\t\t\tconst handled = model.isHandled(baseRange).get();\r\n\r\n\t\t\t\t\tconst update = (newState: ModifiedBaseRangeState) => {\r\n\t\t\t\t\t\ttransaction(tx => {\r\n\t\t\t\t\t\t\t/** @description Context Menu: Update Base Range State */\r\n\t\t\t\t\t\t\treturn viewModel.setState(baseRange, newState, tx);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tfunction action(id: string, label: string, targetState: ModifiedBaseRangeState, checked: boolean) {\r\n\t\t\t\t\t\tconst action = new Action(id, label, undefined, true, () => {\r\n\t\t\t\t\t\t\tupdate(targetState);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\taction.checked = checked;\r\n\t\t\t\t\t\treturn action;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst both = state.input1 && state.input2;\r\n\r\n\t\t\t\t\treturn [\r\n\t\t\t\t\t\tbaseRange.input1Diffs.length > 0\r\n\t\t\t\t\t\t\t? action(\r\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput1',\r\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input1.title),\r\n\t\t\t\t\t\t\t\tstate.toggle(1),\r\n\t\t\t\t\t\t\t\tstate.input1\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\t\t\t\t\t\tbaseRange.input2Diffs.length > 0\r\n\t\t\t\t\t\t\t? action(\r\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput2',\r\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input2.title),\r\n\t\t\t\t\t\t\t\tstate.toggle(2),\r\n\t\t\t\t\t\t\t\tstate.input2\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\t\t\t\t\t\tbaseRange.isConflicting\r\n\t\t\t\t\t\t\t? setFields(\r\n\t\t\t\t\t\t\t\taction(\r\n\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\r\n\t\t\t\t\t\t\t\t\tlocalize(\r\n\t\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\r\n\t\t\t\t\t\t\t\t\t\t'Accept Both'\r\n\t\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t\tstate.withInput1(!both).withInput2(!both),\r\n\t\t\t\t\t\t\t\t\tboth\r\n\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t{ enabled: baseRange.canBeCombined }\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\t\t\t\t\t\tnew Separator(),\r\n\t\t\t\t\t\tbaseRange.isConflicting\r\n\t\t\t\t\t\t\t? setFields(\r\n\t\t\t\t\t\t\t\taction(\r\n\t\t\t\t\t\t\t\t\t'mergeEditor.swap',\r\n\t\t\t\t\t\t\t\t\tlocalize('mergeEditor.swap', 'Swap'),\r\n\t\t\t\t\t\t\t\t\tstate.swap(),\r\n\t\t\t\t\t\t\t\t\tfalse\r\n\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t{ enabled: !state.isEmpty && (!both || baseRange.isOrderRelevant) }\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\r\n\t\t\t\t\t\tsetFields(\r\n\t\t\t\t\t\t\tnew Action(\r\n\t\t\t\t\t\t\t\t'mergeEditor.markAsHandled',\r\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.markAsHandled', 'Mark as Handled'),\r\n\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\ttransaction((tx) => {\r\n\t\t\t\t\t\t\t\t\t\t/** @description Context Menu: Mark as handled */\r\n\t\t\t\t\t\t\t\t\t\tmodel.setHandled(baseRange, !handled, tx);\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t{ checked: handled }\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t].filter(isDefined);\r\n\t\t\t\t}\r\n\t\t\t}));\r\n\t});\r\n\r\n\tconstructor(\r\n\t\tpublic readonly inputNumber: 1 | 2,\r\n\t\ttitleMenuId: MenuId,\r\n\t\t@IInstantiationService instantiationService: IInstantiationService,\r\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\r\n\t\t@IThemeService themeService: IThemeService,\r\n\t\t@IMenuService menuService: IMenuService,\r\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\r\n\t) {\r\n\t\tsuper(instantiationService);\r\n\r\n\t\tconst activeModifiedBaseRange = viewModel.activeModifiedBaseRange.read(reader);\r\n\r\n\t\tconst result = new Array<IModelDeltaDecoration>();\r\n\r\n\t\tfor (const modifiedBaseRange of model.modifiedBaseRanges.read(reader)) {\r\n\r\n\t\t\tconst range = modifiedBaseRange.getInputRange(this.inputNumber);\r\n\t\t\tif (range && !range.isEmpty) {\r\n\t\t\t\tconst blockClassNames = ['merge-editor-block'];\r\n\t\t\t\tconst isHandled = model.isHandled(modifiedBaseRange).read(reader);\r\n\t\t\t\tif (isHandled) {\r\n\t\t\t\t\tblockClassNames.push('handled');\r\n\t\t\t\t}\r\n\t\t\t\tif (modifiedBaseRange === activeModifiedBaseRange) {\r\n\t\t\t\t\tblockClassNames.push('focused');\r\n\t\t\t\t}\r\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\r\n\t\t\t\t\tblockClassNames.push('conflicting');\r\n\t\t\t\t}\r\n\t\t\t\tconst inputClassName = this.inputNumber === 1 ? 'input1' : 'input2';\r\n\t\t\t\tblockClassNames.push(inputClassName);\r\n\r\n\t\t\t\tresult.push({\r\n\t\t\t\t\trange: range.toInclusiveRange()!,\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\tisWholeLine: true,\r\n\t\t\t\t\t\tblockClassName: blockClassNames.join(' '),\r\n\t\t\t\t\t\tdescription: 'Merge Editor',\r\n\t\t\t\t\t\tminimap: {\r\n\t\t\t\t\t\t\tposition: MinimapPosition.Gutter,\r\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\toverviewRuler: modifiedBaseRange.isConflicting ? {\r\n\t\t\t\t\t\t\tposition: OverviewRulerLane.Center,\r\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\r\n\t\t\t\t\t\t} : undefined\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t// title menu\r\n\t\tconst titleMenu = menuService.createMenu(titleMenuId, contextKeyService);\r\n\t\tconst toolBar = new ToolBar(this.htmlElements.toolbar, contextMenuService);\r\n\t\tconst toolBarUpdate = () => {\r\n\t\t\tconst secondary: IAction[] = [];\r\n\t\t\tcreateAndFillInActionBarActions(titleMenu, { renderShortTitle: true }, secondary);\r\n\t\t\ttoolBar.setActions([], secondary);\r\n\t\t};\r\n\t\tthis._store.add(toolBar);\r\n\t\tthis._store.add(titleMenu);\r\n\t\tthis._store.add(titleMenu.onDidChange(toolBarUpdate));\r\n\t\ttoolBarUpdate();\r\n\t}\r\n\r\n\t\t\t\t\t\tif (diff.rangeMappings) {\r\n\t\t\t\t\t\t\tfor (const d of diff.rangeMappings) {\r\n\t\t\t\t\t\t\t\tresult.push({\r\n\t\t\t\t\t\t\t\t\trange: d.outputRange,\r\n\t\t\t\t\t\t\t\t\toptions: {\r\n\t\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff-word ${inputClassName}`,\r\n\t\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor'\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n\r\n\tprotected override getEditorContributions(): IEditorContributionDescription[] | undefined {\r\n\t\treturn EditorExtensionsRegistry.getEditorContributions().filter(c => c.id !== CodeLensContribution.ID);\r\n\t}\r\n}",
"initialResult": "\r\nexport class InputCodeEditorView extends CodeEditorView {\r\n\tconstructor(\r\n\t\tpublic readonly inputNumber: 1 | 2,\r\n\t\ttitleMenuId: MenuId,\r\n\t\t@IInstantiationService instantiationService: IInstantiationService,\r\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\r\n\t\t@IThemeService themeService: IThemeService,\r\n\t\t@IMenuService menuService: IMenuService,\r\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\r\n\t) {\r\n\t\tsuper(instantiationService);\r\n\r\n\t\tthis._register(applyObservableDecorations(this.editor, this.decorations));\r\n\r\n\t\tthis._register(\r\n\t\t\tnew EditorGutter(this.editor, this.htmlElements.gutterDiv, {\r\n\t\t\t\tgetIntersectingGutterItems: (range, reader) => {\r\n\t\t\t\t\treturn this.modifiedBaseRangeGutterItemInfos.read(reader);\r\n\t\t\t\t},\r\n\t\t\t\tcreateView: (item, target) => new MergeConflictGutterItemView(item, target, contextMenuService, themeService),\r\n\t\t\t})\r\n\t\t);\r\n\r\n\t\tthis._register(\r\n\t\t\tcreateSelectionsAutorun(this, (baseRange, viewModel) =>\r\n\t\t\t\tviewModel.model.translateBaseRangeToInput(this.inputNumber, baseRange)\r\n\t\t\t)\r\n\t\t);\r\n\r\n\t\t// title menu\r\n\t\tconst titleMenu = menuService.createMenu(titleMenuId, contextKeyService);\r\n\t\tconst toolBar = new ToolBar(this.htmlElements.toolbar, contextMenuService);\r\n\t\tconst toolBarUpdate = () => {\r\n\t\t\tconst secondary: IAction[] = [];\r\n\t\t\tcreateAndFillInActionBarActions(titleMenu, { renderShortTitle: true }, secondary);\r\n\t\t\ttoolBar.setActions([], secondary);\r\n\t\t};\r\n\t\tthis._store.add(toolBar);\r\n\t\tthis._store.add(titleMenu);\r\n\t\tthis._store.add(titleMenu.onDidChange(toolBarUpdate));\r\n\t\ttoolBarUpdate();\r\n\t}\r\n\r\n\tprivate readonly modifiedBaseRangeGutterItemInfos = derived(`input${this.inputNumber}.modifiedBaseRangeGutterItemInfos`, reader => {\r\n\t\tconst viewModel = this.viewModel.read(reader);\r\n\t\tif (!viewModel) { return []; }\r\n\t\tconst model = viewModel.model;\r\n\t\tconst inputNumber = this.inputNumber;\r\n\r\n\t\treturn model.modifiedBaseRanges.read(reader)\r\n\t\t\t.filter((r) => r.getInputDiffs(this.inputNumber).length > 0)\r\n\t\t\t.map<ModifiedBaseRangeGutterItemInfo>((baseRange, idx) => ({\r\n\t\t\t\tid: idx.toString(),\r\n\t\t\t\trange: baseRange.getInputRange(this.inputNumber),\r\n\t\t\t\tenabled: model.isUpToDate,\r\n\t\t\t\ttoggleState: derived('checkbox is checked', (reader) => {\r\n\t\t\t\t\tconst input = model\r\n\t\t\t\t\t\t.getState(baseRange)\r\n\t\t\t\t\t\t.read(reader)\r\n\t\t\t\t\t\t.getInput(this.inputNumber);\r\n\t\t\t\t\treturn input === InputState.second && !baseRange.isOrderRelevant\r\n\t\t\t\t\t\t? InputState.first\r\n\t\t\t\t\t\t: input;\r\n\t\t\t\t}\r\n\t\t\t\t),\r\n\t\t\t\tclassName: derived('checkbox classnames', (reader) => {\r\n\t\t\t\t\tconst classNames = [];\r\n\t\t\t\t\tconst active = viewModel.activeModifiedBaseRange.read(reader);\r\n\t\t\t\t\tif (!model.hasBaseRange(baseRange)) {\r\n\t\t\t\t\t\treturn ''; // Invalid state, should only be observed temporarily\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst isHandled = model.isHandled(baseRange).read(reader);\r\n\t\t\t\t\tif (isHandled) {\r\n\t\t\t\t\t\tclassNames.push('handled');\r\n\t\t\t\t\t}\r\n\t\t\t\t\tif (baseRange === active) {\r\n\t\t\t\t\t\tclassNames.push('focused');\r\n\t\t\t\t\t}\r\n\t\t\t\t\treturn classNames.join(' ');\r\n\t\t\t\t}),\r\n\t\t\t\tsetState: (value, tx) => viewModel.setState(\r\n\t\t\t\t\tbaseRange,\r\n\t\t\t\t\tmodel\r\n\t\t\t\t\t\t.getState(baseRange)\r\n\t\t\t\t\t\t.get()\r\n\t\t\t\t\t\t.withInputValue(this.inputNumber, value),\r\n\t\t\t\t\ttx\r\n\t\t\t\t),\r\n\t\t\t\ttoggleBothSides() {\r\n\t\t\t\t\ttransaction(tx => {\r\n\t\t\t\t\t\t/** @description Context Menu: toggle both sides */\r\n\t\t\t\t\t\tconst state = model\r\n\t\t\t\t\t\t\t.getState(baseRange)\r\n\t\t\t\t\t\t\t.get();\r\n\t\t\t\t\t\tmodel.setState(\r\n\t\t\t\t\t\t\tbaseRange,\r\n\t\t\t\t\t\t\tstate\r\n\t\t\t\t\t\t\t\t.toggle(inputNumber)\r\n\t\t\t\t\t\t\t\t.toggle(inputNumber === 1 ? 2 : 1),\r\n\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\ttx\r\n\t\t\t\t\t\t);\r\n\t\t\t\t\t});\r\n\t\t\t\t},\r\n\t\t\t\tgetContextMenuActions: () => {\r\n\t\t\t\t\tconst state = model.getState(baseRange).get();\r\n\t\t\t\t\tconst handled = model.isHandled(baseRange).get();\r\n\r\n\t\t\t\t\tconst update = (newState: ModifiedBaseRangeState) => {\r\n\t\t\t\t\t\ttransaction(tx => {\r\n\t\t\t\t\t\t\t/** @description Context Menu: Update Base Range State */\r\n\t\t\t\t\t\t\treturn viewModel.setState(baseRange, newState, tx);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t};\r\n\r\n\t\t\t\t\tfunction action(id: string, label: string, targetState: ModifiedBaseRangeState, checked: boolean) {\r\n\t\t\t\t\t\tconst action = new Action(id, label, undefined, true, () => {\r\n\t\t\t\t\t\t\tupdate(targetState);\r\n\t\t\t\t\t\t});\r\n\t\t\t\t\t\taction.checked = checked;\r\n\t\t\t\t\t\treturn action;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tconst both = state.input1 && state.input2;\r\n\r\n\t\t\t\t\treturn [\r\n\t\t\t\t\t\tbaseRange.input1Diffs.length > 0\r\n\t\t\t\t\t\t\t? action(\r\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput1',\r\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input1.title),\r\n\t\t\t\t\t\t\t\tstate.toggle(1),\r\n\t\t\t\t\t\t\t\tstate.input1\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\t\t\t\t\t\tbaseRange.input2Diffs.length > 0\r\n\t\t\t\t\t\t\t? action(\r\n\t\t\t\t\t\t\t\t'mergeEditor.acceptInput2',\r\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.accept', 'Accept {0}', model.input2.title),\r\n\t\t\t\t\t\t\t\tstate.toggle(2),\r\n\t\t\t\t\t\t\t\tstate.input2\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\t\t\t\t\t\tbaseRange.isConflicting\r\n\t\t\t\t\t\t\t? setFields(\r\n\t\t\t\t\t\t\t\taction(\r\n\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\r\n\t\t\t\t\t\t\t\t\tlocalize(\r\n\t\t\t\t\t\t\t\t\t\t'mergeEditor.acceptBoth',\r\n\t\t\t\t\t\t\t\t\t\t'Accept Both'\r\n\t\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t\tstate.withInput1(!both).withInput2(!both),\r\n\t\t\t\t\t\t\t\t\tboth\r\n\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t{ enabled: baseRange.canBeCombined }\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\t\t\t\t\t\tnew Separator(),\r\n\t\t\t\t\t\tbaseRange.isConflicting\r\n\t\t\t\t\t\t\t? setFields(\r\n\t\t\t\t\t\t\t\taction(\r\n\t\t\t\t\t\t\t\t\t'mergeEditor.swap',\r\n\t\t\t\t\t\t\t\t\tlocalize('mergeEditor.swap', 'Swap'),\r\n\t\t\t\t\t\t\t\t\tstate.swap(),\r\n\t\t\t\t\t\t\t\t\tfalse\r\n\t\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t\t{ enabled: !state.isEmpty && (!both || baseRange.isOrderRelevant) }\r\n\t\t\t\t\t\t\t)\r\n\t\t\t\t\t\t\t: undefined,\r\n\r\n\t\t\t\t\t\tsetFields(\r\n\t\t\t\t\t\t\tnew Action(\r\n\t\t\t\t\t\t\t\t'mergeEditor.markAsHandled',\r\n\t\t\t\t\t\t\t\tlocalize('mergeEditor.markAsHandled', 'Mark as Handled'),\r\n\t\t\t\t\t\t\t\tundefined,\r\n\t\t\t\t\t\t\t\ttrue,\r\n\t\t\t\t\t\t\t\t() => {\r\n\t\t\t\t\t\t\t\t\ttransaction((tx) => {\r\n\t\t\t\t\t\t\t\t\t\t/** @description Context Menu: Mark as handled */\r\n\t\t\t\t\t\t\t\t\t\tmodel.setHandled(baseRange, !handled, tx);\r\n\t\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t),\r\n\t\t\t\t\t\t\t{ checked: handled }\r\n\t\t\t\t\t\t),\r\n\t\t\t\t\t].filter(isDefined);\r\n\t\t\t\t}\r\n\t\t\t}));\r\n\t});\r\n\r\n\tprivate readonly decorations = derived(`input${this.inputNumber}.decorations`, reader => {\r\n\t\tconst viewModel = this.viewModel.read(reader);\r\n\t\tif (!viewModel) {\r\n\t\t\treturn [];\r\n\t\t}\r\n\t\tconst model = viewModel.model;\r\n\tconstructor(\r\n\t\tpublic readonly inputNumber: 1 | 2,\r\n\t\t@IInstantiationService instantiationService: IInstantiationService,\r\n\t\t@IContextMenuService contextMenuService: IContextMenuService,\r\n\t\t@IThemeService themeService: IThemeService,\r\n\t\t@IMenuService menuService: IMenuService,\r\n\t\t@IContextKeyService contextKeyService: IContextKeyService,\r\n\t) {\r\n\t\tsuper(instantiationService);\r\n\r\n\t\tconst activeModifiedBaseRange = viewModel.activeModifiedBaseRange.read(reader);\r\n\r\n\t\tconst result = new Array<IModelDeltaDecoration>();\r\n\r\n\t\tfor (const modifiedBaseRange of model.modifiedBaseRanges.read(reader)) {\r\n\r\n\t\t\tconst range = modifiedBaseRange.getInputRange(this.inputNumber);\r\n\t\t\tif (range && !range.isEmpty) {\r\n\t\t\t\tconst blockClassNames = ['merge-editor-block'];\r\n\t\t\t\tconst isHandled = model.isHandled(modifiedBaseRange).read(reader);\r\n\t\t\t\tif (isHandled) {\r\n\t\t\t\t\tblockClassNames.push('handled');\r\n\t\t\t\t}\r\n\t\t\t\tif (modifiedBaseRange === activeModifiedBaseRange) {\r\n\t\t\t\t\tblockClassNames.push('focused');\r\n\t\t\t\t}\r\n\t\t\t\tif (modifiedBaseRange.isConflicting) {\r\n\t\t\t\t\tblockClassNames.push('conflicting');\r\n\t\t\t\t}\r\n\t\t\t\tconst inputClassName = this.inputNumber === 1 ? 'input1' : 'input2';\r\n\t\t\t\tblockClassNames.push(inputClassName);\r\n\r\n\t\t\t\tresult.push({\r\n\t\t\t\t\trange: range.toInclusiveRange()!,\r\n\t\t\t\t\toptions: {\r\n\t\t\t\t\t\tisWholeLine: true,\r\n\t\t\t\t\t\tblockClassName: blockClassNames.join(' '),\r\n\t\t\t\t\t\tdescription: 'Merge Editor',\r\n\t\t\t\t\t\tminimap: {\r\n\t\t\t\t\t\t\tposition: MinimapPosition.Gutter,\r\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\r\n\t\t\t\t\t\t},\r\n\t\t\t\t\t\toverviewRuler: modifiedBaseRange.isConflicting ? {\r\n\t\t\t\t\t\t\tposition: OverviewRulerLane.Center,\r\n\t\t\t\t\t\t\tcolor: { id: isHandled ? handledConflictMinimapOverViewRulerColor : unhandledConflictMinimapOverViewRulerColor },\r\n\t\t\t\t\t\t} : undefined\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\r\n\t\t// title menu\r\n\t\tconst titleMenu = menuService.createMenu(titleMenuId, contextKeyService);\r\n\t\tconst toolBar = new ToolBar(this.htmlElements.toolbar, contextMenuService);\r\n\t\tconst toolBarUpdate = () => {\r\n\t\t\tconst secondary: IAction[] = [];\r\n\t\t\tcreateAndFillInActionBarActions(titleMenu, { renderShortTitle: true }, secondary);\r\n\t\t\ttoolBar.setActions([], secondary);\r\n\t\t};\r\n\t\tthis._store.add(toolBar);\r\n\t\tthis._store.add(titleMenu);\r\n\t\tthis._store.add(titleMenu.onDidChange(toolBarUpdate));\r\n\t\ttoolBarUpdate();\r\n\t}\r\n\r\n\t\t\t\t\t\tif (diff.rangeMappings) {\r\n\t\t\t\t\t\t\tfor (const d of diff.rangeMappings) {\r\n\t\t\t\t\t\t\t\tresult.push({\r\n\t\t\t\t\t\t\t\t\trange: d.outputRange,\r\n\t\t\t\t\t\t\t\t\toptions: {\r\n\t\t\t\t\t\t\t\t\t\tclassName: `merge-editor-diff-word ${inputClassName}`,\r\n\t\t\t\t\t\t\t\t\t\tdescription: 'Merge Editor'\r\n\t\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn result;\r\n\t});\r\n\r\n\tprotected override getEditorContributions(): IEditorContributionDescription[] | undefined {\r\n\t\treturn EditorExtensionsRegistry.getEditorContributions().filter(c => c.id !== CodeLensContribution.ID);\r\n\t}\r\n}"
} |
Does this issue occur when all extensions are disabled?: Yes/No
VS Code Version:
Version: 1.70.0
Commit: da76f93
Date: 2022-08-04T04:38:16.462Z
Electron: 18.3.5
Chromium: 100.0.4896.160
Node.js: 16.13.2
V8: 10.0.139.17-electron.0
OS: Windows_NT x64 10.0.19044
OS Version: win10
Steps to Reproduce:
The text was updated successfully, but these errors were encountered: