Skip to content

Commit

Permalink
fix: 3way merge result model save error (#3403)
Browse files Browse the repository at this point in the history
Co-authored-by: qingyi.xjh <qingyi.xjh@antgroup.com>
  • Loading branch information
opensumi[bot] and Ricbet authored Mar 14, 2024
1 parent a7bb17f commit 56d97f5
Showing 1 changed file with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ReactDOM from 'react-dom/client';
import { Autowired, Injectable } from '@opensumi/di';
import { AppConfig, ConfigProvider } from '@opensumi/ide-core-browser';
import { IMergeEditorEditor, IOpenMergeEditorArgs } from '@opensumi/ide-core-browser/lib/monaco/merge-editor-widget';
import { Disposable, IRange, ISelection, URI } from '@opensumi/ide-core-common';
import { Disposable, Event, IRange, ISelection, URI } from '@opensumi/ide-core-common';
import { Selection } from '@opensumi/monaco-editor-core';
import { IDisposable } from '@opensumi/monaco-editor-core/esm/vs/base/common/lifecycle';
import { IDimension } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/dimension';
Expand All @@ -15,9 +15,12 @@ import {
IEditorViewState,
ScrollType,
} from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon';
import { ILanguageSelection } from '@opensumi/monaco-editor-core/esm/vs/editor/common/languages/language';
import { IModelDecorationsChangeAccessor, ITextModel } from '@opensumi/monaco-editor-core/esm/vs/editor/common/model';
import { IModelService } from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/model';

import { ICodeEditor, IDiffEditorOptions, IEditorOptions, IModelDeltaDecoration } from '../../monaco-api/editor';
import { StandaloneServices } from '../../monaco-api/services';
import { IPosition, Position } from '../../monaco-api/types';

import { MergeEditorService } from './merge-editor.service';
Expand Down Expand Up @@ -89,9 +92,16 @@ export class MergeEditorWidget extends Disposable implements IMergeEditorEditor
this.outputUri = output.uri;
const uniqueKey = this.outputUri.toString();

const modelService = StandaloneServices.get(IModelService);
const languageSelection: ILanguageSelection = {
languageId: (ancestor.textModel as ITextModel).getLanguageId(),
onDidChange: Event.None,
};
const ancestorModel = modelService.createModel(ancestor.baseContent, languageSelection);

this.setModel({
ours: input1.textModel as ITextModel,
result: ancestor.textModel as ITextModel,
result: ancestorModel,
theirs: input2.textModel as ITextModel,
});

Expand Down

0 comments on commit 56d97f5

Please sign in to comment.