@opensumi/ide-editor 2.21.13 → 2.22.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/breadcrumb/default.js.map +1 -1
- package/lib/browser/breadcrumb/document-symbol.js.map +1 -1
- package/lib/browser/breadcrumb/index.js.map +1 -1
- package/lib/browser/component.js.map +1 -1
- package/lib/browser/decoration-applier.js.map +1 -1
- package/lib/browser/diff/compare.js.map +1 -1
- package/lib/browser/diff/index.d.ts.map +1 -1
- package/lib/browser/diff/index.js +1 -1
- package/lib/browser/diff/index.js.map +1 -1
- package/lib/browser/doc-cache/empty-doc-cache.js.map +1 -1
- package/lib/browser/doc-cache/local-storage-cache.js.map +1 -1
- package/lib/browser/doc-model/editor-document-model-service.js +3 -3
- package/lib/browser/doc-model/editor-document-model-service.js.map +1 -1
- package/lib/browser/doc-model/editor-document-model.d.ts +8 -0
- package/lib/browser/doc-model/editor-document-model.d.ts.map +1 -1
- package/lib/browser/doc-model/editor-document-model.js +61 -11
- package/lib/browser/doc-model/editor-document-model.js.map +1 -1
- package/lib/browser/doc-model/editor-document-registry.js.map +1 -1
- package/lib/browser/doc-model/override.js.map +1 -1
- package/lib/browser/doc-model/save-task.js +1 -1
- package/lib/browser/doc-model/save-task.js.map +1 -1
- package/lib/browser/doc-model/saveParticipants.d.ts +7 -7
- package/lib/browser/doc-model/saveParticipants.d.ts.map +1 -1
- package/lib/browser/doc-model/saveParticipants.js +69 -38
- package/lib/browser/doc-model/saveParticipants.js.map +1 -1
- package/lib/browser/doc-model/types.d.ts +1 -1
- package/lib/browser/doc-model/types.d.ts.map +1 -1
- package/lib/browser/editor-collection.service.d.ts +8 -3
- package/lib/browser/editor-collection.service.d.ts.map +1 -1
- package/lib/browser/editor-collection.service.js +75 -66
- package/lib/browser/editor-collection.service.js.map +1 -1
- package/lib/browser/editor-opener.js.map +1 -1
- package/lib/browser/editor.contribution.d.ts.map +1 -1
- package/lib/browser/editor.contribution.js +31 -3
- package/lib/browser/editor.contribution.js.map +1 -1
- package/lib/browser/editor.decoration.service.d.ts +5 -6
- package/lib/browser/editor.decoration.service.d.ts.map +1 -1
- package/lib/browser/editor.decoration.service.js +9 -1
- package/lib/browser/editor.decoration.service.js.map +1 -1
- package/lib/browser/editor.override.js +2 -2
- package/lib/browser/editor.override.js.map +1 -1
- package/lib/browser/editor.status-bar.service.js.map +1 -1
- package/lib/browser/editor.view.d.ts.map +1 -1
- package/lib/browser/editor.view.js +20 -23
- package/lib/browser/editor.view.js.map +1 -1
- package/lib/browser/error.d.ts +1 -1
- package/lib/browser/error.d.ts.map +1 -1
- package/lib/browser/feature.js.map +1 -1
- package/lib/browser/format/format.service.js.map +1 -1
- package/lib/browser/format/formatterSelect.js.map +1 -1
- package/lib/browser/fs-resource/file-tree-set.js +6 -6
- package/lib/browser/fs-resource/file-tree-set.js.map +1 -1
- package/lib/browser/fs-resource/fs-editor-doc.js +1 -1
- package/lib/browser/fs-resource/fs-editor-doc.js.map +1 -1
- package/lib/browser/fs-resource/fs-resource.js.map +1 -1
- package/lib/browser/fs-resource/index.js.map +1 -1
- package/lib/browser/history/index.d.ts.map +1 -1
- package/lib/browser/history/index.js +2 -1
- package/lib/browser/history/index.js.map +1 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +2 -0
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/language/diagnostic-collection.d.ts +5 -5
- package/lib/browser/language/diagnostic-collection.d.ts.map +1 -1
- package/lib/browser/language/diagnostic-collection.js +1 -1
- package/lib/browser/language/diagnostic-collection.js.map +1 -1
- package/lib/browser/language/language-status.contribution.js.map +1 -1
- package/lib/browser/language/language-status.service.js.map +1 -1
- package/lib/browser/language/language.service.d.ts +4 -3
- package/lib/browser/language/language.service.d.ts.map +1 -1
- package/lib/browser/language/language.service.js +8 -2
- package/lib/browser/language/language.service.js.map +1 -1
- package/lib/browser/menu/editor.context.js +3 -3
- package/lib/browser/menu/editor.context.js.map +1 -1
- package/lib/browser/menu/editor.menu.d.ts +2 -2
- package/lib/browser/menu/editor.menu.d.ts.map +1 -1
- package/lib/browser/menu/editor.menu.js +6 -8
- package/lib/browser/menu/editor.menu.js.map +1 -1
- package/lib/browser/menu/open-type-menu.contribution.js +9 -9
- package/lib/browser/menu/open-type-menu.contribution.js.map +1 -1
- package/lib/browser/menu/title-context.menu.js.map +1 -1
- package/lib/browser/merge-editor/merge-editor.contribution.d.ts +8 -0
- package/lib/browser/merge-editor/merge-editor.contribution.d.ts.map +1 -0
- package/lib/browser/merge-editor/merge-editor.contribution.js +29 -0
- package/lib/browser/merge-editor/merge-editor.contribution.js.map +1 -0
- package/lib/browser/merge-editor/merge-editor.provider.d.ts +8 -0
- package/lib/browser/merge-editor/merge-editor.provider.d.ts.map +1 -0
- package/lib/browser/merge-editor/merge-editor.provider.js +44 -0
- package/lib/browser/merge-editor/merge-editor.provider.js.map +1 -0
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.contribution.js.map +1 -1
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.js +7 -7
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.js.map +1 -1
- package/lib/browser/monaco-contrib/command/command.service.d.ts +1 -1
- package/lib/browser/monaco-contrib/command/command.service.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/command/command.service.js.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate-registry.js.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.d.ts +2 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.js +5 -2
- package/lib/browser/monaco-contrib/tokenizer/textmate.service.js.map +1 -1
- package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.contribution.js.map +1 -1
- package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.js +7 -7
- package/lib/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.js.map +1 -1
- package/lib/browser/navigation.module.less +1 -1
- package/lib/browser/navigation.view.d.ts.map +1 -1
- package/lib/browser/navigation.view.js +26 -15
- package/lib/browser/navigation.view.js.map +1 -1
- package/lib/browser/preference/contribution.js.map +1 -1
- package/lib/browser/preference/converter.d.ts +3 -3
- package/lib/browser/preference/converter.d.ts.map +1 -1
- package/lib/browser/preference/schema.d.ts +1 -1
- package/lib/browser/preference/schema.d.ts.map +1 -1
- package/lib/browser/preference/schema.js +8 -8
- package/lib/browser/preference/schema.js.map +1 -1
- package/lib/browser/quick-open/go-to-line.js.map +1 -1
- package/lib/browser/quick-open/workspace-symbol-quickopen.d.ts.map +1 -1
- package/lib/browser/quick-open/workspace-symbol-quickopen.js +2 -2
- package/lib/browser/quick-open/workspace-symbol-quickopen.js.map +1 -1
- package/lib/browser/resource.service.js.map +1 -1
- package/lib/browser/tab.view.d.ts +1 -1
- package/lib/browser/tab.view.d.ts.map +1 -1
- package/lib/browser/tab.view.js +2 -2
- package/lib/browser/tab.view.js.map +1 -1
- package/lib/browser/types.d.ts +5 -5
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/untitled-resource.js +1 -1
- package/lib/browser/untitled-resource.js.map +1 -1
- package/lib/browser/view/suggest-widget.js.map +1 -1
- package/lib/browser/workbench-editor.service.d.ts +17 -0
- package/lib/browser/workbench-editor.service.d.ts.map +1 -1
- package/lib/browser/workbench-editor.service.js +259 -176
- package/lib/browser/workbench-editor.service.js.map +1 -1
- package/lib/common/doc-cache.d.ts +2 -2
- package/lib/common/doc-cache.d.ts.map +1 -1
- package/lib/common/editor.d.ts +20 -6
- package/lib/common/editor.d.ts.map +1 -1
- package/lib/common/editor.js +12 -1
- package/lib/common/editor.js.map +1 -1
- package/lib/common/language.d.ts +18 -7
- package/lib/common/language.d.ts.map +1 -1
- package/lib/common/language.js +15 -7
- package/lib/common/language.js.map +1 -1
- package/lib/common/mocks/workbench-editor.service.js.map +1 -1
- package/lib/common/resource.d.ts +8 -2
- package/lib/common/resource.d.ts.map +1 -1
- package/lib/common/resource.js +1 -0
- package/lib/common/resource.js.map +1 -1
- package/package.json +17 -16
- package/src/browser/breadcrumb/default.ts +299 -0
- package/src/browser/breadcrumb/document-symbol.ts +187 -0
- package/src/browser/breadcrumb/index.ts +96 -0
- package/src/browser/component.ts +204 -0
- package/src/browser/decoration-applier.ts +256 -0
- package/src/browser/diff/compare.ts +99 -0
- package/src/browser/diff/index.ts +81 -0
- package/src/browser/doc-cache/empty-doc-cache.ts +26 -0
- package/src/browser/doc-cache/index.ts +2 -0
- package/src/browser/doc-cache/local-storage-cache.ts +67 -0
- package/src/browser/doc-model/editor-document-error.ts +10 -0
- package/src/browser/doc-model/editor-document-model-service.ts +346 -0
- package/src/browser/doc-model/editor-document-model.ts +690 -0
- package/src/browser/doc-model/editor-document-registry.ts +119 -0
- package/src/browser/doc-model/editor-is-fn.ts +9 -0
- package/src/browser/doc-model/main.ts +4 -0
- package/src/browser/doc-model/override.ts +49 -0
- package/src/browser/doc-model/save-task.ts +88 -0
- package/src/browser/doc-model/saveParticipants.ts +227 -0
- package/src/browser/doc-model/types.ts +350 -0
- package/src/browser/editor-collection.service.ts +790 -0
- package/src/browser/editor-opener.ts +44 -0
- package/src/browser/editor.contribution.ts +1438 -0
- package/src/browser/editor.decoration.service.ts +247 -0
- package/src/browser/editor.less +4 -0
- package/src/browser/editor.module.less +548 -0
- package/src/browser/editor.override.ts +133 -0
- package/src/browser/editor.status-bar.service.ts +116 -0
- package/src/browser/editor.view.tsx +623 -0
- package/src/browser/error.ts +21 -0
- package/src/browser/feature.ts +63 -0
- package/src/browser/format/format.service.ts +95 -0
- package/src/browser/format/formatterSelect.ts +82 -0
- package/src/browser/fs-resource/file-tree-set.ts +126 -0
- package/src/browser/fs-resource/fs-editor-doc.ts +213 -0
- package/src/browser/fs-resource/fs-resource.ts +247 -0
- package/src/browser/fs-resource/index.ts +27 -0
- package/src/browser/grid/grid.service.ts +288 -0
- package/src/browser/history/index.ts +228 -0
- package/src/browser/index.ts +236 -0
- package/src/browser/language/diagnostic-collection.ts +83 -0
- package/src/browser/language/language-status.contribution.ts +81 -0
- package/src/browser/language/language-status.service.ts +32 -0
- package/src/browser/language/language.service.ts +185 -0
- package/src/browser/menu/editor.context.ts +186 -0
- package/src/browser/menu/editor.menu.ts +45 -0
- package/src/browser/menu/open-type-menu.contribution.ts +90 -0
- package/src/browser/menu/title-context.menu.ts +54 -0
- package/src/browser/merge-editor/merge-editor.contribution.ts +25 -0
- package/src/browser/merge-editor/merge-editor.provider.ts +36 -0
- package/src/browser/monaco-contrib/callHierarchy/callHierarchy.contribution.ts +78 -0
- package/src/browser/monaco-contrib/callHierarchy/callHierarchy.service.ts +160 -0
- package/src/browser/monaco-contrib/command/command.service.ts +438 -0
- package/src/browser/monaco-contrib/index.ts +4 -0
- package/src/browser/monaco-contrib/tokenizer/textmate-registry.ts +107 -0
- package/src/browser/monaco-contrib/tokenizer/textmate-tokenizer.ts +104 -0
- package/src/browser/monaco-contrib/tokenizer/textmate.service.ts +925 -0
- package/src/browser/monaco-contrib/typeHierarchy/typeHierarchy.contribution.ts +78 -0
- package/src/browser/monaco-contrib/typeHierarchy/typeHierarchy.service.ts +154 -0
- package/src/browser/navigation.module.less +96 -0
- package/src/browser/navigation.view.tsx +254 -0
- package/src/browser/preference/contribution.ts +8 -0
- package/src/browser/preference/converter.ts +793 -0
- package/src/browser/preference/schema.ts +1896 -0
- package/src/browser/preference/util.ts +14 -0
- package/src/browser/quick-open/go-to-line.ts +164 -0
- package/src/browser/quick-open/workspace-symbol-quickopen.ts +276 -0
- package/src/browser/resource.service.ts +263 -0
- package/src/browser/tab.view.tsx +514 -0
- package/src/browser/types.ts +467 -0
- package/src/browser/untitled-resource.ts +223 -0
- package/src/browser/view/editor.react.tsx +82 -0
- package/src/browser/view/react-hook.tsx +7 -0
- package/src/browser/view/suggest-widget.ts +77 -0
- package/src/browser/view/topPadding.ts +18 -0
- package/src/browser/workbench-editor.service.ts +2291 -0
- package/src/common/doc-cache.ts +117 -0
- package/src/common/editor.ts +799 -0
- package/src/common/index.ts +6 -0
- package/src/common/language-status.ts +33 -0
- package/src/common/language.ts +206 -0
- package/src/common/mocks/workbench-editor.service.ts +52 -0
- package/src/common/resource.ts +147 -0
- package/src/common/utils.ts +10 -0
- package/src/index.ts +1 -0
- package/lib/browser/component/scroll/scroll.d.ts +0 -2
- package/lib/browser/component/scroll/scroll.d.ts.map +0 -1
- package/lib/browser/component/scroll/scroll.js +0 -5
- package/lib/browser/component/scroll/scroll.js.map +0 -1
- package/lib/browser/component/scroll/scroll.module.less +0 -86
|
@@ -6,6 +6,7 @@ const mobx_1 = require("mobx");
|
|
|
6
6
|
const di_1 = require("@opensumi/di");
|
|
7
7
|
const ide_core_browser_1 = require("@opensumi/ide-core-browser");
|
|
8
8
|
const resource_1 = require("@opensumi/ide-core-browser/lib/contextkey/resource");
|
|
9
|
+
const merge_editor_widget_1 = require("@opensumi/ide-core-browser/lib/monaco/merge-editor-widget");
|
|
9
10
|
const ide_core_common_1 = require("@opensumi/ide-core-common");
|
|
10
11
|
const ide_core_common_2 = require("@opensumi/ide-core-common");
|
|
11
12
|
const ide_overlay_1 = require("@opensumi/ide-overlay");
|
|
@@ -504,13 +505,21 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
504
505
|
this._prevDomWidth = 0;
|
|
505
506
|
this._codeEditorPendingLayout = false;
|
|
506
507
|
this._diffEditorPendingLayout = false;
|
|
508
|
+
this._mergeEditorPendingLayout = false;
|
|
507
509
|
// 当前为EditorComponent,且monaco光标变化时触发
|
|
508
510
|
this._onCurrentEditorCursorChange = new ide_core_common_2.Emitter();
|
|
509
511
|
this.onCurrentEditorCursorChange = this._onCurrentEditorCursorChange.event;
|
|
510
512
|
this.resourceOpenHistory = [];
|
|
511
513
|
this._domNode = null;
|
|
514
|
+
this._diffEditorDomNode = null;
|
|
515
|
+
this._diffEditorDomNodeAttached = false;
|
|
516
|
+
this._mergeEditorDomNode = null;
|
|
517
|
+
this._mergeEditorDomNodeAttached = false;
|
|
512
518
|
this.codeEditorReady = new ide_core_common_2.ReadyEvent();
|
|
513
519
|
this.diffEditorReady = new ide_core_common_2.ReadyEvent();
|
|
520
|
+
this.diffEditorDomReady = new ide_core_common_2.ReadyEvent();
|
|
521
|
+
this.mergeEditorReady = new ide_core_common_2.ReadyEvent();
|
|
522
|
+
this.mergeEditorDomReady = new ide_core_common_2.ReadyEvent();
|
|
514
523
|
this._restoringState = false;
|
|
515
524
|
this.eventBus.on(ide_core_browser_1.ResizeEvent, (e) => {
|
|
516
525
|
if (e.payload.slotLocation === (0, ide_core_browser_1.getSlotLocation)('@opensumi/ide-editor', this.config.layoutConfig)) {
|
|
@@ -536,6 +545,20 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
536
545
|
}
|
|
537
546
|
}));
|
|
538
547
|
}
|
|
548
|
+
attachDiffEditorDom(domNode) {
|
|
549
|
+
if (!this._diffEditorDomNodeAttached) {
|
|
550
|
+
this._diffEditorDomNode = domNode;
|
|
551
|
+
this.diffEditorDomReady.ready();
|
|
552
|
+
this._diffEditorDomNodeAttached = true;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
attachMergeEditorDom(domNode) {
|
|
556
|
+
if (!this._mergeEditorDomNodeAttached) {
|
|
557
|
+
this._mergeEditorDomNode = domNode;
|
|
558
|
+
this.mergeEditorDomReady.ready();
|
|
559
|
+
this._mergeEditorDomNodeAttached = true;
|
|
560
|
+
}
|
|
561
|
+
}
|
|
539
562
|
attachToDom(domNode) {
|
|
540
563
|
this._domNode = domNode;
|
|
541
564
|
if (domNode) {
|
|
@@ -556,7 +579,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
556
579
|
}
|
|
557
580
|
doLayoutEditors() {
|
|
558
581
|
if (this.codeEditor) {
|
|
559
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
582
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
560
583
|
this.codeEditor.layout();
|
|
561
584
|
this._codeEditorPendingLayout = false;
|
|
562
585
|
}
|
|
@@ -565,7 +588,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
565
588
|
}
|
|
566
589
|
}
|
|
567
590
|
if (this.diffEditor) {
|
|
568
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
591
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
569
592
|
this.diffEditor.layout();
|
|
570
593
|
this._diffEditorPendingLayout = false;
|
|
571
594
|
}
|
|
@@ -573,27 +596,16 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
573
596
|
this._diffEditorPendingLayout = true;
|
|
574
597
|
}
|
|
575
598
|
}
|
|
599
|
+
if (this.mergeEditor) {
|
|
600
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.mergeEditor) {
|
|
601
|
+
// this.mergeEditor.layout();
|
|
602
|
+
this._mergeEditorPendingLayout = false;
|
|
603
|
+
}
|
|
604
|
+
else {
|
|
605
|
+
this._mergeEditorPendingLayout = true;
|
|
606
|
+
}
|
|
607
|
+
}
|
|
576
608
|
}
|
|
577
|
-
// get currentState() {
|
|
578
|
-
// return this._currentState;
|
|
579
|
-
// }
|
|
580
|
-
// set currentState(value: IEditorCurrentState | null) {
|
|
581
|
-
// const oldResource = this.currentResource;
|
|
582
|
-
// const oldOpenType = this.currentOpenType;
|
|
583
|
-
// this._currentState = value;
|
|
584
|
-
// this._pendingState = null;
|
|
585
|
-
// if (oldResource && this.resourceOpenHistory[this.resourceOpenHistory.length - 1] !== oldResource.uri) {
|
|
586
|
-
// this.resourceOpenHistory.push(oldResource.uri);
|
|
587
|
-
// }
|
|
588
|
-
// this.eventBus.fire(new EditorGroupChangeEvent({
|
|
589
|
-
// group: this,
|
|
590
|
-
// newOpenType: this.currentOpenType,
|
|
591
|
-
// newResource: this.currentResource,
|
|
592
|
-
// oldOpenType,
|
|
593
|
-
// oldResource,
|
|
594
|
-
// }));
|
|
595
|
-
// this.setContextKeys();
|
|
596
|
-
// }
|
|
597
609
|
setContextKeys() {
|
|
598
610
|
var _a;
|
|
599
611
|
if (!this._resourceContext) {
|
|
@@ -756,10 +768,10 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
756
768
|
}
|
|
757
769
|
get currentEditor() {
|
|
758
770
|
if (this.currentOpenType) {
|
|
759
|
-
if (this.currentOpenType.type ===
|
|
771
|
+
if (this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
760
772
|
return this.codeEditor;
|
|
761
773
|
}
|
|
762
|
-
else if (this.currentOpenType.type ===
|
|
774
|
+
else if (this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
763
775
|
return this.diffEditor.modifiedEditor;
|
|
764
776
|
}
|
|
765
777
|
else {
|
|
@@ -775,12 +787,12 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
775
787
|
}
|
|
776
788
|
get currentFocusedEditor() {
|
|
777
789
|
if (this.currentOpenType) {
|
|
778
|
-
if (this.currentOpenType.type ===
|
|
790
|
+
if (this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
779
791
|
if (this.codeEditor.monacoEditor.hasWidgetFocus()) {
|
|
780
792
|
return this.codeEditor;
|
|
781
793
|
}
|
|
782
794
|
}
|
|
783
|
-
else if (this.currentOpenType.type ===
|
|
795
|
+
else if (this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
784
796
|
if (this.diffEditor.modifiedEditor.monacoEditor.hasTextFocus()) {
|
|
785
797
|
return this.diffEditor.modifiedEditor;
|
|
786
798
|
}
|
|
@@ -799,7 +811,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
799
811
|
}
|
|
800
812
|
get currentCodeEditor() {
|
|
801
813
|
if (this.currentOpenType) {
|
|
802
|
-
if (this.currentOpenType.type ===
|
|
814
|
+
if (this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
803
815
|
return this.codeEditor;
|
|
804
816
|
}
|
|
805
817
|
else {
|
|
@@ -821,7 +833,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
821
833
|
this._onCurrentEditorCursorChange.fire(e);
|
|
822
834
|
}));
|
|
823
835
|
this.toDispose.push(this.codeEditor.onSelectionsChanged((e) => {
|
|
824
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
836
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
825
837
|
this.eventBus.fire(new types_2.EditorSelectionChangeEvent({
|
|
826
838
|
group: this,
|
|
827
839
|
resource: this.currentResource,
|
|
@@ -832,7 +844,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
832
844
|
}
|
|
833
845
|
}));
|
|
834
846
|
this.toDispose.push(this.codeEditor.onVisibleRangesChanged((e) => {
|
|
835
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
847
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
836
848
|
this.eventBus.fire(new types_2.EditorVisibleChangeEvent({
|
|
837
849
|
group: this,
|
|
838
850
|
resource: this.currentResource,
|
|
@@ -842,7 +854,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
842
854
|
}
|
|
843
855
|
}));
|
|
844
856
|
this.toDispose.push(this.codeEditor.onConfigurationChanged(() => {
|
|
845
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
857
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
846
858
|
this.eventBus.fire(new types_2.EditorConfigurationChangedEvent({
|
|
847
859
|
group: this,
|
|
848
860
|
resource: this.currentResource,
|
|
@@ -852,11 +864,17 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
852
864
|
}));
|
|
853
865
|
this.eventBus.fire(new types_2.CodeEditorDidVisibleEvent({
|
|
854
866
|
groupName: this.name,
|
|
855
|
-
type:
|
|
867
|
+
type: types_2.EditorOpenType.code,
|
|
856
868
|
editorId: this.codeEditor.getId(),
|
|
857
869
|
}));
|
|
858
870
|
this.codeEditorReady.ready();
|
|
859
871
|
}
|
|
872
|
+
createMergeEditor(dom) {
|
|
873
|
+
this.mergeEditor = this.collectionService.createMergeEditor(dom, {}, {
|
|
874
|
+
[ide_core_browser_1.ServiceNames.CONTEXT_KEY_SERVICE]: this.contextKeyService.contextKeyService,
|
|
875
|
+
});
|
|
876
|
+
this.mergeEditorReady.ready();
|
|
877
|
+
}
|
|
860
878
|
createDiffEditor(dom) {
|
|
861
879
|
this.diffEditor = this.collectionService.createDiffEditor(dom, {}, {
|
|
862
880
|
[ide_core_browser_1.ServiceNames.CONTEXT_KEY_SERVICE]: this.contextKeyService.contextKeyService,
|
|
@@ -868,12 +886,12 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
868
886
|
this.addDiffEditorEventListeners(this.diffEditor.modifiedEditor, 'modified');
|
|
869
887
|
this.eventBus.fire(new types_2.CodeEditorDidVisibleEvent({
|
|
870
888
|
groupName: this.name,
|
|
871
|
-
type:
|
|
889
|
+
type: types_2.EditorOpenType.diff,
|
|
872
890
|
editorId: this.diffEditor.modifiedEditor.getId(),
|
|
873
891
|
}));
|
|
874
892
|
this.eventBus.fire(new types_2.CodeEditorDidVisibleEvent({
|
|
875
893
|
groupName: this.name,
|
|
876
|
-
type:
|
|
894
|
+
type: types_2.EditorOpenType.diff,
|
|
877
895
|
editorId: this.diffEditor.originalEditor.getId(),
|
|
878
896
|
}));
|
|
879
897
|
this.diffEditorReady.ready();
|
|
@@ -881,7 +899,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
881
899
|
addDiffEditorEventListeners(editor, side) {
|
|
882
900
|
this.toDispose.push(editor.onSelectionsChanged((e) => {
|
|
883
901
|
var _a;
|
|
884
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
902
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
885
903
|
this.eventBus.fire(new types_2.EditorSelectionChangeEvent({
|
|
886
904
|
group: this,
|
|
887
905
|
resource: this.currentResource,
|
|
@@ -893,7 +911,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
893
911
|
}
|
|
894
912
|
}));
|
|
895
913
|
this.toDispose.push(editor.onVisibleRangesChanged((e) => {
|
|
896
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
914
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
897
915
|
this.eventBus.fire(new types_2.EditorVisibleChangeEvent({
|
|
898
916
|
group: this,
|
|
899
917
|
resource: this.currentResource,
|
|
@@ -903,7 +921,7 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
903
921
|
}
|
|
904
922
|
}));
|
|
905
923
|
this.toDispose.push(editor.onConfigurationChanged(() => {
|
|
906
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
924
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
907
925
|
this.eventBus.fire(new types_2.EditorConfigurationChangedEvent({
|
|
908
926
|
group: this,
|
|
909
927
|
resource: this.currentResource,
|
|
@@ -1142,161 +1160,220 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
1142
1160
|
this.holdDocumentModelRefs.delete(uri.toString());
|
|
1143
1161
|
}
|
|
1144
1162
|
}
|
|
1145
|
-
async
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1163
|
+
async openCodeEditor(resource, options) {
|
|
1164
|
+
const documentRef = await this.getDocumentModelRef(resource.uri);
|
|
1165
|
+
this.resolveTabChanged(resource, this.currentResource);
|
|
1166
|
+
await this.codeEditorReady.onceReady(async () => {
|
|
1167
|
+
var _a;
|
|
1168
|
+
await this.codeEditor.open(documentRef);
|
|
1169
|
+
if (options.range) {
|
|
1170
|
+
const range = new monaco.Range(options.range.startLineNumber, options.range.startColumn, options.range.endLineNumber, options.range.endColumn);
|
|
1171
|
+
// 这里使用 setTimeout 在下一次事件循环时将编辑器滚动到指定位置
|
|
1172
|
+
// 原因是在打开新文件的情况下
|
|
1173
|
+
// setModel 后立即调用 revealRangeInCenter 编辑器无法获取到 viewport 宽高
|
|
1174
|
+
// 导致无法正确计算滚动位置
|
|
1175
|
+
this.codeEditor.monacoEditor.setSelection(range);
|
|
1176
|
+
if (options.revealRangeInCenter) {
|
|
1177
|
+
setTimeout(() => {
|
|
1178
|
+
this.codeEditor.monacoEditor.revealRangeInCenter(range, 1);
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1156
1181
|
}
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1182
|
+
// 同上
|
|
1183
|
+
queueMicrotask(() => {
|
|
1184
|
+
if (options.scrollTop) {
|
|
1185
|
+
this.codeEditor.monacoEditor.setScrollTop(options.scrollTop);
|
|
1186
|
+
}
|
|
1187
|
+
if (options.scrollLeft) {
|
|
1188
|
+
this.codeEditor.monacoEditor.setScrollLeft(options.scrollLeft);
|
|
1189
|
+
}
|
|
1190
|
+
});
|
|
1191
|
+
if (options.focus) {
|
|
1192
|
+
(_a = this._domNode) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1193
|
+
// monaco 编辑器的 focus 多了一步检查,由于此时其实对应编辑器的 dom 的 display 为 none (需要等 React 下一次渲染才会改变为 block),
|
|
1194
|
+
// 会引起 document.activeElement !== editor.textArea.domNode,进而会导致focus失败
|
|
1195
|
+
// 需要等待真正 append 之后再
|
|
1196
|
+
const disposer = this.eventBus.on(types_2.CodeEditorDidVisibleEvent, (e) => {
|
|
1161
1197
|
var _a;
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
// setModel 后立即调用 revealRangeInCenter 编辑器无法获取到 viewport 宽高
|
|
1168
|
-
// 导致无法正确计算滚动位置
|
|
1169
|
-
this.codeEditor.monacoEditor.setSelection(range);
|
|
1170
|
-
if (options.revealRangeInCenter) {
|
|
1171
|
-
setTimeout(() => {
|
|
1172
|
-
this.codeEditor.monacoEditor.revealRangeInCenter(range, 1);
|
|
1173
|
-
});
|
|
1174
|
-
}
|
|
1175
|
-
}
|
|
1176
|
-
// 同上
|
|
1177
|
-
queueMicrotask(() => {
|
|
1178
|
-
if (options.scrollTop) {
|
|
1179
|
-
this.codeEditor.monacoEditor.setScrollTop(options.scrollTop);
|
|
1198
|
+
if (e.payload.groupName === this.name && e.payload.type === types_2.EditorOpenType.code) {
|
|
1199
|
+
disposer.dispose();
|
|
1200
|
+
// 此处必须多做一些检查以免不必要的 focus
|
|
1201
|
+
if (this.disposed) {
|
|
1202
|
+
return;
|
|
1180
1203
|
}
|
|
1181
|
-
if (
|
|
1182
|
-
|
|
1204
|
+
if (this !== this.workbenchEditorService.currentEditorGroup) {
|
|
1205
|
+
return;
|
|
1183
1206
|
}
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
// monaco 编辑器的 focus 多了一步检查,由于此时其实对应编辑器的 dom 的 display 为 none (需要等 React 下一次渲染才会改变为 block),
|
|
1188
|
-
// 会引起 document.activeElement !== editor.textArea.domNode,进而会导致focus失败
|
|
1189
|
-
// 需要等待真正 append 之后再
|
|
1190
|
-
const disposer = this.eventBus.on(types_2.CodeEditorDidVisibleEvent, (e) => {
|
|
1191
|
-
var _a;
|
|
1192
|
-
if (e.payload.groupName === this.name && e.payload.type === 'code') {
|
|
1193
|
-
disposer.dispose();
|
|
1194
|
-
// 此处必须多做一些检查以免不必要的 focus
|
|
1195
|
-
if (this.disposed) {
|
|
1196
|
-
return;
|
|
1197
|
-
}
|
|
1198
|
-
if (this !== this.workbenchEditorService.currentEditorGroup) {
|
|
1199
|
-
return;
|
|
1200
|
-
}
|
|
1201
|
-
if (this.currentEditor === this.codeEditor && ((_a = this.codeEditor.currentUri) === null || _a === void 0 ? void 0 : _a.isEqual(resource.uri))) {
|
|
1202
|
-
try {
|
|
1203
|
-
this.codeEditor.focus();
|
|
1204
|
-
}
|
|
1205
|
-
catch (e) {
|
|
1206
|
-
// noop
|
|
1207
|
-
}
|
|
1208
|
-
}
|
|
1207
|
+
if (this.currentEditor === this.codeEditor && ((_a = this.codeEditor.currentUri) === null || _a === void 0 ? void 0 : _a.isEqual(resource.uri))) {
|
|
1208
|
+
try {
|
|
1209
|
+
this.codeEditor.focus();
|
|
1209
1210
|
}
|
|
1210
|
-
|
|
1211
|
+
catch (e) {
|
|
1212
|
+
// noop
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1211
1215
|
}
|
|
1212
1216
|
});
|
|
1213
|
-
// 可能在diff Editor中修改导致为脏
|
|
1214
|
-
if (documentRef.instance.dirty) {
|
|
1215
|
-
this.pinPreviewed(resource.uri);
|
|
1216
|
-
}
|
|
1217
1217
|
}
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1218
|
+
});
|
|
1219
|
+
// 可能在diff Editor中修改导致为脏
|
|
1220
|
+
if (documentRef.instance.dirty) {
|
|
1221
|
+
this.pinPreviewed(resource.uri);
|
|
1222
|
+
}
|
|
1223
|
+
}
|
|
1224
|
+
async openDiffEditor(resource, options) {
|
|
1225
|
+
if (!this.diffEditor) {
|
|
1226
|
+
await this.diffEditorDomReady.onceReady(() => {
|
|
1227
|
+
var _a;
|
|
1228
|
+
const container = document.createElement('div');
|
|
1229
|
+
(_a = this._diffEditorDomNode) === null || _a === void 0 ? void 0 : _a.appendChild(container);
|
|
1230
|
+
this.createDiffEditor(container);
|
|
1231
|
+
});
|
|
1232
|
+
}
|
|
1233
|
+
const diffResource = resource;
|
|
1234
|
+
const [original, modified] = await Promise.all([
|
|
1235
|
+
this.getDocumentModelRef(diffResource.metadata.original),
|
|
1236
|
+
this.getDocumentModelRef(diffResource.metadata.modified),
|
|
1237
|
+
]);
|
|
1238
|
+
await this.diffEditorReady.onceReady(async () => {
|
|
1239
|
+
var _a;
|
|
1240
|
+
await this.diffEditor.compare(original, modified, options, resource.uri);
|
|
1241
|
+
if (options.focus) {
|
|
1242
|
+
(_a = this._domNode) === null || _a === void 0 ? void 0 : _a.focus();
|
|
1243
|
+
// 理由见上方 codeEditor.focus 部分
|
|
1244
|
+
const disposer = this.eventBus.on(types_2.CodeEditorDidVisibleEvent, (e) => {
|
|
1245
|
+
if (e.payload.groupName === this.name && e.payload.type === types_2.EditorOpenType.diff) {
|
|
1246
|
+
disposer.dispose();
|
|
1247
|
+
if (this.disposed) {
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
if (this !== this.workbenchEditorService.currentEditorGroup) {
|
|
1251
|
+
return;
|
|
1252
|
+
}
|
|
1253
|
+
if (this.currentEditor === this.diffEditor.modifiedEditor) {
|
|
1254
|
+
try {
|
|
1255
|
+
this.diffEditor.focus();
|
|
1247
1256
|
}
|
|
1248
|
-
|
|
1257
|
+
catch (e) {
|
|
1258
|
+
// noop
|
|
1259
|
+
}
|
|
1260
|
+
}
|
|
1249
1261
|
}
|
|
1250
1262
|
});
|
|
1251
1263
|
}
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1264
|
+
});
|
|
1265
|
+
}
|
|
1266
|
+
async openMergeEditor(resource) {
|
|
1267
|
+
const { metadata } = resource;
|
|
1268
|
+
if (!metadata) {
|
|
1269
|
+
return;
|
|
1270
|
+
}
|
|
1271
|
+
if (!this.mergeEditor) {
|
|
1272
|
+
await this.mergeEditorDomReady.onceReady(() => {
|
|
1273
|
+
var _a;
|
|
1274
|
+
const container = document.createElement('div');
|
|
1275
|
+
(_a = this._mergeEditorDomNode) === null || _a === void 0 ? void 0 : _a.appendChild(container);
|
|
1276
|
+
this.createMergeEditor(container);
|
|
1277
|
+
});
|
|
1278
|
+
}
|
|
1279
|
+
const { ancestor, input1, input2, output } = metadata;
|
|
1280
|
+
const input1Data = merge_editor_widget_1.MergeEditorInputData.from(input1);
|
|
1281
|
+
const input2Data = merge_editor_widget_1.MergeEditorInputData.from(input2);
|
|
1282
|
+
const [ancestorRef, input1Ref, outputRef, input2Ref] = await Promise.all([
|
|
1283
|
+
this.getDocumentModelRef(ide_core_common_2.URI.parse(ancestor)),
|
|
1284
|
+
this.getDocumentModelRef(input1Data.uri),
|
|
1285
|
+
this.getDocumentModelRef(ide_core_common_2.URI.parse(output)),
|
|
1286
|
+
this.getDocumentModelRef(input2Data.uri),
|
|
1287
|
+
]);
|
|
1288
|
+
await this.mergeEditorReady.onceReady(async () => {
|
|
1289
|
+
await this.mergeEditor.open({
|
|
1290
|
+
ancestor: {
|
|
1291
|
+
uri: ide_core_common_2.URI.parse(metadata.ancestor),
|
|
1292
|
+
textModel: ancestorRef.instance.getMonacoModel(),
|
|
1293
|
+
},
|
|
1294
|
+
input1: input1Data.setTextModel(input1Ref.instance.getMonacoModel()),
|
|
1295
|
+
input2: input2Data.setTextModel(input2Ref.instance.getMonacoModel()),
|
|
1296
|
+
output: {
|
|
1297
|
+
uri: ide_core_common_2.URI.parse(metadata.output),
|
|
1298
|
+
textModel: outputRef.instance.getMonacoModel(),
|
|
1299
|
+
},
|
|
1300
|
+
});
|
|
1301
|
+
});
|
|
1302
|
+
}
|
|
1303
|
+
async openCustomEditor(resource, componentId) {
|
|
1304
|
+
const component = this.editorComponentRegistry.getEditorComponent(componentId);
|
|
1305
|
+
const initialProps = this.editorComponentRegistry.getEditorInitialProps(componentId);
|
|
1306
|
+
if (!component) {
|
|
1307
|
+
throw new Error('Cannot find Editor Component with id: ' + componentId);
|
|
1308
|
+
}
|
|
1309
|
+
else {
|
|
1310
|
+
this.activateComponentsProps.set(component, initialProps);
|
|
1311
|
+
if (component.renderMode === types_2.EditorComponentRenderMode.ONE_PER_RESOURCE) {
|
|
1312
|
+
const openedResources = this.activeComponents.get(component) || [];
|
|
1313
|
+
const index = openedResources.findIndex((r) => r.uri.toString() === resource.uri.toString());
|
|
1314
|
+
if (index === -1) {
|
|
1315
|
+
openedResources.push(resource);
|
|
1257
1316
|
}
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
else if (component.renderMode === types_2.EditorComponentRenderMode.ONE_PER_GROUP) {
|
|
1269
|
-
this.activeComponents.set(component, [resource]);
|
|
1317
|
+
this.activeComponents.set(component, openedResources);
|
|
1318
|
+
}
|
|
1319
|
+
else if (component.renderMode === types_2.EditorComponentRenderMode.ONE_PER_GROUP) {
|
|
1320
|
+
this.activeComponents.set(component, [resource]);
|
|
1321
|
+
}
|
|
1322
|
+
else if (component.renderMode === types_2.EditorComponentRenderMode.ONE_PER_WORKBENCH) {
|
|
1323
|
+
const promises = [];
|
|
1324
|
+
this.workbenchEditorService.editorGroups.forEach((g) => {
|
|
1325
|
+
if (g === this) {
|
|
1326
|
+
return;
|
|
1270
1327
|
}
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
if (g === this) {
|
|
1275
|
-
return;
|
|
1276
|
-
}
|
|
1277
|
-
const r = g.resources.find((r) => r.uri.isEqual(resource.uri));
|
|
1278
|
-
if (r) {
|
|
1279
|
-
promises.push(g.close(r.uri));
|
|
1280
|
-
}
|
|
1281
|
-
});
|
|
1282
|
-
await Promise.all(promises).catch((0, ide_core_common_2.getDebugLogger)().error);
|
|
1283
|
-
this.activeComponents.set(component, [resource]);
|
|
1328
|
+
const r = g.resources.find((r) => r.uri.isEqual(resource.uri));
|
|
1329
|
+
if (r) {
|
|
1330
|
+
promises.push(g.close(r.uri));
|
|
1284
1331
|
}
|
|
1285
|
-
}
|
|
1286
|
-
// 打开非编辑器的component时需要手动触发
|
|
1287
|
-
this._onCurrentEditorCursorChange.fire({
|
|
1288
|
-
position: null,
|
|
1289
|
-
selectionLength: 0,
|
|
1290
1332
|
});
|
|
1333
|
+
await Promise.all(promises).catch((0, ide_core_common_2.getDebugLogger)().error);
|
|
1334
|
+
this.activeComponents.set(component, [resource]);
|
|
1291
1335
|
}
|
|
1292
|
-
|
|
1293
|
-
|
|
1336
|
+
}
|
|
1337
|
+
// 打开非编辑器的component时需要手动触发
|
|
1338
|
+
this._onCurrentEditorCursorChange.fire({
|
|
1339
|
+
position: null,
|
|
1340
|
+
selectionLength: 0,
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
async displayResourceComponent(resource, options) {
|
|
1344
|
+
if (options.revealRangeInCenter === undefined) {
|
|
1345
|
+
options.revealRangeInCenter = true;
|
|
1346
|
+
}
|
|
1347
|
+
const _resource = resource;
|
|
1348
|
+
const result = await this.resolveOpenType(resource, options);
|
|
1349
|
+
if (result) {
|
|
1350
|
+
const { activeOpenType, openTypes } = result;
|
|
1351
|
+
this.availableOpenTypes = openTypes;
|
|
1352
|
+
if (options.preserveFocus) {
|
|
1353
|
+
options.focus = false;
|
|
1354
|
+
}
|
|
1355
|
+
switch (activeOpenType.type) {
|
|
1356
|
+
case types_2.EditorOpenType.code:
|
|
1357
|
+
await this.openCodeEditor(resource, options);
|
|
1358
|
+
break;
|
|
1359
|
+
case types_2.EditorOpenType.diff:
|
|
1360
|
+
await this.openDiffEditor(resource, options);
|
|
1361
|
+
break;
|
|
1362
|
+
case types_2.EditorOpenType.mergeEditor:
|
|
1363
|
+
await this.openMergeEditor(resource);
|
|
1364
|
+
break;
|
|
1365
|
+
case types_2.EditorOpenType.component:
|
|
1366
|
+
await this.openCustomEditor(resource, activeOpenType.componentId);
|
|
1367
|
+
break;
|
|
1368
|
+
default:
|
|
1369
|
+
return;
|
|
1294
1370
|
}
|
|
1295
1371
|
this.resolveTabChanged(_resource, this.currentResource);
|
|
1296
1372
|
this._currentOpenType = activeOpenType;
|
|
1297
1373
|
this.notifyBodyChanged();
|
|
1298
|
-
if ((this._codeEditorPendingLayout && activeOpenType.type ===
|
|
1299
|
-
(this._diffEditorPendingLayout && activeOpenType.type ===
|
|
1374
|
+
if ((!this._codeEditorPendingLayout && activeOpenType.type === types_2.EditorOpenType.code) ||
|
|
1375
|
+
(!this._diffEditorPendingLayout && activeOpenType.type === types_2.EditorOpenType.diff) ||
|
|
1376
|
+
(!this._mergeEditorPendingLayout && activeOpenType.type === types_2.EditorOpenType.mergeEditor)) {
|
|
1300
1377
|
this.doLayoutEditors();
|
|
1301
1378
|
}
|
|
1302
1379
|
this.cachedResourcesActiveOpenTypes.set(resource.uri.toString(), activeOpenType);
|
|
@@ -1599,10 +1676,10 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
1599
1676
|
}
|
|
1600
1677
|
focus() {
|
|
1601
1678
|
this.gainFocus();
|
|
1602
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
1679
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.code) {
|
|
1603
1680
|
this.codeEditor.focus();
|
|
1604
1681
|
}
|
|
1605
|
-
if (this.currentOpenType && this.currentOpenType.type ===
|
|
1682
|
+
if (this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.diff) {
|
|
1606
1683
|
this.diffEditor.focus();
|
|
1607
1684
|
}
|
|
1608
1685
|
}
|
|
@@ -1627,13 +1704,13 @@ let EditorGroup = class EditorGroup extends ide_core_common_2.WithEventBus {
|
|
|
1627
1704
|
};
|
|
1628
1705
|
}
|
|
1629
1706
|
isCodeEditorMode() {
|
|
1630
|
-
return !!this.currentOpenType && this.currentOpenType.type ===
|
|
1707
|
+
return !!this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.code;
|
|
1631
1708
|
}
|
|
1632
1709
|
isDiffEditorMode() {
|
|
1633
|
-
return !!this.currentOpenType && this.currentOpenType.type ===
|
|
1710
|
+
return !!this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.diff;
|
|
1634
1711
|
}
|
|
1635
1712
|
isComponentMode() {
|
|
1636
|
-
return !!this.currentOpenType && this.currentOpenType.type ===
|
|
1713
|
+
return !!this.currentOpenType && this.currentOpenType.type === types_2.EditorOpenType.component;
|
|
1637
1714
|
}
|
|
1638
1715
|
async restoreState(state) {
|
|
1639
1716
|
this._restoringState = true;
|
|
@@ -1824,6 +1901,12 @@ tslib_1.__decorate([
|
|
|
1824
1901
|
mobx_1.observable.shallow,
|
|
1825
1902
|
tslib_1.__metadata("design:type", Array)
|
|
1826
1903
|
], EditorGroup.prototype, "availableOpenTypes", void 0);
|
|
1904
|
+
tslib_1.__decorate([
|
|
1905
|
+
(0, ide_core_common_1.debounce)(100),
|
|
1906
|
+
tslib_1.__metadata("design:type", Function),
|
|
1907
|
+
tslib_1.__metadata("design:paramtypes", []),
|
|
1908
|
+
tslib_1.__metadata("design:returntype", void 0)
|
|
1909
|
+
], EditorGroup.prototype, "doLayoutEditors", null);
|
|
1827
1910
|
tslib_1.__decorate([
|
|
1828
1911
|
(0, ide_core_common_2.OnEvent)(common_1.ResourceDecorationChangeEvent),
|
|
1829
1912
|
tslib_1.__metadata("design:type", Function),
|
|
@@ -1871,6 +1954,6 @@ function findSuitableOpenType(currentAvailable, prev, resource, editorAssociatio
|
|
|
1871
1954
|
return currentAvailable[0];
|
|
1872
1955
|
}
|
|
1873
1956
|
function openTypeSimilar(a, b) {
|
|
1874
|
-
return a.type === b.type && (a.type !==
|
|
1957
|
+
return a.type === b.type && (a.type !== types_2.EditorOpenType.component || a.componentId === b.componentId);
|
|
1875
1958
|
}
|
|
1876
1959
|
//# sourceMappingURL=workbench-editor.service.js.map
|