@opensumi/ide-editor 2.27.3-next-1711421139.0 → 2.27.3-next-1711507853.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/decoration-applier.d.ts +1 -1
- package/lib/browser/decoration-applier.d.ts.map +1 -1
- package/lib/browser/decoration-applier.js +1 -0
- package/lib/browser/decoration-applier.js.map +1 -1
- package/lib/browser/diff/compare.d.ts +1 -2
- package/lib/browser/diff/compare.d.ts.map +1 -1
- package/lib/browser/diff/compare.js +4 -26
- package/lib/browser/diff/compare.js.map +1 -1
- package/lib/browser/doc-model/editor-document-model.d.ts.map +1 -1
- package/lib/browser/doc-model/editor-document-model.js +1 -1
- package/lib/browser/doc-model/editor-document-model.js.map +1 -1
- package/lib/browser/doc-model/override.d.ts +1 -1
- package/lib/browser/doc-model/override.d.ts.map +1 -1
- package/lib/browser/doc-model/saveParticipants.d.ts.map +1 -1
- package/lib/browser/doc-model/saveParticipants.js +2 -2
- 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 +5 -6
- package/lib/browser/editor-collection.service.d.ts.map +1 -1
- package/lib/browser/editor-collection.service.js +4 -10
- package/lib/browser/editor-collection.service.js.map +1 -1
- package/lib/browser/editor.contribution.d.ts +0 -2
- package/lib/browser/editor.contribution.d.ts.map +1 -1
- package/lib/browser/editor.contribution.js +1 -35
- package/lib/browser/editor.contribution.js.map +1 -1
- package/lib/browser/editor.decoration.service.d.ts +1 -1
- package/lib/browser/editor.decoration.service.d.ts.map +1 -1
- package/lib/browser/editor.decoration.service.js.map +1 -1
- package/lib/browser/editor.module.less +3 -49
- package/lib/browser/editor.override.d.ts +2 -2
- package/lib/browser/editor.override.d.ts.map +1 -1
- package/lib/browser/editor.override.js +11 -8
- package/lib/browser/editor.override.js.map +1 -1
- package/lib/browser/feature.d.ts +1 -1
- package/lib/browser/format/formatterSelect.d.ts +1 -1
- package/lib/browser/format/formatterSelect.d.ts.map +1 -1
- package/lib/browser/format/formatterSelect.js.map +1 -1
- package/lib/browser/language/diagnostic-collection.d.ts +3 -4
- package/lib/browser/language/diagnostic-collection.d.ts.map +1 -1
- package/lib/browser/language/diagnostic-collection.js +6 -5
- package/lib/browser/language/diagnostic-collection.js.map +1 -1
- package/lib/browser/language/language.service.d.ts +1 -1
- package/lib/browser/language/language.service.d.ts.map +1 -1
- package/lib/browser/language/language.service.js.map +1 -1
- package/lib/browser/menu/editor.context.d.ts.map +1 -1
- package/lib/browser/menu/editor.context.js +1 -1
- package/lib/browser/menu/editor.context.js.map +1 -1
- package/lib/browser/merge-editor/MergeEditorFloatComponents.d.ts.map +1 -1
- package/lib/browser/merge-editor/MergeEditorFloatComponents.js +1 -60
- package/lib/browser/merge-editor/MergeEditorFloatComponents.js.map +1 -1
- package/lib/browser/merge-editor/merge-editor.contribution.d.ts +1 -0
- package/lib/browser/merge-editor/merge-editor.contribution.d.ts.map +1 -1
- package/lib/browser/merge-editor/merge-editor.contribution.js +6 -2
- package/lib/browser/merge-editor/merge-editor.contribution.js.map +1 -1
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.d.ts +3 -1
- package/lib/browser/monaco-contrib/callHierarchy/callHierarchy.service.d.ts.map +1 -1
- 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 +1 -1
- package/lib/browser/monaco-contrib/command/command.service.js.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate-tokenizer.d.ts +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate-tokenizer.d.ts.map +1 -1
- package/lib/browser/monaco-contrib/tokenizer/textmate-tokenizer.js.map +1 -1
- package/lib/browser/preference/converter.d.ts.map +1 -1
- package/lib/browser/preference/converter.js +2 -70
- package/lib/browser/preference/converter.js.map +1 -1
- package/lib/browser/preference/schema.d.ts +0 -18
- package/lib/browser/preference/schema.d.ts.map +1 -1
- package/lib/browser/preference/schema.js +19 -86
- package/lib/browser/preference/schema.js.map +1 -1
- package/lib/browser/quick-open/go-to-line.d.ts +1 -1
- package/lib/browser/quick-open/go-to-line.d.ts.map +1 -1
- package/lib/browser/quick-open/go-to-line.js +1 -1
- package/lib/browser/quick-open/go-to-line.js.map +1 -1
- package/lib/browser/types.d.ts +1 -1
- package/lib/browser/types.d.ts.map +1 -1
- package/lib/browser/workbench-editor.service.d.ts.map +1 -1
- package/lib/browser/workbench-editor.service.js +1 -4
- package/lib/browser/workbench-editor.service.js.map +1 -1
- package/lib/common/language.d.ts +1 -1
- package/lib/common/language.d.ts.map +1 -1
- package/lib/common/language.js.map +1 -1
- package/package.json +14 -14
- package/src/browser/decoration-applier.ts +2 -1
- package/src/browser/diff/compare.ts +21 -38
- package/src/browser/doc-model/editor-document-model.ts +1 -2
- package/src/browser/doc-model/override.ts +1 -1
- package/src/browser/doc-model/saveParticipants.ts +5 -3
- package/src/browser/doc-model/types.ts +1 -1
- package/src/browser/editor-collection.service.ts +6 -10
- package/src/browser/editor.contribution.ts +1 -37
- package/src/browser/editor.decoration.service.ts +1 -1
- package/src/browser/editor.module.less +3 -49
- package/src/browser/editor.override.ts +13 -10
- package/src/browser/format/formatterSelect.ts +3 -3
- package/src/browser/language/diagnostic-collection.ts +10 -8
- package/src/browser/language/language.service.ts +1 -1
- package/src/browser/menu/editor.context.ts +1 -1
- package/src/browser/merge-editor/MergeEditorFloatComponents.tsx +4 -101
- package/src/browser/merge-editor/merge-editor.contribution.ts +8 -4
- package/src/browser/monaco-contrib/callHierarchy/callHierarchy.service.ts +2 -1
- package/src/browser/monaco-contrib/command/command.service.ts +2 -2
- package/src/browser/monaco-contrib/tokenizer/textmate-tokenizer.ts +1 -1
- package/src/browser/preference/converter.ts +4 -76
- package/src/browser/preference/schema.ts +18 -93
- package/src/browser/quick-open/go-to-line.ts +1 -1
- package/src/browser/types.ts +1 -1
- package/src/browser/view/topPadding.ts +1 -1
- package/src/browser/workbench-editor.service.ts +1 -3
- package/src/common/language.ts +1 -1
|
@@ -4,7 +4,6 @@ import { Autowired, Injectable } from '@opensumi/di';
|
|
|
4
4
|
import {
|
|
5
5
|
CommandService,
|
|
6
6
|
Disposable,
|
|
7
|
-
EDITOR_COMMANDS,
|
|
8
7
|
Emitter,
|
|
9
8
|
IEventBus,
|
|
10
9
|
ILogger,
|
|
@@ -687,7 +686,7 @@ export class EditorDocumentModel extends Disposable implements IEditorDocumentMo
|
|
|
687
686
|
reject(err);
|
|
688
687
|
}, formatOnSaveTimeout);
|
|
689
688
|
}),
|
|
690
|
-
this.commandService.executeCommand(
|
|
689
|
+
this.commandService.executeCommand('editor.action.formatDocument'),
|
|
691
690
|
]);
|
|
692
691
|
} catch (err) {
|
|
693
692
|
if (err.name === 'FormatOnSaveTimeoutError') {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/* istanbul ignore file */
|
|
2
2
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
3
3
|
import { URI } from '@opensumi/ide-core-browser';
|
|
4
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
5
4
|
import {
|
|
6
5
|
ITextModelContentProvider,
|
|
7
6
|
ITextModelService,
|
|
8
7
|
} from '@opensumi/monaco-editor-core/esm/vs/editor/common/services/resolverService';
|
|
8
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
9
9
|
|
|
10
10
|
import { IEditorDocumentModelService } from './types';
|
|
11
11
|
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
formatLocalize,
|
|
16
16
|
} from '@opensumi/ide-core-browser';
|
|
17
17
|
import { IProgressService } from '@opensumi/ide-core-browser/lib/progress';
|
|
18
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
19
18
|
import { ResourceEdit } from '@opensumi/ide-monaco/lib/browser/monaco-api';
|
|
20
19
|
import { languageFeaturesService } from '@opensumi/ide-monaco/lib/browser/monaco-api/languages';
|
|
21
20
|
import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
@@ -26,12 +25,15 @@ import { EditOperation } from '@opensumi/monaco-editor-core/esm/vs/editor/common
|
|
|
26
25
|
import { Range } from '@opensumi/monaco-editor-core/esm/vs/editor/common/core/range';
|
|
27
26
|
import * as languages from '@opensumi/monaco-editor-core/esm/vs/editor/common/languages';
|
|
28
27
|
import { CodeActionProvider } from '@opensumi/monaco-editor-core/esm/vs/editor/common/languages';
|
|
29
|
-
import { getCodeActions } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/browser/codeAction';
|
|
30
28
|
import {
|
|
31
29
|
CodeActionItem,
|
|
30
|
+
getCodeActions,
|
|
31
|
+
} from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/browser/codeAction';
|
|
32
|
+
import {
|
|
32
33
|
CodeActionKind,
|
|
33
34
|
CodeActionTriggerSource,
|
|
34
|
-
} from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/
|
|
35
|
+
} from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/codeAction/browser/types';
|
|
36
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
35
37
|
|
|
36
38
|
import { MonacoCodeService } from '../editor.override';
|
|
37
39
|
import { SaveReason } from '../types';
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
MaybePromise,
|
|
9
9
|
URI,
|
|
10
10
|
} from '@opensumi/ide-core-browser';
|
|
11
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
12
11
|
import { EOL, EndOfLineSequence } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
12
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
13
13
|
|
|
14
14
|
import { IEditorDocumentModelContentChange, SaveReason } from '../../common';
|
|
15
15
|
import { IEditorDocumentModel, IEditorDocumentModelRef } from '../../common/editor';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Autowired, INJECTOR_TOKEN, Injectable, Injector } from '@opensumi/di';
|
|
2
|
-
import { IContextKeyService, IRange
|
|
2
|
+
import { IContextKeyService, IRange } from '@opensumi/ide-core-browser';
|
|
3
3
|
import { ResourceContextKey } from '@opensumi/ide-core-browser/lib/contextkey';
|
|
4
4
|
import { MonacoService } from '@opensumi/ide-core-browser/lib/monaco';
|
|
5
5
|
import {
|
|
@@ -14,7 +14,7 @@ import {
|
|
|
14
14
|
isEmptyObject,
|
|
15
15
|
objects,
|
|
16
16
|
} from '@opensumi/ide-core-common';
|
|
17
|
-
import * as monaco from '@opensumi/
|
|
17
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
18
18
|
import { IConfigurationService } from '@opensumi/monaco-editor-core/esm/vs/platform/configuration/common/configuration';
|
|
19
19
|
|
|
20
20
|
import {
|
|
@@ -283,7 +283,7 @@ export abstract class BaseMonacoEditorWrapper extends WithEventBus implements IE
|
|
|
283
283
|
);
|
|
284
284
|
this.addDispose(
|
|
285
285
|
this.configurationService.onDidChangeConfiguration((e) => {
|
|
286
|
-
const changedEditorKeys =
|
|
286
|
+
const changedEditorKeys = e.affectedKeys.filter((key) => isEditorOption(key));
|
|
287
287
|
if (changedEditorKeys.length > 0) {
|
|
288
288
|
this._doUpdateOptions();
|
|
289
289
|
}
|
|
@@ -585,9 +585,6 @@ export class BrowserDiffEditor extends WithEventBus implements IDiffEditor {
|
|
|
585
585
|
@Autowired(IConfigurationService)
|
|
586
586
|
protected readonly configurationService: IConfigurationService;
|
|
587
587
|
|
|
588
|
-
@Autowired(PreferenceService)
|
|
589
|
-
protected readonly preferenceService: PreferenceService;
|
|
590
|
-
|
|
591
588
|
@Autowired(IContextKeyService)
|
|
592
589
|
protected readonly contextKeyService: IContextKeyService;
|
|
593
590
|
|
|
@@ -620,7 +617,7 @@ export class BrowserDiffEditor extends WithEventBus implements IDiffEditor {
|
|
|
620
617
|
this.wrapEditors();
|
|
621
618
|
this.addDispose(
|
|
622
619
|
this.configurationService.onDidChangeConfiguration((e) => {
|
|
623
|
-
const changedEditorKeys =
|
|
620
|
+
const changedEditorKeys = e.affectedKeys.filter((key) => isDiffEditorOption(key));
|
|
624
621
|
if (changedEditorKeys.length > 0) {
|
|
625
622
|
this.doUpdateDiffOptions();
|
|
626
623
|
}
|
|
@@ -681,9 +678,8 @@ export class BrowserDiffEditor extends WithEventBus implements IDiffEditor {
|
|
|
681
678
|
} else {
|
|
682
679
|
this.restoreState();
|
|
683
680
|
}
|
|
684
|
-
|
|
685
|
-
if (options.revealFirstDiff
|
|
686
|
-
// 仅在非折叠模式下自动滚动到第一个 Diff
|
|
681
|
+
|
|
682
|
+
if (options.revealFirstDiff) {
|
|
687
683
|
const diffs = this.monacoDiffEditor.getLineChanges();
|
|
688
684
|
if (diffs && diffs.length > 0) {
|
|
689
685
|
this.showFirstDiff();
|
|
@@ -16,7 +16,6 @@ import {
|
|
|
16
16
|
IEventBus,
|
|
17
17
|
IOpenerService,
|
|
18
18
|
IPreferenceSettingsService,
|
|
19
|
-
IQuickInputService,
|
|
20
19
|
IQuickOpenHandlerRegistry,
|
|
21
20
|
KeybindingContribution,
|
|
22
21
|
KeybindingRegistry,
|
|
@@ -46,8 +45,8 @@ import { ILogger, PreferenceScope, isWindows } from '@opensumi/ide-core-common';
|
|
|
46
45
|
import { MergeEditorService } from '@opensumi/ide-monaco/lib/browser/contrib/merge-editor/merge-editor.service';
|
|
47
46
|
import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer';
|
|
48
47
|
import { EOL } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
49
|
-
import * as monaco from '@opensumi/ide-monaco/lib/common/common';
|
|
50
48
|
import { EditorContextKeys } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorContextKeys';
|
|
49
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
51
50
|
import { ContextKeyExpr } from '@opensumi/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
52
51
|
import { SyncDescriptor } from '@opensumi/monaco-editor-core/esm/vs/platform/instantiation/common/descriptors';
|
|
53
52
|
|
|
@@ -173,12 +172,6 @@ export class EditorContribution
|
|
|
173
172
|
@Autowired(IEditorDocumentModelContentRegistry)
|
|
174
173
|
contentRegistry: IEditorDocumentModelContentRegistry;
|
|
175
174
|
|
|
176
|
-
@Autowired(IQuickInputService)
|
|
177
|
-
private readonly quickInputService: IQuickInputService;
|
|
178
|
-
|
|
179
|
-
@Autowired(CommandService)
|
|
180
|
-
private readonly commandService: CommandService;
|
|
181
|
-
|
|
182
175
|
registerComponent(registry: ComponentRegistry) {
|
|
183
176
|
registry.register('@opensumi/ide-editor', {
|
|
184
177
|
id: 'ide-editor',
|
|
@@ -509,35 +502,6 @@ export class EditorContribution
|
|
|
509
502
|
},
|
|
510
503
|
});
|
|
511
504
|
|
|
512
|
-
commands.registerCommand(EDITOR_COMMANDS.OPEN_MERGEEDITOR_DEV, {
|
|
513
|
-
execute: async () => {
|
|
514
|
-
try {
|
|
515
|
-
const value = await this.quickInputService.open({ value: '' });
|
|
516
|
-
if (!value) {
|
|
517
|
-
return;
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
const toArgs = JSON.parse(value);
|
|
521
|
-
|
|
522
|
-
/**
|
|
523
|
-
* @example
|
|
524
|
-
* {
|
|
525
|
-
* input1: {
|
|
526
|
-
* uri: 'current 分支的 uri'
|
|
527
|
-
* },
|
|
528
|
-
* input2: {
|
|
529
|
-
* uri: 'incoming 分支的 uri'
|
|
530
|
-
* },
|
|
531
|
-
* output: '中间视图的文件 uri',
|
|
532
|
-
* base: '共同祖先分支的文件 uri'
|
|
533
|
-
* }
|
|
534
|
-
*/
|
|
535
|
-
|
|
536
|
-
this.commandService.executeCommand(EDITOR_COMMANDS.OPEN_MERGEEDITOR.id, toArgs);
|
|
537
|
-
} catch (error) {}
|
|
538
|
-
},
|
|
539
|
-
});
|
|
540
|
-
|
|
541
505
|
commands.registerCommand(EDITOR_COMMANDS.OPEN_MERGEEDITOR, {
|
|
542
506
|
execute: (args: unknown) => {
|
|
543
507
|
const validatedArgs = IRelaxedOpenMergeEditorArgs.validate(args);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
2
2
|
import { Disposable, IDisposable, IEventBus, URI } from '@opensumi/ide-core-browser';
|
|
3
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
4
3
|
import { IIconService, IThemeService } from '@opensumi/ide-theme';
|
|
5
4
|
import { ICSSStyleService } from '@opensumi/ide-theme/lib/common/style';
|
|
5
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
6
6
|
|
|
7
7
|
import { IContentDecorationRenderOptions, IDecorationRenderOptions, IThemeDecorationRenderOptions } from '../common';
|
|
8
8
|
|
|
@@ -571,54 +571,8 @@
|
|
|
571
571
|
|
|
572
572
|
// -------------- styles for merge editor component starts --------------
|
|
573
573
|
.merge_editor_float_container {
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
padding: 16px 28px;
|
|
578
|
-
justify-content: end;
|
|
579
|
-
white-space: nowrap;
|
|
580
|
-
.merge_conflict_bottom_btn {
|
|
581
|
-
border: 1px solid var(--kt-button-disableForeground);
|
|
582
|
-
border-radius: 8px;
|
|
583
|
-
padding: 5px 16px;
|
|
584
|
-
background: var(--editor-background);
|
|
585
|
-
margin: 0 4px;
|
|
586
|
-
line-height: 22px;
|
|
587
|
-
justify-content: end;
|
|
588
|
-
white-space: nowrap;
|
|
589
|
-
cursor: pointer;
|
|
590
|
-
:global {
|
|
591
|
-
.kt-icon {
|
|
592
|
-
font-size: 12px;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
:first-child {
|
|
596
|
-
margin-right: 8px;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
.magic_btn {
|
|
601
|
-
background-image: radial-gradient(circle at -21% -22%, #19cfff, #8429ff);
|
|
602
|
-
border: none;
|
|
603
|
-
font-weight: 500;
|
|
604
|
-
span {
|
|
605
|
-
color: #fff;
|
|
606
|
-
}
|
|
607
|
-
:global {
|
|
608
|
-
.kt-icon {
|
|
609
|
-
color: #fff;
|
|
610
|
-
font-size: 12px;
|
|
611
|
-
margin-right: 8px;
|
|
612
|
-
}
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
.line_vertical {
|
|
617
|
-
background-color: var(--design-border-color-common);
|
|
618
|
-
width: 1px;
|
|
619
|
-
min-width: 1px;
|
|
620
|
-
height: 24px;
|
|
621
|
-
margin: 4px;
|
|
622
|
-
}
|
|
574
|
+
position: absolute;
|
|
575
|
+
right: 50px;
|
|
576
|
+
bottom: 30px;
|
|
623
577
|
}
|
|
624
578
|
// -------------- styles for merge editor component ends --------------
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
2
2
|
import { PreferenceService } from '@opensumi/ide-core-browser';
|
|
3
3
|
import { IRange, URI } from '@opensumi/ide-core-common';
|
|
4
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
5
|
-
import { isEqual } from '@opensumi/monaco-editor-core/esm/vs/base/common/resources';
|
|
6
4
|
import { AbstractCodeEditorService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/abstractCodeEditorService';
|
|
7
5
|
import { ICodeEditorService } from '@opensumi/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
6
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
8
7
|
import { EditorScopedLayoutService } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneLayoutService';
|
|
9
8
|
import { StandaloneServices } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
10
9
|
import { IStandaloneThemeService } from '@opensumi/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
11
10
|
import { ContextViewService } from '@opensumi/monaco-editor-core/esm/vs/platform/contextview/browser/contextViewService';
|
|
12
|
-
import { IResourceEditorInput } from '@opensumi/monaco-editor-core/esm/vs/platform/editor/common/editor';
|
|
13
11
|
|
|
14
12
|
/* istanbul ignore file */
|
|
15
13
|
import { EditorOpenType, WorkbenchEditorService } from '../common';
|
|
@@ -46,17 +44,22 @@ export class MonacoCodeService extends AbstractCodeEditorService {
|
|
|
46
44
|
* @param sideBySide ?
|
|
47
45
|
*/
|
|
48
46
|
async openCodeEditor(
|
|
49
|
-
|
|
47
|
+
// @ts-ignore
|
|
48
|
+
input: monaco.editor.IResourceInput,
|
|
50
49
|
source: IMonacoCodeEditor | null,
|
|
51
50
|
sideBySide?: boolean,
|
|
52
51
|
): Promise<IMonacoCodeEditor | null> {
|
|
53
|
-
const resourceUri = input.resource;
|
|
52
|
+
const resourceUri = new URI(input.resource.toString());
|
|
54
53
|
// 判断打开下一个不同于当前编辑器的文件时,是否需要先固定当前编辑器Tab,从而避免被替换,例如:跳转到定义
|
|
55
54
|
const enablePreviewFromCodeNavigation = this.preferenceService.get<boolean>(
|
|
56
55
|
'editor.enablePreviewFromCodeNavigation',
|
|
57
56
|
);
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
if (
|
|
58
|
+
!enablePreviewFromCodeNavigation &&
|
|
59
|
+
source &&
|
|
60
|
+
!sideBySide &&
|
|
61
|
+
!new URI(source.getModel()?.uri).isEqual(input.resource)
|
|
62
|
+
) {
|
|
60
63
|
for (const visibleGroup of this.workbenchEditorService.editorGroups) {
|
|
61
64
|
if (visibleGroup.currentOpenType?.type === EditorOpenType.code) {
|
|
62
65
|
if (visibleGroup.currentEditor?.monacoEditor === source) {
|
|
@@ -88,7 +91,6 @@ export class MonacoCodeService extends AbstractCodeEditorService {
|
|
|
88
91
|
index++;
|
|
89
92
|
}
|
|
90
93
|
}
|
|
91
|
-
// @ts-ignore
|
|
92
94
|
const selection = input.options ? input.options.selection : null;
|
|
93
95
|
let range;
|
|
94
96
|
if (selection) {
|
|
@@ -103,12 +105,13 @@ export class MonacoCodeService extends AbstractCodeEditorService {
|
|
|
103
105
|
);
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
|
-
|
|
107
|
-
await editorGroup.open(openUri, { index, range: range as IRange, focus: true });
|
|
108
|
+
await editorGroup.open(resourceUri, { index, range: range as IRange, focus: true });
|
|
108
109
|
return (editorGroup.codeEditor as BrowserCodeEditor).monacoEditor;
|
|
109
110
|
}
|
|
110
111
|
}
|
|
111
112
|
|
|
113
|
+
// @ts-ignore
|
|
114
|
+
|
|
112
115
|
export class MonacoContextViewService extends ContextViewService {
|
|
113
116
|
private menuContainer: HTMLDivElement;
|
|
114
117
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Autowired, Injectable } from '@opensumi/di';
|
|
2
2
|
import { PreferenceScope, PreferenceService, QuickPickService, URI, localize } from '@opensumi/ide-core-browser';
|
|
3
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
4
3
|
import { ITextModel } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
5
4
|
import { FormattingMode } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/format/browser/format';
|
|
5
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
6
6
|
|
|
7
7
|
import { IEditorDocumentModelService } from '../doc-model/types';
|
|
8
8
|
|
|
@@ -45,7 +45,7 @@ export class FormattingSelector {
|
|
|
45
45
|
const elements: { [key: string]: IProvider } = {};
|
|
46
46
|
formatters.forEach((provider: IProvider) => {
|
|
47
47
|
if (provider.extensionId) {
|
|
48
|
-
elements[provider.extensionId
|
|
48
|
+
elements[provider.extensionId] = provider;
|
|
49
49
|
}
|
|
50
50
|
});
|
|
51
51
|
|
|
@@ -73,7 +73,7 @@ export class FormattingSelector {
|
|
|
73
73
|
{ ...config, [languageId]: selected },
|
|
74
74
|
PreferenceScope.User,
|
|
75
75
|
);
|
|
76
|
-
return elements[selected
|
|
76
|
+
return elements[selected];
|
|
77
77
|
}
|
|
78
78
|
} else {
|
|
79
79
|
return undefined;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
2
|
+
|
|
3
|
+
import IMonacoModel = monaco.editor.IModel;
|
|
4
|
+
import IMonacoMarkerData = monaco.editor.IMarkerData;
|
|
5
|
+
|
|
6
|
+
// eslint-disable-next-line import/order
|
|
1
7
|
import { Disposable, DisposableCollection, IDisposable } from '@opensumi/ide-core-common';
|
|
2
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
3
|
-
import { monacoApi } from '@opensumi/ide-monaco/lib/browser/monaco-api';
|
|
4
8
|
|
|
9
|
+
// eslint-disable-next-line import/order
|
|
5
10
|
import { Diagnostic, DiagnosticCollection, asMonacoDiagnostics } from '../../common';
|
|
6
11
|
|
|
7
|
-
type IMonacoModel = monaco.editor.ITextModel;
|
|
8
|
-
type IMonacoMarkerData = monaco.editor.IMarkerData;
|
|
9
|
-
|
|
10
12
|
export class MonacoDiagnosticCollection implements DiagnosticCollection {
|
|
11
13
|
protected readonly diagnostics = new Map<string, MonacoModelDiagnostics | undefined>();
|
|
12
14
|
protected readonly toDispose = new DisposableCollection();
|
|
@@ -46,7 +48,7 @@ export class MonacoModelDiagnostics implements IDisposable {
|
|
|
46
48
|
constructor(uri: string, diagnostics: Diagnostic[], readonly owner: string) {
|
|
47
49
|
this.uri = monaco.Uri.parse(uri);
|
|
48
50
|
this.diagnostics = diagnostics;
|
|
49
|
-
|
|
51
|
+
monaco.editor.onDidCreateModel((model) => this.doUpdateModelMarkers(model));
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
set diagnostics(diagnostics: Diagnostic[]) {
|
|
@@ -69,13 +71,13 @@ export class MonacoModelDiagnostics implements IDisposable {
|
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
updateModelMarkers(): void {
|
|
72
|
-
const model =
|
|
74
|
+
const model = monaco.editor.getModel(this.uri);
|
|
73
75
|
this.doUpdateModelMarkers(model);
|
|
74
76
|
}
|
|
75
77
|
|
|
76
78
|
protected doUpdateModelMarkers(model: IMonacoModel | null): void {
|
|
77
79
|
if (model && this.uri.toString() === model.uri.toString()) {
|
|
78
|
-
|
|
80
|
+
monaco.editor.setModelMarkers(model, this.owner, this._markers);
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
}
|
|
@@ -8,8 +8,8 @@ import {
|
|
|
8
8
|
MarkerSeverity,
|
|
9
9
|
URI,
|
|
10
10
|
} from '@opensumi/ide-core-common';
|
|
11
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
12
11
|
import { ITextmateTokenizer, ITextmateTokenizerService } from '@opensumi/ide-monaco/lib/browser/contrib/tokenizer';
|
|
12
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
13
13
|
|
|
14
14
|
import {
|
|
15
15
|
Diagnostic,
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Disposable, IContextKeyService } from '@opensumi/ide-core-browser';
|
|
2
2
|
import { AbstractContextMenuService, ICtxMenuRenderer, MenuId } from '@opensumi/ide-core-browser/lib/menu/next';
|
|
3
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
4
3
|
import { ICodeEditor } from '@opensumi/ide-monaco/lib/common/types';
|
|
5
4
|
import * as dom from '@opensumi/monaco-editor-core/esm/vs/base/browser/dom';
|
|
6
5
|
import { IAnchor } from '@opensumi/monaco-editor-core/esm/vs/base/browser/ui/contextview/contextview';
|
|
@@ -9,6 +8,7 @@ import { IEditorMouseEvent, MouseTargetType } from '@opensumi/monaco-editor-core
|
|
|
9
8
|
import { EditorOption } from '@opensumi/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
|
|
10
9
|
import { IEditorContribution } from '@opensumi/monaco-editor-core/esm/vs/editor/common/editorCommon';
|
|
11
10
|
import { ContextMenuController } from '@opensumi/monaco-editor-core/esm/vs/editor/contrib/contextmenu/browser/contextmenu';
|
|
11
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
12
12
|
|
|
13
13
|
export class EditorContextMenuController extends Disposable implements IEditorContribution {
|
|
14
14
|
public static readonly ID = 'editor.contrib.contextmenu';
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
import React, { useCallback
|
|
1
|
+
import React, { useCallback } from 'react';
|
|
2
2
|
|
|
3
|
-
import { Button
|
|
3
|
+
import { Button } from '@opensumi/ide-components';
|
|
4
4
|
import {
|
|
5
|
-
AINativeConfigService,
|
|
6
5
|
CommandRegistry,
|
|
7
6
|
CommandService,
|
|
8
|
-
IContextKeyService,
|
|
9
7
|
SCM_COMMANDS,
|
|
10
8
|
URI,
|
|
11
|
-
Uri,
|
|
12
9
|
localize,
|
|
13
10
|
useInjectable,
|
|
14
11
|
} from '@opensumi/ide-core-browser';
|
|
@@ -17,31 +14,9 @@ import styles from '../editor.module.less';
|
|
|
17
14
|
import { ReactEditorComponent } from '../types';
|
|
18
15
|
|
|
19
16
|
export const MergeEditorFloatComponents: ReactEditorComponent<{ uri: URI }> = ({ resource }) => {
|
|
20
|
-
const aiNativeConfigService = useInjectable<AINativeConfigService>(AINativeConfigService);
|
|
21
17
|
const commandService = useInjectable<CommandService>(CommandService);
|
|
22
18
|
const commandRegistry = useInjectable<CommandRegistry>(CommandRegistry);
|
|
23
|
-
const contextKeyService = useInjectable<IContextKeyService>(IContextKeyService);
|
|
24
19
|
|
|
25
|
-
const [isVisiable, setIsVisiable] = useState(false);
|
|
26
|
-
|
|
27
|
-
const gitMergeChangesSet = new Set(['git.mergeChanges']);
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
const run = () => {
|
|
31
|
-
const mergeChanges = contextKeyService.getValue<Uri[]>('git.mergeChanges') || [];
|
|
32
|
-
setIsVisiable(mergeChanges.some((value) => value.toString() === resource.uri.toString()));
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const disposed = contextKeyService.onDidChangeContext(({ payload }) => {
|
|
36
|
-
if (payload.affectsSome(gitMergeChangesSet)) {
|
|
37
|
-
run();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
run();
|
|
41
|
-
return () => disposed.dispose();
|
|
42
|
-
}, [resource]);
|
|
43
|
-
|
|
44
|
-
const [isAiResolving, setIsAiResolving] = useState(false);
|
|
45
20
|
const handleOpenMergeEditor = useCallback(async () => {
|
|
46
21
|
const { uri } = resource;
|
|
47
22
|
|
|
@@ -52,83 +27,11 @@ export const MergeEditorFloatComponents: ReactEditorComponent<{ uri: URI }> = ({
|
|
|
52
27
|
});
|
|
53
28
|
}, [resource]);
|
|
54
29
|
|
|
55
|
-
const isSupportAiResolve = useCallback(
|
|
56
|
-
() => aiNativeConfigService.capabilities.supportsConflictResolve,
|
|
57
|
-
[aiNativeConfigService],
|
|
58
|
-
);
|
|
59
|
-
|
|
60
|
-
const handlePrev = () => {
|
|
61
|
-
commandService.tryExecuteCommand('merge-conflict.previous');
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
const handleNext = () => {
|
|
65
|
-
commandService.tryExecuteCommand('merge-conflict.next');
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
const handleAIResolve = useCallback(async () => {
|
|
69
|
-
setIsAiResolving(true);
|
|
70
|
-
if (isAiResolving) {
|
|
71
|
-
await commandService.executeCommand('merge-conflict.ai.all-accept-stop', resource.uri);
|
|
72
|
-
} else {
|
|
73
|
-
await commandService.executeCommand('merge-conflict.ai.all-accept', resource.uri);
|
|
74
|
-
}
|
|
75
|
-
setIsAiResolving(false);
|
|
76
|
-
}, [resource, isAiResolving]);
|
|
77
|
-
|
|
78
|
-
const handleReset = useCallback(() => {
|
|
79
|
-
commandService.executeCommand('merge-conflict.ai.all-reset', resource.uri);
|
|
80
|
-
}, [resource]);
|
|
81
|
-
|
|
82
|
-
if (!isVisiable) {
|
|
83
|
-
return null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
30
|
return (
|
|
87
31
|
<div className={styles.merge_editor_float_container}>
|
|
88
|
-
<
|
|
89
|
-
|
|
90
|
-
<Icon icon={'left'} />
|
|
91
|
-
<span>{localize('mergeEditor.conflict.prev')}</span>
|
|
92
|
-
</Button>
|
|
93
|
-
<Button className={styles.merge_conflict_bottom_btn} size='large' onClick={handleNext}>
|
|
94
|
-
<span>{localize('mergeEditor.conflict.next')}</span>
|
|
95
|
-
<Icon icon={'right'} />
|
|
96
|
-
</Button>
|
|
97
|
-
</div>
|
|
98
|
-
<span className={styles.line_vertical}></span>
|
|
99
|
-
<Button
|
|
100
|
-
id='merge.editor.open.tradition'
|
|
101
|
-
className={styles.merge_conflict_bottom_btn}
|
|
102
|
-
size='large'
|
|
103
|
-
onClick={handleOpenMergeEditor}
|
|
104
|
-
>
|
|
105
|
-
<Icon icon={'swap'} />
|
|
106
|
-
<span>{localize('mergeEditor.open.3way')}</span>
|
|
107
|
-
</Button>
|
|
108
|
-
<Button id='merge.editor.rest' className={styles.merge_conflict_bottom_btn} size='large' onClick={handleReset}>
|
|
109
|
-
<Icon icon={'discard'} />
|
|
110
|
-
<span>{localize('mergeEditor.reset')}</span>
|
|
32
|
+
<Button size='large' onClick={handleOpenMergeEditor}>
|
|
33
|
+
{localize('mergeEditor.open.in.editor')}
|
|
111
34
|
</Button>
|
|
112
|
-
{isSupportAiResolve() && (
|
|
113
|
-
<Button
|
|
114
|
-
id='merge.editor.conflict.resolve.all'
|
|
115
|
-
size='large'
|
|
116
|
-
className={`${styles.merge_conflict_bottom_btn} ${styles.magic_btn}`}
|
|
117
|
-
onClick={handleAIResolve}
|
|
118
|
-
>
|
|
119
|
-
{isAiResolving ? (
|
|
120
|
-
<>
|
|
121
|
-
<Icon icon={'circle-pause'} />
|
|
122
|
-
<span>{localize('mergeEditor.conflict.resolve.all.stop')}</span>
|
|
123
|
-
</>
|
|
124
|
-
) : (
|
|
125
|
-
<>
|
|
126
|
-
<Icon icon={'magic-wand'} />
|
|
127
|
-
<span>{localize('mergeEditor.conflict.resolve.all')}</span>
|
|
128
|
-
</>
|
|
129
|
-
)}
|
|
130
|
-
</Button>
|
|
131
|
-
)}
|
|
132
35
|
</div>
|
|
133
36
|
);
|
|
134
37
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Autowired } from '@opensumi/di';
|
|
2
|
-
import { Disposable, Domain, Schemes } from '@opensumi/ide-core-browser';
|
|
2
|
+
import { Disposable, Domain, IContextKeyService, Schemes, Uri } from '@opensumi/ide-core-browser';
|
|
3
3
|
|
|
4
4
|
import { ResourceService } from '../../common';
|
|
5
5
|
import { BrowserEditorContribution, EditorComponentRegistry, EditorOpenType } from '../types';
|
|
@@ -14,6 +14,9 @@ export class MergeEditorContribution extends Disposable implements BrowserEditor
|
|
|
14
14
|
@Autowired()
|
|
15
15
|
private readonly mergeEditorResourceProvider: MergeEditorResourceProvider;
|
|
16
16
|
|
|
17
|
+
@Autowired(IContextKeyService)
|
|
18
|
+
private readonly contextKeyService: IContextKeyService;
|
|
19
|
+
|
|
17
20
|
registerResource(resourceService: ResourceService): void {
|
|
18
21
|
resourceService.registerResourceProvider(this.mergeEditorResourceProvider);
|
|
19
22
|
}
|
|
@@ -27,14 +30,15 @@ export class MergeEditorContribution extends Disposable implements BrowserEditor
|
|
|
27
30
|
|
|
28
31
|
registry.registerEditorSideWidget({
|
|
29
32
|
id: MERGE_EDITOR_FLOATING_WIDGET,
|
|
30
|
-
component: MergeEditorFloatComponents,
|
|
33
|
+
component: MergeEditorFloatComponents as any,
|
|
31
34
|
displaysOnResource: (resource) => {
|
|
32
35
|
const { uri } = resource;
|
|
33
36
|
if (uri.scheme !== Schemes.file) {
|
|
34
37
|
return false;
|
|
35
38
|
}
|
|
36
|
-
|
|
37
|
-
|
|
39
|
+
|
|
40
|
+
const mergeChanges = this.contextKeyService.getValue<Uri[]>('git.mergeChanges') || [];
|
|
41
|
+
return mergeChanges.some((value) => value.toString() === uri.toString());
|
|
38
42
|
},
|
|
39
43
|
});
|
|
40
44
|
}
|
|
@@ -17,12 +17,13 @@ import {
|
|
|
17
17
|
IncomingCall,
|
|
18
18
|
OutgoingCall,
|
|
19
19
|
} from '@opensumi/ide-monaco/lib/browser/contrib/callHierarchy';
|
|
20
|
-
import { ITextModel, Position
|
|
20
|
+
import { ITextModel, Position } from '@opensumi/ide-monaco/lib/browser/monaco-api/types';
|
|
21
21
|
|
|
22
22
|
import { IEditorDocumentModelService } from '../../doc-model/types';
|
|
23
23
|
|
|
24
24
|
const { isNonEmptyArray } = arrays;
|
|
25
25
|
|
|
26
|
+
declare type ProviderResult<T> = T | undefined | null | Thenable<T | undefined | null>;
|
|
26
27
|
/* ---------------------------------------------------------------------------------------------
|
|
27
28
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
28
29
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
@@ -205,7 +205,7 @@ export class MonacoCommandRegistry implements IMonacoCommandsRegistry {
|
|
|
205
205
|
* 获取当前活动的编辑器
|
|
206
206
|
* 此处的活动编辑器和 workbenchEditorService.currentEditor 的概念不同,对于diffEditor,需要获取确实的那个editor而不是modifiedEditor
|
|
207
207
|
*/
|
|
208
|
-
|
|
208
|
+
protected getActiveCodeEditor(): ICodeEditor | undefined {
|
|
209
209
|
// 先从 monaco 内部获取到当前 focus 的 editor
|
|
210
210
|
const editor = this.codeEditorService?.getFocusedCodeEditor();
|
|
211
211
|
if (editor) {
|
|
@@ -290,7 +290,7 @@ export class MonacoActionRegistry implements IMonacoActionRegistry {
|
|
|
290
290
|
|
|
291
291
|
registerMonacoActions() {
|
|
292
292
|
const editorActions = new Map(
|
|
293
|
-
|
|
293
|
+
this.monacoEditorRegistry.getEditorActions().map(({ id, label, alias }) => [
|
|
294
294
|
id,
|
|
295
295
|
{
|
|
296
296
|
label,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { IGrammar, INITIAL, StackElement } from 'vscode-textmate';
|
|
2
2
|
|
|
3
3
|
import { Disposable, Emitter, Event } from '@opensumi/ide-core-common/lib/utils';
|
|
4
|
-
import * as monaco from '@opensumi/ide-monaco';
|
|
5
4
|
import {
|
|
6
5
|
MetadataConsts,
|
|
7
6
|
TokenMetadata,
|
|
8
7
|
} from '@opensumi/monaco-editor-core/esm/vs/editor/common/encodedTokenAttributes';
|
|
8
|
+
import * as monaco from '@opensumi/monaco-editor-core/esm/vs/editor/editor.api';
|
|
9
9
|
|
|
10
10
|
export class TokenizerState implements monaco.languages.IState {
|
|
11
11
|
constructor(public readonly ruleStack: StackElement) {}
|