@theia/monaco 1.60.0-next.43 → 1.60.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/monaco-context-menu.d.ts +3 -0
- package/lib/browser/monaco-context-menu.d.ts.map +1 -1
- package/lib/browser/monaco-context-menu.js +34 -13
- package/lib/browser/monaco-context-menu.js.map +1 -1
- package/lib/browser/monaco-diff-editor.js +1 -1
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-editor-model.d.ts.map +1 -1
- package/lib/browser/monaco-editor-model.js +2 -1
- package/lib/browser/monaco-editor-model.js.map +1 -1
- package/lib/browser/monaco-editor-peek-view-widget.d.ts +6 -0
- package/lib/browser/monaco-editor-peek-view-widget.d.ts.map +1 -1
- package/lib/browser/monaco-editor-peek-view-widget.js +39 -0
- package/lib/browser/monaco-editor-peek-view-widget.js.map +1 -1
- package/lib/browser/monaco-editor-provider.js +3 -3
- package/lib/browser/monaco-editor-provider.js.map +1 -1
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +8 -2
- package/lib/browser/monaco-editor.js.map +1 -1
- package/lib/browser/monaco-frontend-module.d.ts.map +1 -1
- package/lib/browser/monaco-frontend-module.js +7 -0
- package/lib/browser/monaco-frontend-module.js.map +1 -1
- package/lib/browser/monaco-init.d.ts.map +1 -1
- package/lib/browser/monaco-init.js +9 -1
- package/lib/browser/monaco-init.js.map +1 -1
- package/lib/browser/monaco-workspace-context-service.d.ts +26 -0
- package/lib/browser/monaco-workspace-context-service.d.ts.map +1 -0
- package/lib/browser/monaco-workspace-context-service.js +63 -0
- package/lib/browser/monaco-workspace-context-service.js.map +1 -0
- package/lib/browser/simple-monaco-editor.js +1 -1
- package/lib/browser/simple-monaco-editor.js.map +1 -1
- package/lib/browser/workspace-symbol-command.js +1 -1
- package/lib/browser/workspace-symbol-command.js.map +1 -1
- package/package.json +9 -9
- package/src/browser/monaco-context-menu.ts +32 -12
- package/src/browser/monaco-diff-editor.ts +3 -3
- package/src/browser/monaco-editor-model.ts +2 -1
- package/src/browser/monaco-editor-peek-view-widget.ts +52 -0
- package/src/browser/monaco-editor-provider.ts +3 -3
- package/src/browser/monaco-editor.ts +11 -3
- package/src/browser/monaco-frontend-module.ts +8 -0
- package/src/browser/monaco-init.ts +10 -1
- package/src/browser/monaco-workspace-context-service.ts +79 -0
- package/src/browser/simple-monaco-editor.ts +1 -1
- package/src/browser/workspace-symbol-command.ts +1 -1
|
@@ -90,6 +90,14 @@ export class MonacoEditorPeekViewWidget {
|
|
|
90
90
|
return this._actionbarWidget;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
fillContainer(container: HTMLElement): void {
|
|
94
|
+
super._fillContainer(container);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
protected override _fillContainer(container: HTMLElement): void {
|
|
98
|
+
that.fillContainer(container);
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
fillHead(container: HTMLElement, noCloseAction?: boolean): void {
|
|
94
102
|
super._fillHead(container, noCloseAction);
|
|
95
103
|
}
|
|
@@ -137,6 +145,26 @@ export class MonacoEditorPeekViewWidget {
|
|
|
137
145
|
protected override revealRange(range: monaco.Range, isLastLine: boolean): void {
|
|
138
146
|
that.doRevealRange(that.editor['m2p'].asRange(range), isLastLine);
|
|
139
147
|
}
|
|
148
|
+
|
|
149
|
+
getBodyElement(): HTMLDivElement | undefined {
|
|
150
|
+
return this._bodyElement;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
setBodyElement(element: HTMLDivElement | undefined): void {
|
|
154
|
+
this._bodyElement = element;
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
getHeadElement(): HTMLDivElement | undefined {
|
|
158
|
+
return this._headElement;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
setHeadElement(element: HTMLDivElement | undefined): void {
|
|
162
|
+
this._headElement = element;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
override setCssClass(className: string, classToReplace?: string | undefined): void {
|
|
166
|
+
super.setCssClass(className, classToReplace);
|
|
167
|
+
}
|
|
140
168
|
}(
|
|
141
169
|
editor.getControl() as unknown as ICodeEditor,
|
|
142
170
|
Object.assign(<IPeekViewOptions>{}, options, this.convertStyles(styles)),
|
|
@@ -185,6 +213,10 @@ export class MonacoEditorPeekViewWidget {
|
|
|
185
213
|
return action;
|
|
186
214
|
}
|
|
187
215
|
|
|
216
|
+
protected fillContainer(container: HTMLElement): void {
|
|
217
|
+
this.delegate.fillContainer(container);
|
|
218
|
+
}
|
|
219
|
+
|
|
188
220
|
protected fillHead(container: HTMLElement, noCloseAction?: boolean): void {
|
|
189
221
|
this.delegate.fillHead(container, noCloseAction);
|
|
190
222
|
}
|
|
@@ -209,6 +241,26 @@ export class MonacoEditorPeekViewWidget {
|
|
|
209
241
|
this.delegate.doRevealRange(this.editor['p2m'].asRange(range), isLastLine);
|
|
210
242
|
}
|
|
211
243
|
|
|
244
|
+
protected get bodyElement(): HTMLDivElement | undefined {
|
|
245
|
+
return this.delegate.getBodyElement();
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
protected set bodyElement(element: HTMLDivElement | undefined) {
|
|
249
|
+
this.delegate.setBodyElement(element);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
protected get headElement(): HTMLDivElement | undefined {
|
|
253
|
+
return this.delegate.getHeadElement();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
protected set headElement(element: HTMLDivElement | undefined) {
|
|
257
|
+
this.delegate.setHeadElement(element);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
protected setCssClass(className: string, classToReplace?: string | undefined): void {
|
|
261
|
+
this.delegate.setCssClass(className, classToReplace);
|
|
262
|
+
}
|
|
263
|
+
|
|
212
264
|
private convertStyles(styles: MonacoEditorPeekViewWidget.Styles): IPeekViewStyles {
|
|
213
265
|
return {
|
|
214
266
|
frameColor: this.convertColor(styles.frameColor),
|
|
@@ -409,7 +409,7 @@ export class MonacoEditorProvider {
|
|
|
409
409
|
overviewRulerBorder: false,
|
|
410
410
|
scrollBeyondLastLine: false,
|
|
411
411
|
renderLineHighlight: 'none',
|
|
412
|
-
fixedOverflowWidgets:
|
|
412
|
+
fixedOverflowWidgets: true,
|
|
413
413
|
acceptSuggestionOnEnter: 'smart',
|
|
414
414
|
minimap: {
|
|
415
415
|
enabled: false
|
|
@@ -421,10 +421,10 @@ export class MonacoEditorProvider {
|
|
|
421
421
|
options = {
|
|
422
422
|
scrollBeyondLastLine: true,
|
|
423
423
|
overviewRulerLanes: 2,
|
|
424
|
-
fixedOverflowWidgets:
|
|
424
|
+
fixedOverflowWidgets: true,
|
|
425
425
|
minimap: { enabled: false },
|
|
426
426
|
renderSideBySide: false,
|
|
427
|
-
readOnly:
|
|
427
|
+
readOnly: false,
|
|
428
428
|
renderIndicators: false,
|
|
429
429
|
diffAlgorithm: 'advanced',
|
|
430
430
|
stickyScroll: { enabled: false },
|
|
@@ -63,7 +63,8 @@ import { ILanguageConfigurationService } from '@theia/monaco-editor-core/esm/vs/
|
|
|
63
63
|
import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
|
|
64
64
|
import * as objects from '@theia/monaco-editor-core/esm/vs/base/common/objects';
|
|
65
65
|
import { Selection } from '@theia/editor/lib/browser/editor';
|
|
66
|
-
import { IHoverService } from '@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover';
|
|
66
|
+
import { IHoverService, WorkbenchHoverDelegate } from '@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover';
|
|
67
|
+
import { setHoverDelegateFactory } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
67
68
|
import { MonacoTextModelService } from './monaco-text-model-service';
|
|
68
69
|
|
|
69
70
|
export type ServicePair<T> = [ServiceIdentifier<T>, T];
|
|
@@ -155,6 +156,11 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
155
156
|
...MonacoEditor.createReadOnlyOptions(document.readOnly),
|
|
156
157
|
...options
|
|
157
158
|
}, override));
|
|
159
|
+
// Ensure that a valid InstantiationService is responsible for creating hover delegates when the InstantiationService for this widget is disposed.
|
|
160
|
+
// Cf. https://github.com/eclipse-theia/theia/issues/15102
|
|
161
|
+
this.toDispose.push(Disposable.create(() => setHoverDelegateFactory((placement, enableInstantHover) =>
|
|
162
|
+
StandaloneServices.get(IInstantiationService).createInstance(WorkbenchHoverDelegate, placement, enableInstantHover, {})
|
|
163
|
+
)));
|
|
158
164
|
this.addHandlers(this.editor);
|
|
159
165
|
}
|
|
160
166
|
|
|
@@ -174,7 +180,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
174
180
|
const combinedOptions = {
|
|
175
181
|
...options,
|
|
176
182
|
lightbulb: { enabled: ShowLightbulbIconMode.On },
|
|
177
|
-
fixedOverflowWidgets:
|
|
183
|
+
fixedOverflowWidgets: true,
|
|
178
184
|
scrollbar: {
|
|
179
185
|
useShadows: false,
|
|
180
186
|
verticalHasArrows: false,
|
|
@@ -198,7 +204,9 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
198
204
|
const instantiator = StandaloneServices.get(IInstantiationService);
|
|
199
205
|
if (override) {
|
|
200
206
|
const overrideServices = new ServiceCollection(...override);
|
|
201
|
-
|
|
207
|
+
const child = instantiator.createChild(overrideServices);
|
|
208
|
+
this.toDispose.push(child);
|
|
209
|
+
return child;
|
|
202
210
|
}
|
|
203
211
|
return instantiator;
|
|
204
212
|
}
|
|
@@ -78,6 +78,7 @@ import { IThemeService } from '@theia/monaco-editor-core/esm/vs/platform/theme/c
|
|
|
78
78
|
import { ActiveMonacoUndoRedoHandler, FocusedMonacoUndoRedoHandler } from './monaco-undo-redo-handler';
|
|
79
79
|
import { ILogService } from '@theia/monaco-editor-core/esm/vs/platform/log/common/log';
|
|
80
80
|
import { DefaultContentHoverWidgetPatcher } from './default-content-hover-widget-patcher';
|
|
81
|
+
import { MonacoWorkspaceContextService } from './monaco-workspace-context-service';
|
|
81
82
|
|
|
82
83
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
83
84
|
bind(MonacoThemingService).toSelf().inSingletonScope();
|
|
@@ -101,6 +102,7 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
bind(MonacoWorkspace).toSelf().inSingletonScope();
|
|
105
|
+
bind(MonacoWorkspaceContextService).toSelf().inSingletonScope();
|
|
104
106
|
|
|
105
107
|
bind(MonacoConfigurationService).toDynamicValue(({ container }) => createMonacoConfigurationService(container)).inSingletonScope();
|
|
106
108
|
|
|
@@ -221,6 +223,12 @@ export function createMonacoConfigurationService(container: interfaces.Container
|
|
|
221
223
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
222
224
|
service.updateValues = (values: [string, any][]) => Promise.resolve();
|
|
223
225
|
|
|
226
|
+
/*
|
|
227
|
+
* There are a few places in Monaco where this method is called from, including actions for editor minimap in `ContextMenuController`.
|
|
228
|
+
*/
|
|
229
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
230
|
+
service.updateValue = (key: string, value: any) => preferences.updateValue(key, value);
|
|
231
|
+
|
|
224
232
|
const toTarget = (scope: PreferenceScope): ConfigurationTarget => {
|
|
225
233
|
switch (scope) {
|
|
226
234
|
case PreferenceScope.Default: return ConfigurationTarget.DEFAULT;
|
|
@@ -82,6 +82,8 @@ import { MonacoStandaloneThemeService } from './monaco-standalone-theme-service'
|
|
|
82
82
|
import { createContentHoverWidgetPatcher } from './content-hover-widget-patcher';
|
|
83
83
|
import { IHoverService } from '@theia/monaco-editor-core/esm/vs/platform/hover/browser/hover';
|
|
84
84
|
import { setBaseLayerHoverDelegate } from '@theia/monaco-editor-core/esm/vs/base/browser/ui/hover/hoverDelegate2';
|
|
85
|
+
import { IWorkspaceContextService } from '@theia/monaco-editor-core/esm/vs/platform/workspace/common/workspace';
|
|
86
|
+
import { MonacoWorkspaceContextService } from './monaco-workspace-context-service';
|
|
85
87
|
|
|
86
88
|
export const contentHoverWidgetPatcher = createContentHoverWidgetPatcher();
|
|
87
89
|
|
|
@@ -143,6 +145,12 @@ class MonacoStandaloneThemeServiceConstructor {
|
|
|
143
145
|
}
|
|
144
146
|
}
|
|
145
147
|
|
|
148
|
+
class MonacoWorkspaceContextServiceConstructor {
|
|
149
|
+
constructor(container: Container) {
|
|
150
|
+
return container.get(MonacoWorkspaceContextService);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
146
154
|
export namespace MonacoInit {
|
|
147
155
|
export function init(container: Container): void {
|
|
148
156
|
StandaloneServices.initialize({
|
|
@@ -153,7 +161,8 @@ export namespace MonacoInit {
|
|
|
153
161
|
[IBulkEditService.toString()]: new SyncDescriptor(MonacoBulkEditServiceConstructor, [container]),
|
|
154
162
|
[ICommandService.toString()]: new SyncDescriptor(MonacoCommandServiceConstructor, [container]),
|
|
155
163
|
[IQuickInputService.toString()]: new SyncDescriptor(MonacoQuickInputImplementationConstructor, [container]),
|
|
156
|
-
[IStandaloneThemeService.toString()]: new SyncDescriptor(MonacoStandaloneThemeServiceConstructor, [])
|
|
164
|
+
[IStandaloneThemeService.toString()]: new SyncDescriptor(MonacoStandaloneThemeServiceConstructor, []),
|
|
165
|
+
[IWorkspaceContextService.toString()]: new SyncDescriptor(MonacoWorkspaceContextServiceConstructor, [container])
|
|
157
166
|
});
|
|
158
167
|
// Make sure the global base hover delegate is initialized as otherwise the quick input will throw an error and not update correctly
|
|
159
168
|
// in case no Monaco editor was constructed before and items with keybindings are shown. See #15042.
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2025 1C-Soft LLC and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable } from '@theia/core/shared/inversify';
|
|
18
|
+
import { Emitter } from '@theia/monaco-editor-core/esm/vs/base/common/event';
|
|
19
|
+
import { URI } from '@theia/monaco-editor-core/esm/vs/base/common/uri';
|
|
20
|
+
import {
|
|
21
|
+
ISingleFolderWorkspaceIdentifier,
|
|
22
|
+
IWorkspace,
|
|
23
|
+
IWorkspaceContextService,
|
|
24
|
+
IWorkspaceFolder,
|
|
25
|
+
IWorkspaceFoldersChangeEvent,
|
|
26
|
+
IWorkspaceFoldersWillChangeEvent,
|
|
27
|
+
IWorkspaceIdentifier,
|
|
28
|
+
UNKNOWN_EMPTY_WINDOW_WORKSPACE,
|
|
29
|
+
WorkbenchState
|
|
30
|
+
} from '@theia/monaco-editor-core/esm/vs/platform/workspace/common/workspace';
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* A minimal implementation of {@link IWorkspaceContextService} to replace the `StandaloneWorkspaceContextService` in Monaco
|
|
34
|
+
* as a workaround for the issue of showing no context menu for editor minimap (#15217).
|
|
35
|
+
*/
|
|
36
|
+
@injectable()
|
|
37
|
+
export class MonacoWorkspaceContextService implements IWorkspaceContextService {
|
|
38
|
+
|
|
39
|
+
declare readonly _serviceBrand: undefined;
|
|
40
|
+
|
|
41
|
+
protected readonly onDidChangeWorkbenchStateEmitter = new Emitter<WorkbenchState>();
|
|
42
|
+
readonly onDidChangeWorkbenchState = this.onDidChangeWorkbenchStateEmitter.event;
|
|
43
|
+
|
|
44
|
+
protected readonly onDidChangeWorkspaceNameEmitter = new Emitter<void>();
|
|
45
|
+
readonly onDidChangeWorkspaceName = this.onDidChangeWorkspaceNameEmitter.event;
|
|
46
|
+
|
|
47
|
+
protected readonly onWillChangeWorkspaceFoldersEmitter = new Emitter<IWorkspaceFoldersWillChangeEvent>();
|
|
48
|
+
readonly onWillChangeWorkspaceFolders = this.onWillChangeWorkspaceFoldersEmitter.event;
|
|
49
|
+
|
|
50
|
+
protected readonly onDidChangeWorkspaceFoldersEmitter = new Emitter<IWorkspaceFoldersChangeEvent>();
|
|
51
|
+
readonly onDidChangeWorkspaceFolders = this.onDidChangeWorkspaceFoldersEmitter.event;
|
|
52
|
+
|
|
53
|
+
protected workspace: IWorkspace = { id: UNKNOWN_EMPTY_WINDOW_WORKSPACE.id, folders: [] };
|
|
54
|
+
|
|
55
|
+
getCompleteWorkspace(): Promise<IWorkspace> {
|
|
56
|
+
return Promise.resolve(this.getWorkspace());
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
getWorkspace(): IWorkspace {
|
|
60
|
+
return this.workspace;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
getWorkbenchState(): WorkbenchState {
|
|
64
|
+
return WorkbenchState.EMPTY;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
getWorkspaceFolder(resource: URI): IWorkspaceFolder | null {
|
|
68
|
+
// eslint-disable-next-line no-null/no-null
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
isCurrentWorkspace(workspaceIdOrFolder: IWorkspaceIdentifier | ISingleFolderWorkspaceIdentifier | URI): boolean {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
isInsideWorkspace(resource: URI): boolean {
|
|
77
|
+
return false;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -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: true,
|
|
93
93
|
automaticLayout: true,
|
|
94
94
|
scrollbar: {
|
|
95
95
|
useShadows: false,
|
|
@@ -156,7 +156,7 @@ export class WorkspaceSymbolCommand implements QuickAccessProvider, CommandContr
|
|
|
156
156
|
if (!kind) {
|
|
157
157
|
return undefined;
|
|
158
158
|
}
|
|
159
|
-
return [
|
|
159
|
+
return ['codicon', `${inline ? 'inline' : 'block'}`, `codicon-symbol-${kind.toLowerCase() || 'property'}`];
|
|
160
160
|
}
|
|
161
161
|
|
|
162
162
|
private openURL(uri: URI, start: Position, end: Position): void {
|