@opensumi/ide-editor 3.8.3-next-1747817292.0 → 3.8.3-next-1747895552.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/base-editor-wrapper.d.ts +58 -0
- package/lib/browser/base-editor-wrapper.d.ts.map +1 -0
- package/lib/browser/base-editor-wrapper.js +203 -0
- package/lib/browser/base-editor-wrapper.js.map +1 -0
- package/lib/browser/editor-collection.service.d.ts +8 -57
- package/lib/browser/editor-collection.service.d.ts.map +1 -1
- package/lib/browser/editor-collection.service.js +6 -202
- package/lib/browser/editor-collection.service.js.map +1 -1
- package/lib/browser/editor.less +11 -0
- package/lib/browser/multi-diff/multi-diff-editor.d.ts +6 -5
- package/lib/browser/multi-diff/multi-diff-editor.d.ts.map +1 -1
- package/lib/browser/multi-diff/multi-diff-editor.js +29 -24
- package/lib/browser/multi-diff/multi-diff-editor.js.map +1 -1
- package/package.json +14 -14
- package/src/browser/base-editor-wrapper.ts +254 -0
- package/src/browser/editor-collection.service.ts +5 -256
- package/src/browser/editor.less +11 -0
- package/src/browser/multi-diff/multi-diff-editor.ts +54 -31
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
|
|
2
2
|
import { PreferenceService } from '@opensumi/ide-core-browser';
|
|
3
3
|
import {
|
|
4
|
-
Disposable,
|
|
5
4
|
DisposableStore,
|
|
6
5
|
Emitter,
|
|
6
|
+
Event,
|
|
7
7
|
IDisposable,
|
|
8
8
|
ILogger,
|
|
9
9
|
OnEvent,
|
|
@@ -35,17 +35,14 @@ import { IMultiDiffResourceId } from '@opensumi/monaco-editor-core/esm/vs/editor
|
|
|
35
35
|
import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range';
|
|
36
36
|
import { IDiffEditor } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon';
|
|
37
37
|
|
|
38
|
-
import {
|
|
39
|
-
EditorCollectionService,
|
|
40
|
-
EditorType,
|
|
41
|
-
IEditorDocumentModelRef,
|
|
42
|
-
IResourceOpenOptions,
|
|
43
|
-
} from '../../common/editor';
|
|
38
|
+
import { EditorType, IEditorDocumentModelRef, IResourceOpenOptions } from '../../common/editor';
|
|
44
39
|
import { IMultiDiffEditor, IMultiDiffSourceResolverService, IResolvedMultiDiffSource } from '../../common/multi-diff';
|
|
40
|
+
import { DiffEditorPart } from '../base-editor-wrapper';
|
|
45
41
|
import { EditorDocumentModelContentChangedEvent, IEditorDocumentModelService } from '../doc-model/types';
|
|
46
|
-
import { DiffEditorPart, EditorCollectionServiceImpl } from '../editor-collection.service';
|
|
47
42
|
import { IConvertedMonacoOptions, IResource, ResourceDecorationNeedChangeEvent } from '../types';
|
|
48
43
|
|
|
44
|
+
import type { EditorCollectionServiceImpl } from '../editor-collection.service';
|
|
45
|
+
|
|
49
46
|
@Injectable({ multiple: true })
|
|
50
47
|
export class BrowserMultiDiffEditor extends WithEventBus implements IMultiDiffEditor {
|
|
51
48
|
@Autowired(INJECTOR_TOKEN)
|
|
@@ -63,9 +60,6 @@ export class BrowserMultiDiffEditor extends WithEventBus implements IMultiDiffEd
|
|
|
63
60
|
@Autowired(IMultiDiffSourceResolverService)
|
|
64
61
|
private readonly multiDiffSourceResolverService: IMultiDiffSourceResolverService;
|
|
65
62
|
|
|
66
|
-
@Autowired(EditorCollectionService)
|
|
67
|
-
private readonly collectionService: EditorCollectionServiceImpl;
|
|
68
|
-
|
|
69
63
|
@Autowired(ILogger)
|
|
70
64
|
logger: ILogger;
|
|
71
65
|
|
|
@@ -77,13 +71,13 @@ export class BrowserMultiDiffEditor extends WithEventBus implements IMultiDiffEd
|
|
|
77
71
|
|
|
78
72
|
private multiDiffModel: IMultiDiffEditorModel & IDisposable;
|
|
79
73
|
|
|
80
|
-
constructor(
|
|
74
|
+
constructor(
|
|
75
|
+
private multiDiffWidget: MultiDiffEditorWidget,
|
|
76
|
+
private convertedOptions: IConvertedMonacoOptions,
|
|
77
|
+
private editorCollectionService: EditorCollectionServiceImpl,
|
|
78
|
+
) {
|
|
81
79
|
super();
|
|
82
|
-
this.
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
private wrapEditors() {
|
|
86
|
-
this.collectionService.addMultiDiffEditors([this]);
|
|
80
|
+
this.editorCollectionService.addMultiDiffEditors([this]);
|
|
87
81
|
}
|
|
88
82
|
|
|
89
83
|
@OnEvent(EditorDocumentModelContentChangedEvent)
|
|
@@ -133,6 +127,27 @@ export class BrowserMultiDiffEditor extends WithEventBus implements IMultiDiffEd
|
|
|
133
127
|
}
|
|
134
128
|
}
|
|
135
129
|
|
|
130
|
+
private createAndRegisterEditorParts(
|
|
131
|
+
modifiedEditor: { editor: ICodeEditor } | undefined,
|
|
132
|
+
originalEditor: { editor: ICodeEditor } | undefined,
|
|
133
|
+
modifiedInstance: any,
|
|
134
|
+
originalInstance: any,
|
|
135
|
+
): void {
|
|
136
|
+
const modifiedDiffEditorPart = this.injector.get(DiffEditorPart, [
|
|
137
|
+
modifiedEditor?.editor,
|
|
138
|
+
() => modifiedInstance,
|
|
139
|
+
EditorType.MODIFIED_DIFF,
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
const originalDiffEditorPart = this.injector.get(DiffEditorPart, [
|
|
143
|
+
originalEditor?.editor,
|
|
144
|
+
() => originalInstance,
|
|
145
|
+
EditorType.ORIGINAL_DIFF,
|
|
146
|
+
]);
|
|
147
|
+
|
|
148
|
+
this.editorCollectionService.addEditors([modifiedDiffEditorPart, originalDiffEditorPart]);
|
|
149
|
+
}
|
|
150
|
+
|
|
136
151
|
async compareMultiple(editor: IMultiDiffEditor, resource: IResource, options?: IResourceOpenOptions): Promise<void> {
|
|
137
152
|
// Save current view state before changing
|
|
138
153
|
if (this.currentUri) {
|
|
@@ -234,20 +249,28 @@ export class BrowserMultiDiffEditor extends WithEventBus implements IMultiDiffEd
|
|
|
234
249
|
if (!modified || !original) {
|
|
235
250
|
continue;
|
|
236
251
|
}
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
252
|
+
let modifiedEditor = this.multiDiffWidget.tryGetCodeEditor(modified?.uri);
|
|
253
|
+
let originalEditor = this.multiDiffWidget.tryGetCodeEditor(original?.uri);
|
|
254
|
+
if (!modifiedEditor || !originalEditor) {
|
|
255
|
+
Event.once(modified.onDidChangeTokens)(() => {
|
|
256
|
+
modifiedEditor = this.multiDiffWidget.tryGetCodeEditor(modified?.uri);
|
|
257
|
+
originalEditor = this.multiDiffWidget.tryGetCodeEditor(original?.uri);
|
|
258
|
+
this.createAndRegisterEditorParts(
|
|
259
|
+
modifiedEditor,
|
|
260
|
+
originalEditor,
|
|
261
|
+
(ref.object as any).modifiedInstance,
|
|
262
|
+
(ref.object as any).originalInstance,
|
|
263
|
+
);
|
|
264
|
+
});
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
this.createAndRegisterEditorParts(
|
|
269
|
+
modifiedEditor,
|
|
270
|
+
originalEditor,
|
|
271
|
+
(ref.object as any).modifiedInstance,
|
|
272
|
+
(ref.object as any).originalInstance,
|
|
273
|
+
);
|
|
251
274
|
}
|
|
252
275
|
this.multiDiffModelChangeEmitter.fire(this.multiDiffModel);
|
|
253
276
|
}
|