@theia/monaco 1.64.0-next.28 → 1.64.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-command.d.ts.map +1 -1
- package/lib/browser/monaco-command.js +16 -1
- package/lib/browser/monaco-command.js.map +1 -1
- package/lib/browser/monaco-context-key-service.d.ts +5 -4
- package/lib/browser/monaco-context-key-service.d.ts.map +1 -1
- package/lib/browser/monaco-context-key-service.js +16 -4
- package/lib/browser/monaco-context-key-service.js.map +1 -1
- package/lib/browser/monaco-diff-computer.d.ts +6 -0
- package/lib/browser/monaco-diff-computer.d.ts.map +1 -0
- package/lib/browser/monaco-diff-computer.js +57 -0
- package/lib/browser/monaco-diff-computer.js.map +1 -0
- package/lib/browser/monaco-diff-editor.d.ts +2 -0
- package/lib/browser/monaco-diff-editor.d.ts.map +1 -1
- package/lib/browser/monaco-diff-editor.js +4 -0
- package/lib/browser/monaco-diff-editor.js.map +1 -1
- package/lib/browser/monaco-editor-content-menu.d.ts +20 -0
- package/lib/browser/monaco-editor-content-menu.d.ts.map +1 -0
- package/lib/browser/monaco-editor-content-menu.js +118 -0
- package/lib/browser/monaco-editor-content-menu.js.map +1 -0
- package/lib/browser/monaco-editor-overlay-button.d.ts +14 -0
- package/lib/browser/monaco-editor-overlay-button.d.ts.map +1 -0
- package/lib/browser/monaco-editor-overlay-button.js +58 -0
- package/lib/browser/monaco-editor-overlay-button.js.map +1 -0
- package/lib/browser/monaco-editor.d.ts +4 -0
- package/lib/browser/monaco-editor.d.ts.map +1 -1
- package/lib/browser/monaco-editor.js +13 -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/package.json +9 -9
- package/src/browser/monaco-command.ts +21 -1
- package/src/browser/monaco-context-key-service.ts +19 -7
- package/src/browser/monaco-diff-computer.ts +62 -0
- package/src/browser/monaco-diff-editor.ts +4 -0
- package/src/browser/monaco-editor-content-menu.ts +127 -0
- package/src/browser/monaco-editor-overlay-button.ts +69 -0
- package/src/browser/monaco-editor.ts +13 -2
- package/src/browser/monaco-frontend-module.ts +9 -0
- package/src/browser/style/index.css +17 -0
|
@@ -0,0 +1,69 @@
|
|
|
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 { Disposable, DisposableCollection, Emitter } from '@theia/core';
|
|
18
|
+
import { DISABLED_CLASS, onDomEvent } from '@theia/core/lib/browser';
|
|
19
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
20
|
+
import { MonacoEditor } from './monaco-editor';
|
|
21
|
+
|
|
22
|
+
export class MonacoEditorOverlayButton implements Disposable {
|
|
23
|
+
|
|
24
|
+
private static nextId = 1;
|
|
25
|
+
|
|
26
|
+
readonly domNode: HTMLElement;
|
|
27
|
+
|
|
28
|
+
protected readonly onClickEmitter = new Emitter<void>();
|
|
29
|
+
readonly onClick = this.onClickEmitter.event;
|
|
30
|
+
|
|
31
|
+
protected readonly toDispose = new DisposableCollection(this.onClickEmitter);
|
|
32
|
+
|
|
33
|
+
constructor(
|
|
34
|
+
editor: MonacoEditor,
|
|
35
|
+
label: string,
|
|
36
|
+
id = 'theia-editor.overlayButtonWidget' + MonacoEditorOverlayButton.nextId++
|
|
37
|
+
) {
|
|
38
|
+
this.domNode = document.createElement('div');
|
|
39
|
+
this.domNode.classList.add('overlay-button');
|
|
40
|
+
this.domNode.textContent = label;
|
|
41
|
+
this.toDispose.push(onDomEvent(this.domNode, 'click', () => this.onClickEmitter.fire()));
|
|
42
|
+
|
|
43
|
+
const overlayWidget: monaco.editor.IOverlayWidget = {
|
|
44
|
+
getId: () => id,
|
|
45
|
+
getDomNode: () => this.domNode,
|
|
46
|
+
getPosition: () => ({
|
|
47
|
+
preference: monaco.editor.OverlayWidgetPositionPreference.BOTTOM_RIGHT_CORNER
|
|
48
|
+
})
|
|
49
|
+
};
|
|
50
|
+
editor.getControl().addOverlayWidget(overlayWidget);
|
|
51
|
+
this.toDispose.push(Disposable.create(() => editor.getControl().removeOverlayWidget(overlayWidget)));
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
get enabled(): boolean {
|
|
55
|
+
return !this.domNode.classList.contains(DISABLED_CLASS);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
set enabled(value: boolean) {
|
|
59
|
+
if (value) {
|
|
60
|
+
this.domNode.classList.remove(DISABLED_CLASS);
|
|
61
|
+
} else {
|
|
62
|
+
this.domNode.classList.add(DISABLED_CLASS);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
dispose(): void {
|
|
67
|
+
this.toDispose.dispose();
|
|
68
|
+
}
|
|
69
|
+
}
|
|
@@ -124,6 +124,8 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
124
124
|
readonly onEncodingChanged = this.document.onDidChangeEncoding;
|
|
125
125
|
protected readonly onResizeEmitter = new Emitter<Dimension | null>();
|
|
126
126
|
readonly onDidResize = this.onResizeEmitter.event;
|
|
127
|
+
protected readonly onShouldDisplayDirtyDiffChangedEmitter = new Emitter<boolean>;
|
|
128
|
+
readonly onShouldDisplayDirtyDiffChanged: Event<boolean> | undefined = this.onShouldDisplayDirtyDiffChangedEmitter.event;
|
|
127
129
|
|
|
128
130
|
readonly documents = new Set<MonacoEditorModel>();
|
|
129
131
|
protected model: monaco.editor.ITextModel | null;
|
|
@@ -146,7 +148,8 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
146
148
|
this.onDocumentContentChangedEmitter,
|
|
147
149
|
this.onMouseDownEmitter,
|
|
148
150
|
this.onLanguageChangedEmitter,
|
|
149
|
-
this.onScrollChangedEmitter
|
|
151
|
+
this.onScrollChangedEmitter,
|
|
152
|
+
this.onShouldDisplayDirtyDiffChangedEmitter
|
|
150
153
|
]);
|
|
151
154
|
this.documents.add(document);
|
|
152
155
|
this.autoSizing = options && options.autoSizing !== undefined ? options.autoSizing : false;
|
|
@@ -162,6 +165,7 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
162
165
|
StandaloneServices.get(IInstantiationService).createInstance(WorkbenchHoverDelegate, placement, enableInstantHover, {})
|
|
163
166
|
)));
|
|
164
167
|
this.addHandlers(this.editor);
|
|
168
|
+
this.editor.createContextKey('resource', document.uri);
|
|
165
169
|
}
|
|
166
170
|
|
|
167
171
|
protected async init(): Promise<void> {
|
|
@@ -657,8 +661,15 @@ export class MonacoEditor extends MonacoEditorServices implements TextEditor {
|
|
|
657
661
|
return this.uri.withPath(resourceUri.path);
|
|
658
662
|
}
|
|
659
663
|
|
|
664
|
+
private _shouldDisplayDirtyDiff = true;
|
|
660
665
|
shouldDisplayDirtyDiff(): boolean {
|
|
661
|
-
return
|
|
666
|
+
return this._shouldDisplayDirtyDiff;
|
|
667
|
+
}
|
|
668
|
+
setShouldDisplayDirtyDiff(value: boolean): void {
|
|
669
|
+
if (value !== this._shouldDisplayDirtyDiff) {
|
|
670
|
+
this._shouldDisplayDirtyDiff = value;
|
|
671
|
+
this.onShouldDisplayDirtyDiffChangedEmitter.fire(value);
|
|
672
|
+
}
|
|
662
673
|
}
|
|
663
674
|
}
|
|
664
675
|
|
|
@@ -81,6 +81,9 @@ import { DefaultContentHoverWidgetPatcher } from './default-content-hover-widget
|
|
|
81
81
|
import { MonacoWorkspaceContextService } from './monaco-workspace-context-service';
|
|
82
82
|
import { MonacoCodeActionSaveParticipant } from './monaco-code-action-save-participant';
|
|
83
83
|
import { MonacoCodeActionService, MonacoCodeActionServiceImpl } from './monaco-code-action-service';
|
|
84
|
+
import { MonacoDiffComputer } from './monaco-diff-computer';
|
|
85
|
+
import { DiffComputer } from '@theia/core/lib/common/diff';
|
|
86
|
+
import { MonacoEditorContentMenuContribution } from './monaco-editor-content-menu';
|
|
84
87
|
|
|
85
88
|
export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
86
89
|
bind(MonacoThemingService).toSelf().inSingletonScope();
|
|
@@ -200,6 +203,12 @@ export default new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
|
200
203
|
|
|
201
204
|
bind(DefaultContentHoverWidgetPatcher).toSelf().inSingletonScope();
|
|
202
205
|
bind(FrontendApplicationContribution).toService(DefaultContentHoverWidgetPatcher);
|
|
206
|
+
|
|
207
|
+
bind(MonacoDiffComputer).toSelf().inSingletonScope();
|
|
208
|
+
bind(DiffComputer).toService(MonacoDiffComputer);
|
|
209
|
+
|
|
210
|
+
bind(MonacoEditorContentMenuContribution).toSelf().inSingletonScope();
|
|
211
|
+
bind(FrontendApplicationContribution).to(MonacoEditorContentMenuContribution);
|
|
203
212
|
});
|
|
204
213
|
|
|
205
214
|
export const MonacoConfigurationService = Symbol('MonacoConfigurationService');
|
|
@@ -273,3 +273,20 @@
|
|
|
273
273
|
.quick-input-header > .quick-input-inline-action-bar {
|
|
274
274
|
display: none;
|
|
275
275
|
}
|
|
276
|
+
|
|
277
|
+
.monaco-editor .overlay-button {
|
|
278
|
+
padding: 6px 11px;
|
|
279
|
+
border-radius: 2px;
|
|
280
|
+
cursor: pointer;
|
|
281
|
+
user-select: none;
|
|
282
|
+
z-index: 1;
|
|
283
|
+
background-color: var(--theia-button-background);
|
|
284
|
+
color: var(--theia-button-foreground);
|
|
285
|
+
border: 1px solid var(--theia-contrast-border);
|
|
286
|
+
font-family: var(--theia-ui-font-family);
|
|
287
|
+
line-height: 1.4;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
.monaco-editor .overlay-button.theia-mod-disabled {
|
|
291
|
+
display: none;
|
|
292
|
+
}
|