@theia/monaco 1.59.0-next.72 → 1.60.0-next.43
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/monaco-context-menu.js +3 -3
- package/lib/browser/monaco-context-menu.js.map +1 -1
- package/lib/browser/monaco-diff-editor.d.ts +7 -0
- package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
- package/lib/browser/monaco-diff-editor.js +35 -1
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-editor-provider.js +2 -2
- package/lib/browser/monaco-editor-provider.js.map +1 -1
- package/lib/browser/monaco-editor.d.ts +1 -1
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +4 -6
- package/lib/browser/monaco-editor.js.map +1 -1
- package/lib/browser/monaco-init.d.ts.map +1 -1
- package/lib/browser/monaco-init.js +32 -0
- package/lib/browser/monaco-init.js.map +1 -1
- package/lib/browser/simple-monaco-editor.d.ts +1 -1
- package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
- package/lib/browser/simple-monaco-editor.js +2 -2
- package/lib/browser/simple-monaco-editor.js.map +1 -1
- package/package.json +9 -9
- package/src/browser/monaco-context-menu.ts +4 -4
- package/src/browser/monaco-diff-editor.ts +39 -1
- package/src/browser/monaco-editor-provider.ts +2 -2
- package/src/browser/monaco-editor.ts +4 -6
- package/src/browser/monaco-init.ts +34 -0
- package/src/browser/simple-monaco-editor.ts +2 -2
- package/src/browser/style/index.css +1 -1
- package/data/monaco-nls.json +0 -1379
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/monaco",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.60.0-next.43+2a13720d2",
|
|
4
4
|
"description": "Theia - Monaco Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.
|
|
7
|
-
"@theia/editor": "1.
|
|
8
|
-
"@theia/filesystem": "1.
|
|
9
|
-
"@theia/markers": "1.
|
|
6
|
+
"@theia/core": "1.60.0-next.43+2a13720d2",
|
|
7
|
+
"@theia/editor": "1.60.0-next.43+2a13720d2",
|
|
8
|
+
"@theia/filesystem": "1.60.0-next.43+2a13720d2",
|
|
9
|
+
"@theia/markers": "1.60.0-next.43+2a13720d2",
|
|
10
10
|
"@theia/monaco-editor-core": "1.96.302",
|
|
11
|
-
"@theia/outline-view": "1.
|
|
12
|
-
"@theia/workspace": "1.
|
|
11
|
+
"@theia/outline-view": "1.60.0-next.43+2a13720d2",
|
|
12
|
+
"@theia/workspace": "1.60.0-next.43+2a13720d2",
|
|
13
13
|
"fast-plist": "^0.1.2",
|
|
14
14
|
"idb": "^4.0.5",
|
|
15
15
|
"jsonc-parser": "^2.2.0",
|
|
@@ -52,10 +52,10 @@
|
|
|
52
52
|
"watch": "theiaext watch"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@theia/ext-scripts": "1.
|
|
55
|
+
"@theia/ext-scripts": "1.59.0"
|
|
56
56
|
},
|
|
57
57
|
"nyc": {
|
|
58
58
|
"extends": "../../configs/nyc.json"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "2a13720d2d41d8ae6ee4e34cd2dee1c656a18018"
|
|
61
61
|
}
|
|
@@ -18,8 +18,8 @@ import { injectable, inject } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { MenuPath } from '@theia/core/lib/common/menu';
|
|
19
19
|
import { EDITOR_CONTEXT_MENU } from '@theia/editor/lib/browser';
|
|
20
20
|
import { Anchor, ContextMenuRenderer, Coordinate } from '@theia/core/lib/browser';
|
|
21
|
-
import { Menu } from '@theia/core/shared/@
|
|
22
|
-
import { CommandRegistry } from '@theia/core/shared/@
|
|
21
|
+
import { Menu } from '@theia/core/shared/@lumino/widgets';
|
|
22
|
+
import { CommandRegistry } from '@theia/core/shared/@lumino/commands';
|
|
23
23
|
import { IContextMenuService } from '@theia/monaco-editor-core/esm/vs/platform/contextview/browser/contextView';
|
|
24
24
|
import { IContextMenuDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/contextmenu';
|
|
25
25
|
import { MenuItemAction } from '@theia/monaco-editor-core/esm/vs/platform/actions/common/actions';
|
|
@@ -51,14 +51,14 @@ export class MonacoContextMenuService implements IContextMenuService {
|
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
private getContext(delegate: IContextMenuDelegate): HTMLElement
|
|
54
|
+
private getContext(delegate: IContextMenuDelegate): HTMLElement {
|
|
55
55
|
const anchor = delegate.getAnchor();
|
|
56
56
|
if (anchor instanceof HTMLElement) {
|
|
57
57
|
return anchor;
|
|
58
58
|
} else if (anchor instanceof StandardMouseEvent) {
|
|
59
59
|
return anchor.target;
|
|
60
60
|
} else {
|
|
61
|
-
return
|
|
61
|
+
return window.document.body; // last resort
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
showContextMenu(delegate: IContextMenuDelegate): void {
|
|
@@ -31,6 +31,8 @@ import { IInstantiationService } from '@theia/monaco-editor-core/esm/vs/platform
|
|
|
31
31
|
import { ContextKeyValue, IContextKey } from '@theia/monaco-editor-core/esm/vs/platform/contextkey/common/contextkey';
|
|
32
32
|
import { IDisposable } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
|
|
33
33
|
import { ICommandHandler } from '@theia/monaco-editor-core/esm/vs/platform/commands/common/commands';
|
|
34
|
+
import { EditorContextKeys } from '@theia/monaco-editor-core/esm/vs/editor/common/editorContextKeys';
|
|
35
|
+
import { IEditorOptions } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
|
|
34
36
|
|
|
35
37
|
export namespace MonacoDiffEditor {
|
|
36
38
|
export interface IOptions extends MonacoEditor.ICommonOptions, IDiffEditorConstructionOptions {
|
|
@@ -40,6 +42,9 @@ export namespace MonacoDiffEditor {
|
|
|
40
42
|
export class MonacoDiffEditor extends MonacoEditor {
|
|
41
43
|
protected _diffEditor: IStandaloneDiffEditor;
|
|
42
44
|
protected _diffNavigator: DiffNavigator;
|
|
45
|
+
protected savedDiffState: monaco.editor.IDiffEditorViewState | null;
|
|
46
|
+
protected originalTextModel: monaco.editor.ITextModel;
|
|
47
|
+
protected modifiedTextModel: monaco.editor.ITextModel;
|
|
43
48
|
|
|
44
49
|
constructor(
|
|
45
50
|
uri: URI,
|
|
@@ -53,9 +58,12 @@ export class MonacoDiffEditor extends MonacoEditor {
|
|
|
53
58
|
parentEditor?: MonacoEditor
|
|
54
59
|
) {
|
|
55
60
|
super(uri, modifiedModel, node, services, options, override, parentEditor);
|
|
61
|
+
this.originalTextModel = originalModel.textEditorModel;
|
|
62
|
+
this.modifiedTextModel = modifiedModel.textEditorModel;
|
|
56
63
|
this.documents.add(originalModel);
|
|
57
64
|
const original = originalModel.textEditorModel;
|
|
58
65
|
const modified = modifiedModel.textEditorModel;
|
|
66
|
+
this.wordWrapOverride = options?.wordWrapOverride2;
|
|
59
67
|
this._diffNavigator = diffNavigatorFactory.createdDiffNavigator(this._diffEditor);
|
|
60
68
|
this._diffEditor.setModel({ original, modified });
|
|
61
69
|
}
|
|
@@ -69,7 +77,7 @@ export class MonacoDiffEditor extends MonacoEditor {
|
|
|
69
77
|
}
|
|
70
78
|
|
|
71
79
|
protected override create(options?: IDiffEditorConstructionOptions, override?: EditorServiceOverrides): Disposable {
|
|
72
|
-
options = { ...options, fixedOverflowWidgets:
|
|
80
|
+
options = { ...options, fixedOverflowWidgets: false };
|
|
73
81
|
const instantiator = this.getInstantiatorWithOverrides(override);
|
|
74
82
|
/**
|
|
75
83
|
* @monaco-uplift. Should be guaranteed to work.
|
|
@@ -82,10 +90,20 @@ export class MonacoDiffEditor extends MonacoEditor {
|
|
|
82
90
|
return this._diffEditor;
|
|
83
91
|
}
|
|
84
92
|
|
|
93
|
+
protected wordWrapOverride: IEditorOptions['wordWrapOverride2'];
|
|
94
|
+
protected lastReachedSideBySideBreakpoint = true;
|
|
85
95
|
protected override resize(dimension: Dimension | null): void {
|
|
86
96
|
if (this.node) {
|
|
87
97
|
const layoutSize = this.computeLayoutSize(this.node, dimension);
|
|
88
98
|
this._diffEditor.layout(layoutSize);
|
|
99
|
+
// Workaround for https://github.com/microsoft/vscode/issues/217386#issuecomment-2711750462
|
|
100
|
+
const leftEditor = this._diffEditor.getOriginalEditor();
|
|
101
|
+
const hasReachedSideBySideBreakpoint = leftEditor.contextKeyService
|
|
102
|
+
.getContextKeyValue(EditorContextKeys.diffEditorRenderSideBySideInlineBreakpointReached.key);
|
|
103
|
+
if (hasReachedSideBySideBreakpoint !== this.lastReachedSideBySideBreakpoint) {
|
|
104
|
+
leftEditor.updateOptions({ wordWrapOverride2: this.wordWrapOverride ?? hasReachedSideBySideBreakpoint ? 'off' : 'inherit' });
|
|
105
|
+
}
|
|
106
|
+
this.lastReachedSideBySideBreakpoint = !!hasReachedSideBySideBreakpoint;
|
|
89
107
|
}
|
|
90
108
|
}
|
|
91
109
|
|
|
@@ -110,6 +128,26 @@ export class MonacoDiffEditor extends MonacoEditor {
|
|
|
110
128
|
override shouldDisplayDirtyDiff(): boolean {
|
|
111
129
|
return false;
|
|
112
130
|
}
|
|
131
|
+
|
|
132
|
+
override handleVisibilityChanged(nowVisible: boolean): void {
|
|
133
|
+
if (nowVisible) {
|
|
134
|
+
this.diffEditor.setModel({original: this.originalTextModel, modified: this.modifiedTextModel});
|
|
135
|
+
this.diffEditor.restoreViewState(this.savedDiffState);
|
|
136
|
+
this.diffEditor.focus();
|
|
137
|
+
} else {
|
|
138
|
+
const originalModel = this.diffEditor.getOriginalEditor().getModel();
|
|
139
|
+
if (originalModel) {
|
|
140
|
+
this.originalTextModel = originalModel;
|
|
141
|
+
}
|
|
142
|
+
const modifiedModel = this.diffEditor.getModifiedEditor().getModel();
|
|
143
|
+
if (modifiedModel) {
|
|
144
|
+
this.modifiedTextModel = modifiedModel;
|
|
145
|
+
}
|
|
146
|
+
this.savedDiffState = this.diffEditor.saveViewState();
|
|
147
|
+
// eslint-disable-next-line no-null/no-null
|
|
148
|
+
this.diffEditor.setModel(null);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
113
151
|
}
|
|
114
152
|
|
|
115
153
|
class EmbeddedDiffEditor extends EmbeddedDiffEditorWidget implements IStandaloneDiffEditor {
|
|
@@ -409,7 +409,7 @@ export class MonacoEditorProvider {
|
|
|
409
409
|
overviewRulerBorder: false,
|
|
410
410
|
scrollBeyondLastLine: false,
|
|
411
411
|
renderLineHighlight: 'none',
|
|
412
|
-
fixedOverflowWidgets:
|
|
412
|
+
fixedOverflowWidgets: false,
|
|
413
413
|
acceptSuggestionOnEnter: 'smart',
|
|
414
414
|
minimap: {
|
|
415
415
|
enabled: false
|
|
@@ -421,7 +421,7 @@ export class MonacoEditorProvider {
|
|
|
421
421
|
options = {
|
|
422
422
|
scrollBeyondLastLine: true,
|
|
423
423
|
overviewRulerLanes: 2,
|
|
424
|
-
fixedOverflowWidgets:
|
|
424
|
+
fixedOverflowWidgets: false,
|
|
425
425
|
minimap: { enabled: false },
|
|
426
426
|
renderSideBySide: false,
|
|
427
427
|
readOnly: true,
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { injectable, inject, unmanaged } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ElementExt } from '@theia/core/shared/@
|
|
18
|
+
import { ElementExt } from '@theia/core/shared/@lumino/domutils';
|
|
19
19
|
import URI from '@theia/core/lib/common/uri';
|
|
20
20
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
21
21
|
import { DisposableCollection, Disposable, Emitter, Event, nullToUndefined, MaybeNull } from '@theia/core/lib/common';
|
|
@@ -174,7 +174,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
174
174
|
const combinedOptions = {
|
|
175
175
|
...options,
|
|
176
176
|
lightbulb: { enabled: ShowLightbulbIconMode.On },
|
|
177
|
-
fixedOverflowWidgets:
|
|
177
|
+
fixedOverflowWidgets: false,
|
|
178
178
|
scrollbar: {
|
|
179
179
|
useShadows: false,
|
|
180
180
|
verticalHasArrows: false,
|
|
@@ -559,10 +559,8 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
559
559
|
const toPosition = (line: number): monaco.Position => this.p2m.asPosition({ line, character: 0 });
|
|
560
560
|
const start = toPosition(startLineNumber).lineNumber;
|
|
561
561
|
const end = toPosition(endLineNumber).lineNumber;
|
|
562
|
-
return this.editor
|
|
563
|
-
.
|
|
564
|
-
.getLinesDecorations(start, end)
|
|
565
|
-
.map(this.toEditorDecoration.bind(this));
|
|
562
|
+
return this.editor.getModel()?.getLinesDecorations(start, end)
|
|
563
|
+
.map(this.toEditorDecoration.bind(this)) || [];
|
|
566
564
|
}
|
|
567
565
|
|
|
568
566
|
protected toEditorDecoration(decoration: monaco.editor.IModelDecoration): EditorDecoration & Readonly<{ id: string }> {
|
|
@@ -28,6 +28,35 @@
|
|
|
28
28
|
*/
|
|
29
29
|
|
|
30
30
|
// Before importing anything from monaco we need to override its localization function
|
|
31
|
+
import * as MonacoNls from '@theia/monaco-editor-core/esm/vs/nls';
|
|
32
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
33
|
+
import { FormatType, Localization } from '@theia/core/lib/common/i18n/localization';
|
|
34
|
+
|
|
35
|
+
function localize(label: string, ...args: FormatType[]): MonacoNls.ILocalizedString {
|
|
36
|
+
const original = Localization.format(label, args);
|
|
37
|
+
if (nls.locale) {
|
|
38
|
+
const defaultKey = nls.getDefaultKey(label);
|
|
39
|
+
if (defaultKey) {
|
|
40
|
+
return {
|
|
41
|
+
original,
|
|
42
|
+
value: nls.localize(defaultKey, label, ...args)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
original,
|
|
48
|
+
value: original
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
Object.assign(MonacoNls, {
|
|
53
|
+
localize(_key: string, label: string, ...args: FormatType[]): string {
|
|
54
|
+
return localize(label, ...args).value;
|
|
55
|
+
},
|
|
56
|
+
localize2(_key: string, label: string, ...args: FormatType[]): MonacoNls.ILocalizedString {
|
|
57
|
+
return localize(label, ...args);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
31
60
|
|
|
32
61
|
import { Container } from '@theia/core/shared/inversify';
|
|
33
62
|
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
@@ -51,6 +80,8 @@ import { IQuickInputService } from '@theia/monaco-editor-core/esm/vs/platform/qu
|
|
|
51
80
|
import { IStandaloneThemeService } from '@theia/monaco-editor-core/esm/vs/editor/standalone/common/standaloneTheme';
|
|
52
81
|
import { MonacoStandaloneThemeService } from './monaco-standalone-theme-service';
|
|
53
82
|
import { createContentHoverWidgetPatcher } from './content-hover-widget-patcher';
|
|
83
|
+
import { IHoverService } from '@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover';
|
|
84
|
+
import { setBaseLayerHoverDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/hover/hoverDelegate2';
|
|
54
85
|
|
|
55
86
|
export const contentHoverWidgetPatcher = createContentHoverWidgetPatcher();
|
|
56
87
|
|
|
@@ -124,5 +155,8 @@ export namespace MonacoInit {
|
|
|
124
155
|
[IQuickInputService.toString()]: new SyncDescriptor(MonacoQuickInputImplementationConstructor, [container]),
|
|
125
156
|
[IStandaloneThemeService.toString()]: new SyncDescriptor(MonacoStandaloneThemeServiceConstructor, [])
|
|
126
157
|
});
|
|
158
|
+
// Make sure the global base hover delegate is initialized as otherwise the quick input will throw an error and not update correctly
|
|
159
|
+
// in case no Monaco editor was constructed before and items with keybindings are shown. See #15042.
|
|
160
|
+
setBaseLayerHoverDelegate(StandaloneServices.get(IHoverService));
|
|
127
161
|
}
|
|
128
162
|
}
|
|
@@ -24,7 +24,7 @@ import { Disposable, DisposableCollection, Emitter, TextDocumentContentChangeDel
|
|
|
24
24
|
import { MonacoEditorModel } from './monaco-editor-model';
|
|
25
25
|
import { Dimension, EditorMouseEvent, MouseTarget, Position, TextDocumentChangeEvent } from '@theia/editor/lib/browser';
|
|
26
26
|
import * as monaco from '@theia/monaco-editor-core';
|
|
27
|
-
import { ElementExt } from '@theia/core/shared/@
|
|
27
|
+
import { ElementExt } from '@theia/core/shared/@lumino/domutils';
|
|
28
28
|
import { Selection } from '@theia/editor/lib/browser/editor';
|
|
29
29
|
import { SelectionDirection } from '@theia/monaco-editor-core/esm/vs/editor/common/core/selection';
|
|
30
30
|
import { ShowLightbulbIconMode } from '@theia/monaco-editor-core/esm/vs/editor/common/config/editorOptions';
|
|
@@ -89,7 +89,7 @@ export class SimpleMonacoEditor extends MonacoEditorServices implements Disposab
|
|
|
89
89
|
const combinedOptions = {
|
|
90
90
|
...options,
|
|
91
91
|
lightbulb: { enabled: ShowLightbulbIconMode.On },
|
|
92
|
-
fixedOverflowWidgets:
|
|
92
|
+
fixedOverflowWidgets: false,
|
|
93
93
|
automaticLayout: true,
|
|
94
94
|
scrollbar: {
|
|
95
95
|
useShadows: false,
|