@theia/monaco 1.34.1 → 1.34.3
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/LICENSE +641 -641
- 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 +392 -392
- 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/index.d.ts +1 -1
- package/lib/browser/index.js +28 -28
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.d.ts +24 -24
- package/lib/browser/markdown-renderer/monaco-markdown-renderer.js +137 -137
- package/lib/browser/monaco-bulk-edit-service.d.ts +14 -14
- package/lib/browser/monaco-bulk-edit-service.js +66 -66
- package/lib/browser/monaco-color-registry.d.ts +16 -16
- package/lib/browser/monaco-color-registry.js +82 -82
- package/lib/browser/monaco-command-registry.d.ts +19 -19
- package/lib/browser/monaco-command-registry.js +82 -82
- package/lib/browser/monaco-command-service.d.ts +26 -26
- package/lib/browser/monaco-command-service.js +92 -92
- package/lib/browser/monaco-command.d.ts +94 -94
- package/lib/browser/monaco-command.js +306 -306
- package/lib/browser/monaco-context-key-service.d.ts +22 -22
- package/lib/browser/monaco-context-key-service.js +147 -147
- package/lib/browser/monaco-context-menu.d.ts +16 -16
- package/lib/browser/monaco-context-menu.js +102 -102
- package/lib/browser/monaco-diagnostic-collection.d.ts +28 -28
- package/lib/browser/monaco-diagnostic-collection.js +86 -86
- package/lib/browser/monaco-diff-editor.d.ts +29 -29
- package/lib/browser/monaco-diff-editor.js +74 -74
- package/lib/browser/monaco-diff-navigator-factory.d.ts +7 -7
- package/lib/browser/monaco-diff-navigator-factory.js +66 -66
- package/lib/browser/monaco-editor-model.d.ts +156 -156
- package/lib/browser/monaco-editor-model.js +555 -555
- package/lib/browser/monaco-editor-provider.d.ts +89 -89
- package/lib/browser/monaco-editor-provider.js +440 -440
- package/lib/browser/monaco-editor-service.d.ts +27 -27
- package/lib/browser/monaco-editor-service.js +151 -151
- package/lib/browser/monaco-editor-zone-widget.d.ts +43 -43
- package/lib/browser/monaco-editor-zone-widget.js +194 -194
- package/lib/browser/monaco-editor.d.ts +151 -151
- package/lib/browser/monaco-editor.js +497 -497
- package/lib/browser/monaco-formatting-conflicts.d.ts +13 -13
- package/lib/browser/monaco-formatting-conflicts.js +110 -110
- package/lib/browser/monaco-frontend-application-contribution.d.ts +26 -26
- package/lib/browser/monaco-frontend-application-contribution.js +201 -201
- package/lib/browser/monaco-frontend-module.d.ts +7 -7
- package/lib/browser/monaco-frontend-module.js +266 -266
- package/lib/browser/monaco-gotoline-quick-access.d.ts +11 -11
- package/lib/browser/monaco-gotoline-quick-access.js +64 -64
- package/lib/browser/monaco-gotosymbol-quick-access.d.ts +16 -16
- package/lib/browser/monaco-gotosymbol-quick-access.js +70 -70
- package/lib/browser/monaco-indexed-db.d.ts +28 -28
- package/lib/browser/monaco-indexed-db.js +131 -131
- package/lib/browser/monaco-keybinding-contexts.d.ts +15 -15
- package/lib/browser/monaco-keybinding-contexts.js +50 -50
- package/lib/browser/monaco-keybinding.d.ts +16 -16
- package/lib/browser/monaco-keybinding.js +134 -134
- package/lib/browser/monaco-keycode-map.d.ts +2 -2
- package/lib/browser/monaco-keycode-map.js +163 -163
- package/lib/browser/monaco-languages.d.ts +27 -27
- package/lib/browser/monaco-languages.js +136 -136
- package/lib/browser/monaco-menu.d.ts +20 -20
- package/lib/browser/monaco-menu.js +145 -145
- package/lib/browser/monaco-mime-service.d.ts +10 -10
- package/lib/browser/monaco-mime-service.js +78 -78
- package/lib/browser/monaco-outline-contribution.d.ts +78 -78
- package/lib/browser/monaco-outline-contribution.js +384 -384
- package/lib/browser/monaco-outline-decorator.d.ts +12 -12
- package/lib/browser/monaco-outline-decorator.js +67 -67
- package/lib/browser/monaco-quick-access-registry.d.ts +11 -11
- package/lib/browser/monaco-quick-access-registry.js +99 -99
- package/lib/browser/monaco-quick-input-service.d.ts +99 -99
- package/lib/browser/monaco-quick-input-service.js +555 -555
- package/lib/browser/monaco-resolved-keybinding.d.ts +23 -23
- package/lib/browser/monaco-resolved-keybinding.js +131 -131
- package/lib/browser/monaco-snippet-suggest-provider.d.ts +64 -64
- package/lib/browser/monaco-snippet-suggest-provider.js +269 -269
- package/lib/browser/monaco-status-bar-contribution.d.ts +17 -17
- package/lib/browser/monaco-status-bar-contribution.js +120 -120
- package/lib/browser/monaco-text-model-service.d.ts +51 -51
- package/lib/browser/monaco-text-model-service.js +184 -184
- package/lib/browser/monaco-theming-service.d.ts +67 -67
- package/lib/browser/monaco-theming-service.js +171 -171
- package/lib/browser/monaco-to-protocol-converter.d.ts +26 -26
- package/lib/browser/monaco-to-protocol-converter.js +61 -61
- package/lib/browser/monaco-workspace.d.ts +83 -83
- package/lib/browser/monaco-workspace.js +369 -369
- package/lib/browser/protocol-to-monaco-converter.d.ts +31 -31
- package/lib/browser/protocol-to-monaco-converter.js +133 -133
- package/lib/browser/textmate/index.d.ts +4 -4
- package/lib/browser/textmate/index.js +31 -31
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.d.ts +12 -12
- package/lib/browser/textmate/monaco-textmate-frontend-bindings.js +94 -94
- package/lib/browser/textmate/monaco-textmate-service.d.ts +30 -30
- package/lib/browser/textmate/monaco-textmate-service.js +185 -185
- package/lib/browser/textmate/monaco-theme-registry.d.ts +27 -27
- package/lib/browser/textmate/monaco-theme-registry.js +171 -171
- package/lib/browser/textmate/monaco-theme-types.d.ts +20 -20
- package/lib/browser/textmate/monaco-theme-types.js +21 -21
- package/lib/browser/textmate/textmate-contribution.d.ts +9 -9
- package/lib/browser/textmate/textmate-contribution.js +27 -27
- package/lib/browser/textmate/textmate-registry.d.ts +31 -31
- package/lib/browser/textmate/textmate-registry.js +109 -109
- package/lib/browser/textmate/textmate-snippet-completion-provider.d.ts +26 -26
- package/lib/browser/textmate/textmate-snippet-completion-provider.js +53 -53
- package/lib/browser/textmate/textmate-tokenizer.d.ts +22 -22
- package/lib/browser/textmate/textmate-tokenizer.js +65 -65
- package/lib/browser/workspace-symbol-command.d.ts +55 -55
- package/lib/browser/workspace-symbol-command.js +215 -215
- package/lib/package.spec.js +25 -25
- package/package.json +8 -8
- package/src/browser/index.ts +17 -17
- package/src/browser/markdown-renderer/monaco-markdown-renderer.ts +117 -117
- 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 +82 -82
- package/src/browser/monaco-command-service.ts +99 -99
- package/src/browser/monaco-command.ts +311 -311
- package/src/browser/monaco-context-key-service.ts +143 -143
- package/src/browser/monaco-context-menu.ts +90 -90
- package/src/browser/monaco-diagnostic-collection.ts +101 -101
- package/src/browser/monaco-diff-editor.ts +101 -101
- package/src/browser/monaco-diff-navigator-factory.ts +61 -61
- package/src/browser/monaco-editor-model.ts +681 -681
- package/src/browser/monaco-editor-provider.ts +452 -452
- package/src/browser/monaco-editor-service.ts +144 -144
- package/src/browser/monaco-editor-zone-widget.ts +250 -250
- package/src/browser/monaco-editor.ts +644 -644
- package/src/browser/monaco-formatting-conflicts.ts +115 -115
- package/src/browser/monaco-frontend-application-contribution.ts +188 -188
- package/src/browser/monaco-frontend-module.ts +314 -314
- package/src/browser/monaco-gotoline-quick-access.ts +47 -47
- package/src/browser/monaco-gotosymbol-quick-access.ts +53 -53
- package/src/browser/monaco-indexed-db.ts +130 -130
- package/src/browser/monaco-keybinding-contexts.ts +43 -43
- package/src/browser/monaco-keybinding.ts +111 -111
- package/src/browser/monaco-keycode-map.ts +171 -171
- package/src/browser/monaco-languages.ts +129 -129
- package/src/browser/monaco-menu.ts +142 -142
- 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 +651 -651
- package/src/browser/monaco-resolved-keybinding.ts +162 -162
- package/src/browser/monaco-snippet-suggest-provider.ts +300 -300
- package/src/browser/monaco-status-bar-contribution.ts +109 -109
- package/src/browser/monaco-text-model-service.ts +194 -194
- package/src/browser/monaco-theming-service.ts +204 -204
- package/src/browser/monaco-to-protocol-converter.ts +71 -71
- package/src/browser/monaco-workspace.ts +393 -393
- package/src/browser/protocol-to-monaco-converter.ts +158 -158
- package/src/browser/style/index.css +267 -267
- package/src/browser/textmate/index.ts +20 -20
- package/src/browser/textmate/monaco-textmate-frontend-bindings.ts +94 -94
- 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
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.GotoLineQuickAccessContribution = exports.GotoLineQuickAccess = void 0;
|
|
31
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
-
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
33
|
-
const standaloneGotoLineQuickAccess_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess");
|
|
34
|
-
const quickAccess_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess");
|
|
35
|
-
const platform_1 = require("@theia/monaco-editor-core/esm/vs/platform/registry/common/platform");
|
|
36
|
-
let GotoLineQuickAccess = class GotoLineQuickAccess extends standaloneGotoLineQuickAccess_1.StandaloneGotoLineQuickAccessProvider {
|
|
37
|
-
constructor(service) {
|
|
38
|
-
super(service);
|
|
39
|
-
this.service = service;
|
|
40
|
-
}
|
|
41
|
-
get activeTextEditorControl() {
|
|
42
|
-
var _a;
|
|
43
|
-
return (_a = (this.service.getFocusedCodeEditor() || this.service.getActiveCodeEditor())) !== null && _a !== void 0 ? _a : undefined;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
GotoLineQuickAccess = __decorate([
|
|
47
|
-
__param(0, codeEditorService_1.ICodeEditorService),
|
|
48
|
-
__metadata("design:paramtypes", [Object])
|
|
49
|
-
], GotoLineQuickAccess);
|
|
50
|
-
exports.GotoLineQuickAccess = GotoLineQuickAccess;
|
|
51
|
-
let GotoLineQuickAccessContribution = class GotoLineQuickAccessContribution {
|
|
52
|
-
registerQuickAccessProvider() {
|
|
53
|
-
platform_1.Registry.as(quickAccess_1.Extensions.Quickaccess).registerQuickAccessProvider({
|
|
54
|
-
ctor: GotoLineQuickAccess,
|
|
55
|
-
prefix: ':',
|
|
56
|
-
placeholder: '',
|
|
57
|
-
helpEntries: [{ description: 'Go to line' }]
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
GotoLineQuickAccessContribution = __decorate([
|
|
62
|
-
(0, inversify_1.injectable)()
|
|
63
|
-
], GotoLineQuickAccessContribution);
|
|
64
|
-
exports.GotoLineQuickAccessContribution = GotoLineQuickAccessContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.GotoLineQuickAccessContribution = exports.GotoLineQuickAccess = void 0;
|
|
31
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
+
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
33
|
+
const standaloneGotoLineQuickAccess_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoLineQuickAccess");
|
|
34
|
+
const quickAccess_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess");
|
|
35
|
+
const platform_1 = require("@theia/monaco-editor-core/esm/vs/platform/registry/common/platform");
|
|
36
|
+
let GotoLineQuickAccess = class GotoLineQuickAccess extends standaloneGotoLineQuickAccess_1.StandaloneGotoLineQuickAccessProvider {
|
|
37
|
+
constructor(service) {
|
|
38
|
+
super(service);
|
|
39
|
+
this.service = service;
|
|
40
|
+
}
|
|
41
|
+
get activeTextEditorControl() {
|
|
42
|
+
var _a;
|
|
43
|
+
return (_a = (this.service.getFocusedCodeEditor() || this.service.getActiveCodeEditor())) !== null && _a !== void 0 ? _a : undefined;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
GotoLineQuickAccess = __decorate([
|
|
47
|
+
__param(0, codeEditorService_1.ICodeEditorService),
|
|
48
|
+
__metadata("design:paramtypes", [Object])
|
|
49
|
+
], GotoLineQuickAccess);
|
|
50
|
+
exports.GotoLineQuickAccess = GotoLineQuickAccess;
|
|
51
|
+
let GotoLineQuickAccessContribution = class GotoLineQuickAccessContribution {
|
|
52
|
+
registerQuickAccessProvider() {
|
|
53
|
+
platform_1.Registry.as(quickAccess_1.Extensions.Quickaccess).registerQuickAccessProvider({
|
|
54
|
+
ctor: GotoLineQuickAccess,
|
|
55
|
+
prefix: ':',
|
|
56
|
+
placeholder: '',
|
|
57
|
+
helpEntries: [{ description: 'Go to line' }]
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
GotoLineQuickAccessContribution = __decorate([
|
|
62
|
+
(0, inversify_1.injectable)()
|
|
63
|
+
], GotoLineQuickAccessContribution);
|
|
64
|
+
exports.GotoLineQuickAccessContribution = GotoLineQuickAccessContribution;
|
|
65
65
|
//# sourceMappingURL=monaco-gotoline-quick-access.js.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { QuickAccessContribution } from '@theia/core/lib/browser/quick-input';
|
|
2
|
-
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
3
|
-
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
4
|
-
import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
|
|
5
|
-
import { IOutlineModelService } from '@theia/monaco-editor-core/esm/vs/editor/contrib/documentSymbols/browser/outlineModel';
|
|
6
|
-
import { StandaloneGotoSymbolQuickAccessProvider } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess';
|
|
7
|
-
export declare class GotoSymbolQuickAccess extends StandaloneGotoSymbolQuickAccessProvider {
|
|
8
|
-
protected readonly codeEditorService: ICodeEditorService;
|
|
9
|
-
protected readonly languageFeatures: ILanguageFeaturesService;
|
|
10
|
-
protected readonly outlineService: IOutlineModelService;
|
|
11
|
-
constructor(...services: any[]);
|
|
12
|
-
get activeTextEditorControl(): ICodeEditor | undefined;
|
|
13
|
-
}
|
|
14
|
-
export declare class GotoSymbolQuickAccessContribution implements QuickAccessContribution {
|
|
15
|
-
registerQuickAccessProvider(): void;
|
|
16
|
-
}
|
|
1
|
+
import { QuickAccessContribution } from '@theia/core/lib/browser/quick-input';
|
|
2
|
+
import { ICodeEditor } from '@theia/monaco-editor-core/esm/vs/editor/browser/editorBrowser';
|
|
3
|
+
import { ICodeEditorService } from '@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService';
|
|
4
|
+
import { ILanguageFeaturesService } from '@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures';
|
|
5
|
+
import { IOutlineModelService } from '@theia/monaco-editor-core/esm/vs/editor/contrib/documentSymbols/browser/outlineModel';
|
|
6
|
+
import { StandaloneGotoSymbolQuickAccessProvider } from '@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess';
|
|
7
|
+
export declare class GotoSymbolQuickAccess extends StandaloneGotoSymbolQuickAccessProvider {
|
|
8
|
+
protected readonly codeEditorService: ICodeEditorService;
|
|
9
|
+
protected readonly languageFeatures: ILanguageFeaturesService;
|
|
10
|
+
protected readonly outlineService: IOutlineModelService;
|
|
11
|
+
constructor(...services: any[]);
|
|
12
|
+
get activeTextEditorControl(): ICodeEditor | undefined;
|
|
13
|
+
}
|
|
14
|
+
export declare class GotoSymbolQuickAccessContribution implements QuickAccessContribution {
|
|
15
|
+
registerQuickAccessProvider(): void;
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=monaco-gotosymbol-quick-access.d.ts.map
|
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
-
};
|
|
29
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.GotoSymbolQuickAccessContribution = exports.GotoSymbolQuickAccess = void 0;
|
|
31
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
-
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
33
|
-
const languageFeatures_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures");
|
|
34
|
-
const outlineModel_1 = require("@theia/monaco-editor-core/esm/vs/editor/contrib/documentSymbols/browser/outlineModel");
|
|
35
|
-
const standaloneGotoSymbolQuickAccess_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess");
|
|
36
|
-
const quickAccess_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess");
|
|
37
|
-
const platform_1 = require("@theia/monaco-editor-core/esm/vs/platform/registry/common/platform");
|
|
38
|
-
let GotoSymbolQuickAccess = class GotoSymbolQuickAccess extends standaloneGotoSymbolQuickAccess_1.StandaloneGotoSymbolQuickAccessProvider {
|
|
39
|
-
constructor(codeEditorService, languageFeatures, outlineService) {
|
|
40
|
-
super(codeEditorService, languageFeatures, outlineService);
|
|
41
|
-
this.codeEditorService = codeEditorService;
|
|
42
|
-
this.languageFeatures = languageFeatures;
|
|
43
|
-
this.outlineService = outlineService;
|
|
44
|
-
}
|
|
45
|
-
get activeTextEditorControl() {
|
|
46
|
-
var _a, _b;
|
|
47
|
-
return (_b = ((_a = this.codeEditorService.getFocusedCodeEditor()) !== null && _a !== void 0 ? _a : this.codeEditorService.getActiveCodeEditor())) !== null && _b !== void 0 ? _b : undefined;
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
GotoSymbolQuickAccess = __decorate([
|
|
51
|
-
__param(0, codeEditorService_1.ICodeEditorService),
|
|
52
|
-
__param(1, languageFeatures_1.ILanguageFeaturesService),
|
|
53
|
-
__param(2, outlineModel_1.IOutlineModelService),
|
|
54
|
-
__metadata("design:paramtypes", [Object, Object, Object])
|
|
55
|
-
], GotoSymbolQuickAccess);
|
|
56
|
-
exports.GotoSymbolQuickAccess = GotoSymbolQuickAccess;
|
|
57
|
-
let GotoSymbolQuickAccessContribution = class GotoSymbolQuickAccessContribution {
|
|
58
|
-
registerQuickAccessProvider() {
|
|
59
|
-
platform_1.Registry.as(quickAccess_1.Extensions.Quickaccess).registerQuickAccessProvider({
|
|
60
|
-
ctor: GotoSymbolQuickAccess,
|
|
61
|
-
prefix: '@',
|
|
62
|
-
placeholder: '',
|
|
63
|
-
helpEntries: [{ description: 'Go to symbol' }]
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
GotoSymbolQuickAccessContribution = __decorate([
|
|
68
|
-
(0, inversify_1.injectable)()
|
|
69
|
-
], GotoSymbolQuickAccessContribution);
|
|
70
|
-
exports.GotoSymbolQuickAccessContribution = GotoSymbolQuickAccessContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2021 SAP SE or an SAP affiliate company and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
27
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
exports.GotoSymbolQuickAccessContribution = exports.GotoSymbolQuickAccess = void 0;
|
|
31
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
32
|
+
const codeEditorService_1 = require("@theia/monaco-editor-core/esm/vs/editor/browser/services/codeEditorService");
|
|
33
|
+
const languageFeatures_1 = require("@theia/monaco-editor-core/esm/vs/editor/common/services/languageFeatures");
|
|
34
|
+
const outlineModel_1 = require("@theia/monaco-editor-core/esm/vs/editor/contrib/documentSymbols/browser/outlineModel");
|
|
35
|
+
const standaloneGotoSymbolQuickAccess_1 = require("@theia/monaco-editor-core/esm/vs/editor/standalone/browser/quickAccess/standaloneGotoSymbolQuickAccess");
|
|
36
|
+
const quickAccess_1 = require("@theia/monaco-editor-core/esm/vs/platform/quickinput/common/quickAccess");
|
|
37
|
+
const platform_1 = require("@theia/monaco-editor-core/esm/vs/platform/registry/common/platform");
|
|
38
|
+
let GotoSymbolQuickAccess = class GotoSymbolQuickAccess extends standaloneGotoSymbolQuickAccess_1.StandaloneGotoSymbolQuickAccessProvider {
|
|
39
|
+
constructor(codeEditorService, languageFeatures, outlineService) {
|
|
40
|
+
super(codeEditorService, languageFeatures, outlineService);
|
|
41
|
+
this.codeEditorService = codeEditorService;
|
|
42
|
+
this.languageFeatures = languageFeatures;
|
|
43
|
+
this.outlineService = outlineService;
|
|
44
|
+
}
|
|
45
|
+
get activeTextEditorControl() {
|
|
46
|
+
var _a, _b;
|
|
47
|
+
return (_b = ((_a = this.codeEditorService.getFocusedCodeEditor()) !== null && _a !== void 0 ? _a : this.codeEditorService.getActiveCodeEditor())) !== null && _b !== void 0 ? _b : undefined;
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
GotoSymbolQuickAccess = __decorate([
|
|
51
|
+
__param(0, codeEditorService_1.ICodeEditorService),
|
|
52
|
+
__param(1, languageFeatures_1.ILanguageFeaturesService),
|
|
53
|
+
__param(2, outlineModel_1.IOutlineModelService),
|
|
54
|
+
__metadata("design:paramtypes", [Object, Object, Object])
|
|
55
|
+
], GotoSymbolQuickAccess);
|
|
56
|
+
exports.GotoSymbolQuickAccess = GotoSymbolQuickAccess;
|
|
57
|
+
let GotoSymbolQuickAccessContribution = class GotoSymbolQuickAccessContribution {
|
|
58
|
+
registerQuickAccessProvider() {
|
|
59
|
+
platform_1.Registry.as(quickAccess_1.Extensions.Quickaccess).registerQuickAccessProvider({
|
|
60
|
+
ctor: GotoSymbolQuickAccess,
|
|
61
|
+
prefix: '@',
|
|
62
|
+
placeholder: '',
|
|
63
|
+
helpEntries: [{ description: 'Go to symbol' }]
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
GotoSymbolQuickAccessContribution = __decorate([
|
|
68
|
+
(0, inversify_1.injectable)()
|
|
69
|
+
], GotoSymbolQuickAccessContribution);
|
|
70
|
+
exports.GotoSymbolQuickAccessContribution = GotoSymbolQuickAccessContribution;
|
|
71
71
|
//# sourceMappingURL=monaco-gotosymbol-quick-access.js.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import * as idb from 'idb';
|
|
2
|
-
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
3
|
-
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
4
|
-
import * as monaco from '@theia/monaco-editor-core';
|
|
5
|
-
import type { ThemeMix } from './textmate/monaco-theme-types';
|
|
6
|
-
import { Theme } from '@theia/core/lib/common/theme';
|
|
7
|
-
import { Emitter, Event } from '@theia/core';
|
|
8
|
-
export declare const monacoDB: Promise<idb.IDBPDatabase<unknown>> | undefined;
|
|
9
|
-
export interface MonacoThemeState {
|
|
10
|
-
id: string;
|
|
11
|
-
label: string;
|
|
12
|
-
description?: string;
|
|
13
|
-
uiTheme: monaco.editor.BuiltinTheme;
|
|
14
|
-
data: ThemeMix;
|
|
15
|
-
}
|
|
16
|
-
export declare namespace MonacoThemeState {
|
|
17
|
-
function is(state: unknown): state is MonacoThemeState;
|
|
18
|
-
}
|
|
19
|
-
export declare function getThemes(): Promise<MonacoThemeState[]>;
|
|
20
|
-
export declare function putTheme(state: MonacoThemeState): Disposable;
|
|
21
|
-
export declare function deleteTheme(id: string): Promise<void>;
|
|
22
|
-
export declare function stateToTheme(state: MonacoThemeState): Theme;
|
|
23
|
-
export declare class ThemeServiceWithDB extends ThemeService {
|
|
24
|
-
protected onDidRetrieveThemeEmitter: Emitter<MonacoThemeState>;
|
|
25
|
-
get onDidRetrieveTheme(): Event<MonacoThemeState>;
|
|
26
|
-
loadUserTheme(): void;
|
|
27
|
-
protected loadUserThemeWithDB(): Promise<void>;
|
|
28
|
-
}
|
|
1
|
+
import * as idb from 'idb';
|
|
2
|
+
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
3
|
+
import { ThemeService } from '@theia/core/lib/browser/theming';
|
|
4
|
+
import * as monaco from '@theia/monaco-editor-core';
|
|
5
|
+
import type { ThemeMix } from './textmate/monaco-theme-types';
|
|
6
|
+
import { Theme } from '@theia/core/lib/common/theme';
|
|
7
|
+
import { Emitter, Event } from '@theia/core';
|
|
8
|
+
export declare const monacoDB: Promise<idb.IDBPDatabase<unknown>> | undefined;
|
|
9
|
+
export interface MonacoThemeState {
|
|
10
|
+
id: string;
|
|
11
|
+
label: string;
|
|
12
|
+
description?: string;
|
|
13
|
+
uiTheme: monaco.editor.BuiltinTheme;
|
|
14
|
+
data: ThemeMix;
|
|
15
|
+
}
|
|
16
|
+
export declare namespace MonacoThemeState {
|
|
17
|
+
function is(state: unknown): state is MonacoThemeState;
|
|
18
|
+
}
|
|
19
|
+
export declare function getThemes(): Promise<MonacoThemeState[]>;
|
|
20
|
+
export declare function putTheme(state: MonacoThemeState): Disposable;
|
|
21
|
+
export declare function deleteTheme(id: string): Promise<void>;
|
|
22
|
+
export declare function stateToTheme(state: MonacoThemeState): Theme;
|
|
23
|
+
export declare class ThemeServiceWithDB extends ThemeService {
|
|
24
|
+
protected onDidRetrieveThemeEmitter: Emitter<MonacoThemeState>;
|
|
25
|
+
get onDidRetrieveTheme(): Event<MonacoThemeState>;
|
|
26
|
+
loadUserTheme(): void;
|
|
27
|
+
protected loadUserThemeWithDB(): Promise<void>;
|
|
28
|
+
}
|
|
29
29
|
//# sourceMappingURL=monaco-indexed-db.d.ts.map
|
|
@@ -1,132 +1,132 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2020 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.ThemeServiceWithDB = exports.stateToTheme = exports.deleteTheme = exports.putTheme = exports.getThemes = exports.MonacoThemeState = exports.monacoDB = void 0;
|
|
25
|
-
const idb = require("idb");
|
|
26
|
-
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
27
|
-
const theming_1 = require("@theia/core/lib/browser/theming");
|
|
28
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
-
const core_1 = require("@theia/core");
|
|
30
|
-
let _monacoDB;
|
|
31
|
-
if ('indexedDB' in window) {
|
|
32
|
-
_monacoDB = idb.openDB('theia-monaco', 1, {
|
|
33
|
-
upgrade: db => {
|
|
34
|
-
if (!db.objectStoreNames.contains('themes')) {
|
|
35
|
-
db.createObjectStore('themes', { keyPath: 'id' });
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
exports.monacoDB = _monacoDB;
|
|
41
|
-
var MonacoThemeState;
|
|
42
|
-
(function (MonacoThemeState) {
|
|
43
|
-
function is(state) {
|
|
44
|
-
return (0, core_1.isObject)(state) && 'id' in state && 'label' in state && 'uiTheme' in state && 'data' in state;
|
|
45
|
-
}
|
|
46
|
-
MonacoThemeState.is = is;
|
|
47
|
-
})(MonacoThemeState = exports.MonacoThemeState || (exports.MonacoThemeState = {}));
|
|
48
|
-
async function getThemes() {
|
|
49
|
-
if (!exports.monacoDB) {
|
|
50
|
-
return [];
|
|
51
|
-
}
|
|
52
|
-
const db = await exports.monacoDB;
|
|
53
|
-
const result = await db.transaction('themes', 'readonly').objectStore('themes').getAll();
|
|
54
|
-
return result.filter(MonacoThemeState.is);
|
|
55
|
-
}
|
|
56
|
-
exports.getThemes = getThemes;
|
|
57
|
-
function putTheme(state) {
|
|
58
|
-
const toDispose = new disposable_1.DisposableCollection(disposable_1.Disposable.create(() => { }));
|
|
59
|
-
doPutTheme(state, toDispose);
|
|
60
|
-
return toDispose;
|
|
61
|
-
}
|
|
62
|
-
exports.putTheme = putTheme;
|
|
63
|
-
async function doPutTheme(state, toDispose) {
|
|
64
|
-
if (!exports.monacoDB) {
|
|
65
|
-
return;
|
|
66
|
-
}
|
|
67
|
-
const db = await exports.monacoDB;
|
|
68
|
-
if (toDispose.disposed) {
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
const id = state.id;
|
|
72
|
-
await db.transaction('themes', 'readwrite').objectStore('themes').put(state);
|
|
73
|
-
if (toDispose.disposed) {
|
|
74
|
-
await deleteTheme(id);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
toDispose.push(disposable_1.Disposable.create(() => deleteTheme(id)));
|
|
78
|
-
}
|
|
79
|
-
async function deleteTheme(id) {
|
|
80
|
-
if (!exports.monacoDB) {
|
|
81
|
-
return;
|
|
82
|
-
}
|
|
83
|
-
const db = await exports.monacoDB;
|
|
84
|
-
await db.transaction('themes', 'readwrite').objectStore('themes').delete(id);
|
|
85
|
-
}
|
|
86
|
-
exports.deleteTheme = deleteTheme;
|
|
87
|
-
function stateToTheme(state) {
|
|
88
|
-
const { id, label, description, uiTheme, data } = state;
|
|
89
|
-
const type = uiTheme === 'vs' ? 'light' : uiTheme === 'vs-dark' ? 'dark' : 'hc';
|
|
90
|
-
return {
|
|
91
|
-
type,
|
|
92
|
-
id,
|
|
93
|
-
label,
|
|
94
|
-
description,
|
|
95
|
-
editorTheme: data.name
|
|
96
|
-
};
|
|
97
|
-
}
|
|
98
|
-
exports.stateToTheme = stateToTheme;
|
|
99
|
-
let ThemeServiceWithDB = class ThemeServiceWithDB extends theming_1.ThemeService {
|
|
100
|
-
constructor() {
|
|
101
|
-
super(...arguments);
|
|
102
|
-
this.onDidRetrieveThemeEmitter = new core_1.Emitter();
|
|
103
|
-
}
|
|
104
|
-
get onDidRetrieveTheme() {
|
|
105
|
-
return this.onDidRetrieveThemeEmitter.event;
|
|
106
|
-
}
|
|
107
|
-
loadUserTheme() {
|
|
108
|
-
this.loadUserThemeWithDB();
|
|
109
|
-
}
|
|
110
|
-
async loadUserThemeWithDB() {
|
|
111
|
-
var _a, _b, _c;
|
|
112
|
-
const themeId = (_a = window.localStorage.getItem(theming_1.ThemeService.STORAGE_KEY)) !== null && _a !== void 0 ? _a : this.defaultTheme.id;
|
|
113
|
-
const theme = (_c = (_b = this.themes[themeId]) !== null && _b !== void 0 ? _b : await getThemes().then(themes => {
|
|
114
|
-
const matchingTheme = themes.find(candidate => candidate.id === themeId);
|
|
115
|
-
if (matchingTheme) {
|
|
116
|
-
this.onDidRetrieveThemeEmitter.fire(matchingTheme);
|
|
117
|
-
return stateToTheme(matchingTheme);
|
|
118
|
-
}
|
|
119
|
-
})) !== null && _c !== void 0 ? _c : this.getTheme(themeId);
|
|
120
|
-
// In case the theme comes from the DB.
|
|
121
|
-
if (!this.themes[theme.id]) {
|
|
122
|
-
this.themes[theme.id] = theme;
|
|
123
|
-
}
|
|
124
|
-
this.setCurrentTheme(theme.id, false);
|
|
125
|
-
this.deferredInitializer.resolve();
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
ThemeServiceWithDB = __decorate([
|
|
129
|
-
(0, inversify_1.injectable)()
|
|
130
|
-
], ThemeServiceWithDB);
|
|
131
|
-
exports.ThemeServiceWithDB = ThemeServiceWithDB;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2020 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.ThemeServiceWithDB = exports.stateToTheme = exports.deleteTheme = exports.putTheme = exports.getThemes = exports.MonacoThemeState = exports.monacoDB = void 0;
|
|
25
|
+
const idb = require("idb");
|
|
26
|
+
const disposable_1 = require("@theia/core/lib/common/disposable");
|
|
27
|
+
const theming_1 = require("@theia/core/lib/browser/theming");
|
|
28
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
29
|
+
const core_1 = require("@theia/core");
|
|
30
|
+
let _monacoDB;
|
|
31
|
+
if ('indexedDB' in window) {
|
|
32
|
+
_monacoDB = idb.openDB('theia-monaco', 1, {
|
|
33
|
+
upgrade: db => {
|
|
34
|
+
if (!db.objectStoreNames.contains('themes')) {
|
|
35
|
+
db.createObjectStore('themes', { keyPath: 'id' });
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
exports.monacoDB = _monacoDB;
|
|
41
|
+
var MonacoThemeState;
|
|
42
|
+
(function (MonacoThemeState) {
|
|
43
|
+
function is(state) {
|
|
44
|
+
return (0, core_1.isObject)(state) && 'id' in state && 'label' in state && 'uiTheme' in state && 'data' in state;
|
|
45
|
+
}
|
|
46
|
+
MonacoThemeState.is = is;
|
|
47
|
+
})(MonacoThemeState = exports.MonacoThemeState || (exports.MonacoThemeState = {}));
|
|
48
|
+
async function getThemes() {
|
|
49
|
+
if (!exports.monacoDB) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const db = await exports.monacoDB;
|
|
53
|
+
const result = await db.transaction('themes', 'readonly').objectStore('themes').getAll();
|
|
54
|
+
return result.filter(MonacoThemeState.is);
|
|
55
|
+
}
|
|
56
|
+
exports.getThemes = getThemes;
|
|
57
|
+
function putTheme(state) {
|
|
58
|
+
const toDispose = new disposable_1.DisposableCollection(disposable_1.Disposable.create(() => { }));
|
|
59
|
+
doPutTheme(state, toDispose);
|
|
60
|
+
return toDispose;
|
|
61
|
+
}
|
|
62
|
+
exports.putTheme = putTheme;
|
|
63
|
+
async function doPutTheme(state, toDispose) {
|
|
64
|
+
if (!exports.monacoDB) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
const db = await exports.monacoDB;
|
|
68
|
+
if (toDispose.disposed) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
const id = state.id;
|
|
72
|
+
await db.transaction('themes', 'readwrite').objectStore('themes').put(state);
|
|
73
|
+
if (toDispose.disposed) {
|
|
74
|
+
await deleteTheme(id);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
toDispose.push(disposable_1.Disposable.create(() => deleteTheme(id)));
|
|
78
|
+
}
|
|
79
|
+
async function deleteTheme(id) {
|
|
80
|
+
if (!exports.monacoDB) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const db = await exports.monacoDB;
|
|
84
|
+
await db.transaction('themes', 'readwrite').objectStore('themes').delete(id);
|
|
85
|
+
}
|
|
86
|
+
exports.deleteTheme = deleteTheme;
|
|
87
|
+
function stateToTheme(state) {
|
|
88
|
+
const { id, label, description, uiTheme, data } = state;
|
|
89
|
+
const type = uiTheme === 'vs' ? 'light' : uiTheme === 'vs-dark' ? 'dark' : 'hc';
|
|
90
|
+
return {
|
|
91
|
+
type,
|
|
92
|
+
id,
|
|
93
|
+
label,
|
|
94
|
+
description,
|
|
95
|
+
editorTheme: data.name
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
exports.stateToTheme = stateToTheme;
|
|
99
|
+
let ThemeServiceWithDB = class ThemeServiceWithDB extends theming_1.ThemeService {
|
|
100
|
+
constructor() {
|
|
101
|
+
super(...arguments);
|
|
102
|
+
this.onDidRetrieveThemeEmitter = new core_1.Emitter();
|
|
103
|
+
}
|
|
104
|
+
get onDidRetrieveTheme() {
|
|
105
|
+
return this.onDidRetrieveThemeEmitter.event;
|
|
106
|
+
}
|
|
107
|
+
loadUserTheme() {
|
|
108
|
+
this.loadUserThemeWithDB();
|
|
109
|
+
}
|
|
110
|
+
async loadUserThemeWithDB() {
|
|
111
|
+
var _a, _b, _c;
|
|
112
|
+
const themeId = (_a = window.localStorage.getItem(theming_1.ThemeService.STORAGE_KEY)) !== null && _a !== void 0 ? _a : this.defaultTheme.id;
|
|
113
|
+
const theme = (_c = (_b = this.themes[themeId]) !== null && _b !== void 0 ? _b : await getThemes().then(themes => {
|
|
114
|
+
const matchingTheme = themes.find(candidate => candidate.id === themeId);
|
|
115
|
+
if (matchingTheme) {
|
|
116
|
+
this.onDidRetrieveThemeEmitter.fire(matchingTheme);
|
|
117
|
+
return stateToTheme(matchingTheme);
|
|
118
|
+
}
|
|
119
|
+
})) !== null && _c !== void 0 ? _c : this.getTheme(themeId);
|
|
120
|
+
// In case the theme comes from the DB.
|
|
121
|
+
if (!this.themes[theme.id]) {
|
|
122
|
+
this.themes[theme.id] = theme;
|
|
123
|
+
}
|
|
124
|
+
this.setCurrentTheme(theme.id, false);
|
|
125
|
+
this.deferredInitializer.resolve();
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
ThemeServiceWithDB = __decorate([
|
|
129
|
+
(0, inversify_1.injectable)()
|
|
130
|
+
], ThemeServiceWithDB);
|
|
131
|
+
exports.ThemeServiceWithDB = ThemeServiceWithDB;
|
|
132
132
|
//# sourceMappingURL=monaco-indexed-db.js.map
|