@theia/monaco 1.53.0-next.55 → 1.53.0-next.64
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/README.md +100 -100
- package/data/monaco-nls.json +1379 -1379
- package/data/monaco-themes/vscode/dark_plus.json +201 -201
- package/data/monaco-themes/vscode/dark_theia.json +5 -5
- package/data/monaco-themes/vscode/dark_vs.json +393 -393
- package/data/monaco-themes/vscode/hc_black.json +457 -457
- package/data/monaco-themes/vscode/hc_light.json +590 -590
- package/data/monaco-themes/vscode/hc_theia.json +5 -5
- package/data/monaco-themes/vscode/hc_theia_light.json +5 -5
- package/data/monaco-themes/vscode/light_plus.json +202 -202
- package/data/monaco-themes/vscode/light_theia.json +10 -10
- package/data/monaco-themes/vscode/light_vs.json +421 -421
- package/lib/browser/monaco-editor-zone-widget.js +1 -1
- package/lib/browser/monaco-frontend-application-contribution.js +25 -25
- package/lib/browser/simple-monaco-editor.d.ts +3 -1
- package/lib/browser/simple-monaco-editor.d.ts.map +1 -1
- package/lib/browser/simple-monaco-editor.js +9 -2
- package/lib/browser/simple-monaco-editor.js.map +1 -1
- package/package.json +8 -8
- package/src/browser/index.ts +17 -17
- package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +109 -109
- package/src/browser/monaco-bulk-edit-service.ts +64 -64
- package/src/browser/monaco-color-registry.ts +73 -73
- package/src/browser/monaco-command-registry.ts +85 -85
- package/src/browser/monaco-command-service.ts +90 -90
- package/src/browser/monaco-command.ts +303 -303
- package/src/browser/monaco-context-key-service.ts +144 -144
- package/src/browser/monaco-context-menu.ts +112 -112
- package/src/browser/monaco-diff-editor.ts +141 -141
- package/src/browser/monaco-diff-navigator-factory.ts +39 -39
- package/src/browser/monaco-editor-model.ts +693 -693
- package/src/browser/monaco-editor-peek-view-widget.ts +233 -233
- package/src/browser/monaco-editor-provider.ts +455 -455
- package/src/browser/monaco-editor-service.ts +152 -152
- package/src/browser/monaco-editor-zone-widget.ts +250 -250
- package/src/browser/monaco-editor.ts +733 -733
- package/src/browser/monaco-formatting-conflicts.ts +116 -116
- package/src/browser/monaco-frontend-application-contribution.ts +182 -182
- package/src/browser/monaco-frontend-module.ts +319 -319
- package/src/browser/monaco-gotoline-quick-access.ts +47 -47
- package/src/browser/monaco-gotosymbol-quick-access.ts +53 -53
- package/src/browser/monaco-icon-registry.ts +49 -49
- package/src/browser/monaco-indexed-db.ts +130 -130
- package/src/browser/monaco-init.ts +134 -134
- package/src/browser/monaco-keybinding.ts +111 -111
- package/src/browser/monaco-keycode-map.ts +171 -171
- package/src/browser/monaco-languages.ts +177 -177
- package/src/browser/monaco-marker-collection.ts +83 -83
- package/src/browser/monaco-menu.ts +147 -147
- package/src/browser/monaco-mime-service.ts +71 -71
- package/src/browser/monaco-outline-contribution.ts +404 -404
- package/src/browser/monaco-outline-decorator.ts +66 -66
- package/src/browser/monaco-quick-access-registry.ts +112 -112
- package/src/browser/monaco-quick-input-service.ts +701 -701
- package/src/browser/monaco-resolved-keybinding.ts +162 -162
- package/src/browser/monaco-snippet-suggest-provider.ts +306 -306
- package/src/browser/monaco-standalone-theme-service.ts +51 -51
- package/src/browser/monaco-status-bar-contribution.ts +110 -110
- package/src/browser/monaco-text-model-service.ts +157 -157
- package/src/browser/monaco-theming-service.ts +204 -204
- package/src/browser/monaco-to-protocol-converter.ts +82 -82
- package/src/browser/monaco-undo-redo-handler.ts +64 -64
- package/src/browser/monaco-workspace.ts +416 -416
- package/src/browser/protocol-to-monaco-converter.ts +158 -158
- package/src/browser/simple-monaco-editor.ts +228 -216
- package/src/browser/style/index.css +266 -266
- package/src/browser/textmate/index.ts +20 -20
- package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +90 -90
- package/src/browser/textmate/monaco-textmate-service.ts +187 -187
- package/src/browser/textmate/monaco-theme-registry.ts +176 -176
- package/src/browser/textmate/monaco-theme-types.ts +37 -37
- package/src/browser/textmate/textmate-contribution.ts +29 -29
- package/src/browser/textmate/textmate-registry.ts +129 -129
- package/src/browser/textmate/textmate-snippet-completion-provider.ts +73 -73
- package/src/browser/textmate/textmate-tokenizer.ts +84 -84
- package/src/browser/workspace-symbol-command.ts +196 -196
- package/src/package.spec.ts +28 -28
|
@@ -181,7 +181,7 @@ class Arrow {
|
|
|
181
181
|
style.media = 'screen';
|
|
182
182
|
document.getElementsByTagName('head')[0].appendChild(style);
|
|
183
183
|
const selector = `.monaco-editor ${this.ruleName}`;
|
|
184
|
-
const cssText = `border-style: solid; border-color: transparent transparent var(--theia-peekView-border); border-width:
|
|
184
|
+
const cssText = `border-style: solid; border-color: transparent transparent var(--theia-peekView-border); border-width:
|
|
185
185
|
${this._height}px; bottom: -${this._height}px; margin-left: -${this._height}px; `;
|
|
186
186
|
style.sheet.insertRule(selector + '{' + cssText + '}', 0);
|
|
187
187
|
}
|
|
@@ -79,40 +79,40 @@ let MonacoFrontendApplicationContribution = class MonacoFrontendApplicationContr
|
|
|
79
79
|
const contrastBorder = theme.getColor('contrastBorder');
|
|
80
80
|
if (focusBorder) {
|
|
81
81
|
// Quick input
|
|
82
|
-
collector.addRule(`
|
|
83
|
-
.quick-input-list .monaco-list-row {
|
|
84
|
-
outline-offset: -1px;
|
|
85
|
-
}
|
|
86
|
-
.quick-input-list .monaco-list-row.focused {
|
|
87
|
-
outline: 1px dotted ${focusBorder};
|
|
88
|
-
}
|
|
89
|
-
.quick-input-list .monaco-list-row:hover {
|
|
90
|
-
outline: 1px dashed ${focusBorder};
|
|
91
|
-
}
|
|
82
|
+
collector.addRule(`
|
|
83
|
+
.quick-input-list .monaco-list-row {
|
|
84
|
+
outline-offset: -1px;
|
|
85
|
+
}
|
|
86
|
+
.quick-input-list .monaco-list-row.focused {
|
|
87
|
+
outline: 1px dotted ${focusBorder};
|
|
88
|
+
}
|
|
89
|
+
.quick-input-list .monaco-list-row:hover {
|
|
90
|
+
outline: 1px dashed ${focusBorder};
|
|
91
|
+
}
|
|
92
92
|
`);
|
|
93
93
|
// Input box always displays an outline, even when unfocused
|
|
94
|
-
collector.addRule(`
|
|
95
|
-
.monaco-editor .find-widget .monaco-inputbox {
|
|
96
|
-
outline: var(--theia-border-width) solid;
|
|
97
|
-
outline-offset: calc(-1 * var(--theia-border-width));
|
|
98
|
-
outline-color: var(--theia-focusBorder);
|
|
99
|
-
}
|
|
94
|
+
collector.addRule(`
|
|
95
|
+
.monaco-editor .find-widget .monaco-inputbox {
|
|
96
|
+
outline: var(--theia-border-width) solid;
|
|
97
|
+
outline-offset: calc(-1 * var(--theia-border-width));
|
|
98
|
+
outline-color: var(--theia-focusBorder);
|
|
99
|
+
}
|
|
100
100
|
`);
|
|
101
101
|
}
|
|
102
102
|
if (contrastBorder) {
|
|
103
|
-
collector.addRule(`
|
|
104
|
-
.quick-input-widget {
|
|
105
|
-
outline: 1px solid ${contrastBorder};
|
|
106
|
-
outline-offset: -1px;
|
|
107
|
-
}
|
|
103
|
+
collector.addRule(`
|
|
104
|
+
.quick-input-widget {
|
|
105
|
+
outline: 1px solid ${contrastBorder};
|
|
106
|
+
outline-offset: -1px;
|
|
107
|
+
}
|
|
108
108
|
`);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
else {
|
|
112
|
-
collector.addRule(`
|
|
113
|
-
.quick-input-widget {
|
|
114
|
-
box-shadow: rgb(0 0 0 / 36%) 0px 0px 8px 2px;
|
|
115
|
-
}
|
|
112
|
+
collector.addRule(`
|
|
113
|
+
.quick-input-widget {
|
|
114
|
+
box-shadow: rgb(0 0 0 / 36%) 0px 0px 8px 2px;
|
|
115
|
+
}
|
|
116
116
|
`);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
@@ -6,6 +6,7 @@ import { MonacoEditorModel } from './monaco-editor-model';
|
|
|
6
6
|
import { Dimension, EditorMouseEvent, Position, TextDocumentChangeEvent } from '@theia/editor/lib/browser';
|
|
7
7
|
import * as monaco from '@theia/monaco-editor-core';
|
|
8
8
|
import { ElementExt } from '@theia/core/shared/@phosphor/domutils';
|
|
9
|
+
import { Selection } from '@theia/editor/lib/browser/editor';
|
|
9
10
|
export declare class SimpleMonacoEditor extends MonacoEditorServices implements Disposable {
|
|
10
11
|
readonly uri: URI;
|
|
11
12
|
readonly document: MonacoEditorModel;
|
|
@@ -13,7 +14,6 @@ export declare class SimpleMonacoEditor extends MonacoEditorServices implements
|
|
|
13
14
|
protected editor: CodeEditorWidget;
|
|
14
15
|
protected readonly toDispose: DisposableCollection;
|
|
15
16
|
protected readonly onCursorPositionChangedEmitter: Emitter<Position>;
|
|
16
|
-
protected readonly onSelectionChangedEmitter: Emitter<Range>;
|
|
17
17
|
protected readonly onFocusChangedEmitter: Emitter<boolean>;
|
|
18
18
|
protected readonly onDocumentContentChangedEmitter: Emitter<TextDocumentChangeEvent>;
|
|
19
19
|
readonly onDocumentContentChanged: import("@theia/core").Event<TextDocumentChangeEvent>;
|
|
@@ -27,12 +27,14 @@ export declare class SimpleMonacoEditor extends MonacoEditorServices implements
|
|
|
27
27
|
readonly onDidChangeReadOnly: import("@theia/core").Event<boolean | import("@theia/core/lib/common/markdown-rendering").MarkdownString>;
|
|
28
28
|
constructor(uri: URI, document: MonacoEditorModel, node: HTMLElement, services: MonacoEditorServices, options?: MonacoEditor.IOptions, override?: EditorServiceOverrides, widgetOptions?: ICodeEditorWidgetOptions);
|
|
29
29
|
getControl(): CodeEditorWidget;
|
|
30
|
+
onSelectionChanged(listener: (range: Selection) => void): Disposable;
|
|
30
31
|
protected create(options?: MonacoEditor.IOptions, override?: EditorServiceOverrides, widgetOptions?: ICodeEditorWidgetOptions): Disposable;
|
|
31
32
|
protected addHandlers(codeEditor: CodeEditorWidget): void;
|
|
32
33
|
setLanguage(languageId: string): void;
|
|
33
34
|
protected fireLanguageChanged(languageId: string): void;
|
|
34
35
|
protected getInstantiatorWithOverrides(override?: EditorServiceOverrides): IInstantiationService;
|
|
35
36
|
protected mapModelContentChange(change: monaco.editor.IModelContentChange): TextDocumentContentChangeDelta;
|
|
37
|
+
focus(): void;
|
|
36
38
|
refresh(): void;
|
|
37
39
|
resizeToFit(): void;
|
|
38
40
|
setSize(dimension: Dimension): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-monaco-editor.d.ts","sourceRoot":"","sources":["../../src/browser/simple-monaco-editor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,yEAAyE,CAAC;AACrI,OAAO,EAAE,qBAAqB,EAAE,MAAM,8EAA8E,CAAC;AAGrH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,8BAA8B,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAe,QAAQ,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AACxH,OAAO,KAAK,MAAM,MAAM,2BAA2B,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,uCAAuC,CAAC;
|
|
1
|
+
{"version":3,"file":"simple-monaco-editor.d.ts","sourceRoot":"","sources":["../../src/browser/simple-monaco-editor.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,sBAAsB,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAE7F,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,MAAM,yEAAyE,CAAC;AACrI,OAAO,EAAE,qBAAqB,EAAE,MAAM,8EAA8E,CAAC;AAGrH,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,OAAO,EAAE,8BAA8B,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAe,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oEditorServices {
|
|
|
32
32
|
this.node = node;
|
|
33
33
|
this.toDispose = new core_1.DisposableCollection();
|
|
34
34
|
this.onCursorPositionChangedEmitter = new core_1.Emitter();
|
|
35
|
-
this.onSelectionChangedEmitter = new core_1.Emitter();
|
|
36
35
|
this.onFocusChangedEmitter = new core_1.Emitter();
|
|
37
36
|
this.onDocumentContentChangedEmitter = new core_1.Emitter();
|
|
38
37
|
this.onDocumentContentChanged = this.onDocumentContentChangedEmitter.event;
|
|
@@ -46,7 +45,6 @@ class SimpleMonacoEditor extends monaco_editor_1.MonacoEditorServices {
|
|
|
46
45
|
this.onDidChangeReadOnly = this.document.onDidChangeReadOnly;
|
|
47
46
|
this.toDispose.pushAll([
|
|
48
47
|
this.onCursorPositionChangedEmitter,
|
|
49
|
-
this.onSelectionChangedEmitter,
|
|
50
48
|
this.onFocusChangedEmitter,
|
|
51
49
|
this.onDocumentContentChangedEmitter,
|
|
52
50
|
this.onMouseDownEmitter,
|
|
@@ -63,6 +61,12 @@ class SimpleMonacoEditor extends monaco_editor_1.MonacoEditorServices {
|
|
|
63
61
|
getControl() {
|
|
64
62
|
return this.editor;
|
|
65
63
|
}
|
|
64
|
+
onSelectionChanged(listener) {
|
|
65
|
+
return this.editor.onDidChangeCursorSelection(event => listener({
|
|
66
|
+
...this.m2p.asRange(event.selection),
|
|
67
|
+
direction: event.selection.getDirection() === 0 /* SelectionDirection.LTR */ ? 'ltr' : 'rtl'
|
|
68
|
+
}));
|
|
69
|
+
}
|
|
66
70
|
create(options, override, widgetOptions) {
|
|
67
71
|
const combinedOptions = {
|
|
68
72
|
...options,
|
|
@@ -137,6 +141,9 @@ class SimpleMonacoEditor extends monaco_editor_1.MonacoEditorServices {
|
|
|
137
141
|
text: change.text
|
|
138
142
|
};
|
|
139
143
|
}
|
|
144
|
+
focus() {
|
|
145
|
+
this.editor.focus();
|
|
146
|
+
}
|
|
140
147
|
refresh() {
|
|
141
148
|
this.autoresize();
|
|
142
149
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"simple-monaco-editor.js","sourceRoot":"","sources":["../../src/browser/simple-monaco-editor.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,mDAA6F;AAE7F,8GAAqI;AACrI,gHAAqH;AACrH,sHAAmH;AACnH,wHAAqH;AACrH,sCAA6G;AAG7G,oDAAoD;AACpD,oEAAmE;
|
|
1
|
+
{"version":3,"file":"simple-monaco-editor.js","sourceRoot":"","sources":["../../src/browser/simple-monaco-editor.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,mDAA6F;AAE7F,8GAAqI;AACrI,gHAAqH;AACrH,sHAAmH;AACnH,wHAAqH;AACrH,sCAA6G;AAG7G,oDAAoD;AACpD,oEAAmE;AAInE,MAAa,kBAAmB,SAAQ,oCAAoB;IAkBxD,YACa,GAAQ,EACR,QAA2B,EAC3B,IAAiB,EAC1B,QAA8B,EAC9B,OAA+B,EAC/B,QAAiC,EACjC,aAAwC;QAExC,KAAK,CAAC,QAAQ,CAAC,CAAC;QARP,QAAG,GAAH,GAAG,CAAK;QACR,aAAQ,GAAR,QAAQ,CAAmB;QAC3B,SAAI,GAAJ,IAAI,CAAa;QAlBX,cAAS,GAAG,IAAI,2BAAoB,EAAE,CAAC;QAEvC,mCAA8B,GAAG,IAAI,cAAO,EAAY,CAAC;QACzD,0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,KAAK,CAAC;QAEpB,MAAM,MAAM,GAAG,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;YACrC,SAAS,CAAC,MAAM,CAAC;QAErB,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAC7B,CAAC;IAES,QAAQ,CAAC,QAAqB,EAAE,SAAgC;QACtE,OAAO,QAAQ,CAAC,WAAW,GAAG,SAAS,CAAC,aAAa,CAAC;IAC1D,CAAC;IAES,SAAS,CAAC,QAAqB,EAAE,SAAgC;QACvE,OAAO,IAAI,CAAC,MAAM,CAAC,gBAAgB,EAAE,CAAC;IAC1C,CAAC;IAED,OAAO;QACH,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,CAAC;IAC7B,CAAC;CAEJ;AArMD,gDAqMC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/monaco",
|
|
3
|
-
"version": "1.53.0-next.
|
|
3
|
+
"version": "1.53.0-next.64+23b351d26",
|
|
4
4
|
"description": "Theia - Monaco Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.53.0-next.
|
|
7
|
-
"@theia/editor": "1.53.0-next.
|
|
8
|
-
"@theia/filesystem": "1.53.0-next.
|
|
9
|
-
"@theia/markers": "1.53.0-next.
|
|
6
|
+
"@theia/core": "1.53.0-next.64+23b351d26",
|
|
7
|
+
"@theia/editor": "1.53.0-next.64+23b351d26",
|
|
8
|
+
"@theia/filesystem": "1.53.0-next.64+23b351d26",
|
|
9
|
+
"@theia/markers": "1.53.0-next.64+23b351d26",
|
|
10
10
|
"@theia/monaco-editor-core": "1.83.101",
|
|
11
|
-
"@theia/outline-view": "1.53.0-next.
|
|
12
|
-
"@theia/workspace": "1.53.0-next.
|
|
11
|
+
"@theia/outline-view": "1.53.0-next.64+23b351d26",
|
|
12
|
+
"@theia/workspace": "1.53.0-next.64+23b351d26",
|
|
13
13
|
"fast-plist": "^0.1.2",
|
|
14
14
|
"idb": "^4.0.5",
|
|
15
15
|
"jsonc-parser": "^2.2.0",
|
|
@@ -57,5 +57,5 @@
|
|
|
57
57
|
"nyc": {
|
|
58
58
|
"extends": "../../configs/nyc.json"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "23b351d26346a2b5d6aca3ee81fba59c056132f7"
|
|
61
61
|
}
|
package/src/browser/index.ts
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 TypeFox 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
|
-
export * from './monaco-frontend-module';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 TypeFox 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
|
+
export * from './monaco-frontend-module';
|
|
@@ -1,109 +1,109 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2022 Ericsson 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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
|
|
19
|
-
import { MarkdownRenderer as CodeMarkdownRenderer, IMarkdownRendererOptions } from '@theia/monaco-editor-core/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer';
|
|
20
|
-
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
21
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
22
|
-
import { OpenerService, PreferenceService, WidgetOpenerOptions, open } from '@theia/core/lib/browser';
|
|
23
|
-
import { IOpenerService, OpenExternalOptions, OpenInternalOptions } from '@theia/monaco-editor-core/esm/vs/platform/opener/common/opener';
|
|
24
|
-
import { HttpOpenHandlerOptions } from '@theia/core/lib/browser/http-open-handler';
|
|
25
|
-
import { URI } from '@theia/core/lib/common/uri';
|
|
26
|
-
import { MarkdownRenderer, MarkdownRenderOptions, MarkdownRenderResult } from '@theia/core/lib/browser/markdown-rendering/markdown-renderer';
|
|
27
|
-
import { MarkedOptions, MarkdownRenderOptions as MonacoMarkdownRenderOptions } from '@theia/monaco-editor-core/esm/vs/base/browser/markdownRenderer';
|
|
28
|
-
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
|
|
29
|
-
import { DisposableStore } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
|
|
30
|
-
import { DisposableCollection, DisposableGroup } from '@theia/core';
|
|
31
|
-
|
|
32
|
-
@injectable()
|
|
33
|
-
export class MonacoMarkdownRenderer implements MarkdownRenderer {
|
|
34
|
-
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
35
|
-
@inject(PreferenceService) protected readonly preferences: PreferenceService;
|
|
36
|
-
|
|
37
|
-
protected delegate: CodeMarkdownRenderer;
|
|
38
|
-
protected _openerService: OpenerService | undefined;
|
|
39
|
-
|
|
40
|
-
render(markdown: MarkdownString | undefined, options?: MarkdownRenderOptions, markedOptions?: MarkedOptions): MarkdownRenderResult {
|
|
41
|
-
return this.delegate.render(markdown, this.transformOptions(options), markedOptions);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
protected transformOptions(options?: MarkdownRenderOptions): MonacoMarkdownRenderOptions | undefined {
|
|
45
|
-
if (!options?.actionHandler) {
|
|
46
|
-
return options as MarkdownRenderOptions & { actionHandler: undefined } | undefined;
|
|
47
|
-
}
|
|
48
|
-
const monacoActionHandler: MonacoMarkdownRenderOptions['actionHandler'] = {
|
|
49
|
-
disposables: this.toDisposableStore(options.actionHandler.disposables),
|
|
50
|
-
callback: (content, e) => options.actionHandler!.callback(content, e?.browserEvent)
|
|
51
|
-
};
|
|
52
|
-
return { ...options, actionHandler: monacoActionHandler };
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
protected toDisposableStore(current: DisposableGroup): DisposableStore {
|
|
56
|
-
if (current instanceof DisposableStore) {
|
|
57
|
-
return current;
|
|
58
|
-
} else if (current instanceof DisposableCollection) {
|
|
59
|
-
const store = new DisposableStore();
|
|
60
|
-
current['disposables'].forEach(disposable => store.add(disposable));
|
|
61
|
-
return store;
|
|
62
|
-
} else {
|
|
63
|
-
return new DisposableStore();
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
@postConstruct()
|
|
68
|
-
protected init(): void {
|
|
69
|
-
const languages = StandaloneServices.get(ILanguageService);
|
|
70
|
-
const openerService = StandaloneServices.get(IOpenerService);
|
|
71
|
-
openerService.registerOpener({
|
|
72
|
-
open: (u, options) => this.interceptOpen(u, options)
|
|
73
|
-
});
|
|
74
|
-
const that = this;
|
|
75
|
-
const prefs = new class implements IMarkdownRendererOptions {
|
|
76
|
-
get codeBlockFontFamily(): string | undefined {
|
|
77
|
-
return that.preferences.get<string>('editor.fontFamily');
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
this.delegate = new CodeMarkdownRenderer(prefs, languages, openerService);
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
protected async interceptOpen(monacoUri: monaco.Uri | string, monacoOptions?: OpenInternalOptions | OpenExternalOptions): Promise<boolean> {
|
|
85
|
-
let options = undefined;
|
|
86
|
-
if (monacoOptions) {
|
|
87
|
-
if ('openToSide' in monacoOptions && monacoOptions.openToSide) {
|
|
88
|
-
options = Object.assign(options || {}, <WidgetOpenerOptions>{
|
|
89
|
-
widgetOptions: {
|
|
90
|
-
mode: 'split-right'
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
if ('openExternal' in monacoOptions && monacoOptions.openExternal) {
|
|
95
|
-
options = Object.assign(options || {}, <HttpOpenHandlerOptions>{
|
|
96
|
-
openExternal: true
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
const uri = new URI(monacoUri.toString());
|
|
101
|
-
try {
|
|
102
|
-
await open(this.openerService, uri, options);
|
|
103
|
-
return true;
|
|
104
|
-
} catch (e) {
|
|
105
|
-
console.error(`Fail to open '${uri.toString()}':`, e);
|
|
106
|
-
return false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2022 Ericsson 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 { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ILanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/languages/language';
|
|
19
|
+
import { MarkdownRenderer as CodeMarkdownRenderer, IMarkdownRendererOptions } from '@theia/monaco-editor-core/esm/vs/editor/contrib/markdownRenderer/browser/markdownRenderer';
|
|
20
|
+
import { StandaloneServices } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/standaloneServices';
|
|
21
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
22
|
+
import { OpenerService, PreferenceService, WidgetOpenerOptions, open } from '@theia/core/lib/browser';
|
|
23
|
+
import { IOpenerService, OpenExternalOptions, OpenInternalOptions } from '@theia/monaco-editor-core/esm/vs/platform/opener/common/opener';
|
|
24
|
+
import { HttpOpenHandlerOptions } from '@theia/core/lib/browser/http-open-handler';
|
|
25
|
+
import { URI } from '@theia/core/lib/common/uri';
|
|
26
|
+
import { MarkdownRenderer, MarkdownRenderOptions, MarkdownRenderResult } from '@theia/core/lib/browser/markdown-rendering/markdown-renderer';
|
|
27
|
+
import { MarkedOptions, MarkdownRenderOptions as MonacoMarkdownRenderOptions } from '@theia/monaco-editor-core/esm/vs/base/browser/markdownRenderer';
|
|
28
|
+
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
|
|
29
|
+
import { DisposableStore } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
|
|
30
|
+
import { DisposableCollection, DisposableGroup } from '@theia/core';
|
|
31
|
+
|
|
32
|
+
@injectable()
|
|
33
|
+
export class MonacoMarkdownRenderer implements MarkdownRenderer {
|
|
34
|
+
@inject(OpenerService) protected readonly openerService: OpenerService;
|
|
35
|
+
@inject(PreferenceService) protected readonly preferences: PreferenceService;
|
|
36
|
+
|
|
37
|
+
protected delegate: CodeMarkdownRenderer;
|
|
38
|
+
protected _openerService: OpenerService | undefined;
|
|
39
|
+
|
|
40
|
+
render(markdown: MarkdownString | undefined, options?: MarkdownRenderOptions, markedOptions?: MarkedOptions): MarkdownRenderResult {
|
|
41
|
+
return this.delegate.render(markdown, this.transformOptions(options), markedOptions);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
protected transformOptions(options?: MarkdownRenderOptions): MonacoMarkdownRenderOptions | undefined {
|
|
45
|
+
if (!options?.actionHandler) {
|
|
46
|
+
return options as MarkdownRenderOptions & { actionHandler: undefined } | undefined;
|
|
47
|
+
}
|
|
48
|
+
const monacoActionHandler: MonacoMarkdownRenderOptions['actionHandler'] = {
|
|
49
|
+
disposables: this.toDisposableStore(options.actionHandler.disposables),
|
|
50
|
+
callback: (content, e) => options.actionHandler!.callback(content, e?.browserEvent)
|
|
51
|
+
};
|
|
52
|
+
return { ...options, actionHandler: monacoActionHandler };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected toDisposableStore(current: DisposableGroup): DisposableStore {
|
|
56
|
+
if (current instanceof DisposableStore) {
|
|
57
|
+
return current;
|
|
58
|
+
} else if (current instanceof DisposableCollection) {
|
|
59
|
+
const store = new DisposableStore();
|
|
60
|
+
current['disposables'].forEach(disposable => store.add(disposable));
|
|
61
|
+
return store;
|
|
62
|
+
} else {
|
|
63
|
+
return new DisposableStore();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@postConstruct()
|
|
68
|
+
protected init(): void {
|
|
69
|
+
const languages = StandaloneServices.get(ILanguageService);
|
|
70
|
+
const openerService = StandaloneServices.get(IOpenerService);
|
|
71
|
+
openerService.registerOpener({
|
|
72
|
+
open: (u, options) => this.interceptOpen(u, options)
|
|
73
|
+
});
|
|
74
|
+
const that = this;
|
|
75
|
+
const prefs = new class implements IMarkdownRendererOptions {
|
|
76
|
+
get codeBlockFontFamily(): string | undefined {
|
|
77
|
+
return that.preferences.get<string>('editor.fontFamily');
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
this.delegate = new CodeMarkdownRenderer(prefs, languages, openerService);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected async interceptOpen(monacoUri: monaco.Uri | string, monacoOptions?: OpenInternalOptions | OpenExternalOptions): Promise<boolean> {
|
|
85
|
+
let options = undefined;
|
|
86
|
+
if (monacoOptions) {
|
|
87
|
+
if ('openToSide' in monacoOptions && monacoOptions.openToSide) {
|
|
88
|
+
options = Object.assign(options || {}, <WidgetOpenerOptions>{
|
|
89
|
+
widgetOptions: {
|
|
90
|
+
mode: 'split-right'
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
if ('openExternal' in monacoOptions && monacoOptions.openExternal) {
|
|
95
|
+
options = Object.assign(options || {}, <HttpOpenHandlerOptions>{
|
|
96
|
+
openExternal: true
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
const uri = new URI(monacoUri.toString());
|
|
101
|
+
try {
|
|
102
|
+
await open(this.openerService, uri, options);
|
|
103
|
+
return true;
|
|
104
|
+
} catch (e) {
|
|
105
|
+
console.error(`Fail to open '${uri.toString()}':`, e);
|
|
106
|
+
return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 TypeFox 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, inject } from '@theia/core/shared/inversify';
|
|
18
|
-
import { MonacoWorkspace } from './monaco-workspace';
|
|
19
|
-
import {
|
|
20
|
-
IBulkEditOptions, IBulkEditPreviewHandler, IBulkEditResult, IBulkEditService, ResourceEdit
|
|
21
|
-
} from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService';
|
|
22
|
-
import { IDisposable } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
|
|
23
|
-
import { WorkspaceEdit } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
|
|
24
|
-
|
|
25
|
-
@injectable()
|
|
26
|
-
export class MonacoBulkEditService implements IBulkEditService {
|
|
27
|
-
declare readonly _serviceBrand: undefined;
|
|
28
|
-
|
|
29
|
-
@inject(MonacoWorkspace)
|
|
30
|
-
protected readonly workspace: MonacoWorkspace;
|
|
31
|
-
|
|
32
|
-
private _previewHandler?: IBulkEditPreviewHandler;
|
|
33
|
-
|
|
34
|
-
async apply(editsIn: ResourceEdit[] | WorkspaceEdit, options?: IBulkEditOptions): Promise<IBulkEditResult> {
|
|
35
|
-
const edits = Array.isArray(editsIn) ? editsIn : ResourceEdit.convert(editsIn);
|
|
36
|
-
|
|
37
|
-
if (this._previewHandler && (options?.showPreview || edits.some(value => value.metadata?.needsConfirmation))) {
|
|
38
|
-
editsIn = await this._previewHandler(edits, options);
|
|
39
|
-
return { ariaSummary: '', isApplied: true };
|
|
40
|
-
} else {
|
|
41
|
-
return this.workspace.applyBulkEdit(edits, options);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
hasPreviewHandler(): boolean {
|
|
46
|
-
return Boolean(this._previewHandler);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
setPreviewHandler(handler: IBulkEditPreviewHandler): IDisposable {
|
|
50
|
-
this._previewHandler = handler;
|
|
51
|
-
|
|
52
|
-
const disposePreviewHandler = () => {
|
|
53
|
-
if (this._previewHandler === handler) {
|
|
54
|
-
this._previewHandler = undefined;
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
return {
|
|
59
|
-
dispose(): void {
|
|
60
|
-
disposePreviewHandler();
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 TypeFox 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, inject } from '@theia/core/shared/inversify';
|
|
18
|
+
import { MonacoWorkspace } from './monaco-workspace';
|
|
19
|
+
import {
|
|
20
|
+
IBulkEditOptions, IBulkEditPreviewHandler, IBulkEditResult, IBulkEditService, ResourceEdit
|
|
21
|
+
} from '@theia/monaco-editor-core/esm/vs/editor/browser/services/bulkEditService';
|
|
22
|
+
import { IDisposable } from '@theia/monaco-editor-core/esm/vs/base/common/lifecycle';
|
|
23
|
+
import { WorkspaceEdit } from '@theia/monaco-editor-core/esm/vs/editor/common/languages';
|
|
24
|
+
|
|
25
|
+
@injectable()
|
|
26
|
+
export class MonacoBulkEditService implements IBulkEditService {
|
|
27
|
+
declare readonly _serviceBrand: undefined;
|
|
28
|
+
|
|
29
|
+
@inject(MonacoWorkspace)
|
|
30
|
+
protected readonly workspace: MonacoWorkspace;
|
|
31
|
+
|
|
32
|
+
private _previewHandler?: IBulkEditPreviewHandler;
|
|
33
|
+
|
|
34
|
+
async apply(editsIn: ResourceEdit[] | WorkspaceEdit, options?: IBulkEditOptions): Promise<IBulkEditResult> {
|
|
35
|
+
const edits = Array.isArray(editsIn) ? editsIn : ResourceEdit.convert(editsIn);
|
|
36
|
+
|
|
37
|
+
if (this._previewHandler && (options?.showPreview || edits.some(value => value.metadata?.needsConfirmation))) {
|
|
38
|
+
editsIn = await this._previewHandler(edits, options);
|
|
39
|
+
return { ariaSummary: '', isApplied: true };
|
|
40
|
+
} else {
|
|
41
|
+
return this.workspace.applyBulkEdit(edits, options);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
hasPreviewHandler(): boolean {
|
|
46
|
+
return Boolean(this._previewHandler);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
setPreviewHandler(handler: IBulkEditPreviewHandler): IDisposable {
|
|
50
|
+
this._previewHandler = handler;
|
|
51
|
+
|
|
52
|
+
const disposePreviewHandler = () => {
|
|
53
|
+
if (this._previewHandler === handler) {
|
|
54
|
+
this._previewHandler = undefined;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
dispose(): void {
|
|
60
|
+
disposePreviewHandler();
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
}
|