Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/core-browser/src/core-preferences.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,10 @@ export const corePreferenceSchema: PreferenceSchema = {
type: 'boolean',
default: true,
},
'mergeEditor.autoApplyNonConflictChanges': {
type: 'boolean',
default: false,
},
},
};

Expand Down
3 changes: 3 additions & 0 deletions packages/i18n/src/common/en-US.lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -987,6 +987,9 @@ export const localizationBundle = {

'preference.diffEditor.renderSideBySide': 'Render Side By Side',
'preference.diffEditor.ignoreTrimWhitespace': 'Ignore Trim Whitespace',

'preference.mergeEditor.autoApplyNonConflictChanges': 'Automatically apply non-conflicting changes',

'validate.tree.emptyFileNameError': 'Please provide a file or folder name',
'validate.tree.fileNameStartsWithSlashError': 'File or folder name cannot start with /',
'validate.tree.fileNameFollowOrStartWithSpaceWarning': 'Leading or trailing spaces detected in file or folder name',
Expand Down
2 changes: 2 additions & 0 deletions packages/i18n/src/common/zh-CN.lang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ export const localizationBundle = {
'preference.diffEditor.renderSideBySide': '显示并排差异编辑器',
'preference.diffEditor.ignoreTrimWhitespace': '忽略差异编辑器的前导和尾随空白字符',

'preference.mergeEditor.autoApplyNonConflictChanges': '自动合并非冲突变更',

'status.editor.chooseLanguage': '选择语言模式',
'status.editor.goToLineCol': '转到行/列',
'status.editor.chooseEncoding': '选择编码',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Emitter,
Event,
MonacoService,
PreferenceService,
SCM_COMMANDS,
localize,
} from '@opensumi/ide-core-browser';
Expand Down Expand Up @@ -55,6 +56,9 @@ export class MergeEditorService extends Disposable {
@Autowired(MergeConflictReportService)
private readonly mergeConflictReportService: MergeConflictReportService;

@Autowired(PreferenceService)
protected readonly preferenceService: PreferenceService;

public resultView: ResultCodeEditor;

private currentView: CurrentCodeEditor;
Expand Down Expand Up @@ -426,8 +430,11 @@ export class MergeEditorService extends Disposable {
this.resultView.inputDiffComputingResult();

// resolve non conflict ranges
this.acceptLeft(true, ECompleteReason.AutoResolvedNonConflict);
this.acceptRight(true, ECompleteReason.AutoResolvedNonConflict);
const isAutoApply = this.preferenceService.getValid('mergeEditor.autoApplyNonConflictChanges', false);
if (isAutoApply) {
this.acceptLeft(true, ECompleteReason.AutoResolvedNonConflict);
this.acceptRight(true, ECompleteReason.AutoResolvedNonConflict);
}

this.currentView.updateDecorations().updateActions();
this.incomingView.updateDecorations().updateActions();
Expand Down
10 changes: 10 additions & 0 deletions packages/preferences/src/browser/preference-settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -740,6 +740,16 @@ export const defaultSettingSections: {
{ id: 'diffEditor.ignoreTrimWhitespace', localized: 'preference.diffEditor.ignoreTrimWhitespace' },
],
},
{
title: 'Merge Editor',
preferences: [
// merge 编辑器
{
id: 'mergeEditor.autoApplyNonConflictChanges',
localized: 'preference.mergeEditor.autoApplyNonConflictChanges',
},
],
},
{
title: 'Files',
preferences: [
Expand Down