@theia/plugin-ext 1.18.0-next.d3501165 → 1.19.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/LICENSE +642 -0
- package/README.md +5 -0
- package/lib/common/arrays.d.ts +4 -0
- package/lib/common/arrays.d.ts.map +1 -1
- package/lib/common/arrays.js +9 -1
- package/lib/common/arrays.js.map +1 -1
- package/lib/common/connection.d.ts +1 -2
- package/lib/common/connection.d.ts.map +1 -1
- package/lib/common/connection.js.map +1 -1
- package/lib/common/plugin-api-rpc-model.d.ts +4 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +29 -11
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +21 -1
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +1 -0
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/hosted/browser/hosted-plugin.d.ts +5 -6
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +19 -13
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
- package/lib/hosted/browser/worker/debug-stub.js +1 -0
- package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-deployer-handler.js +14 -38
- package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts +37 -0
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js +197 -0
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -0
- package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
- package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-process.js +5 -7
- package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
- package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts +1 -1
- package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-manifest-loader.js +4 -52
- package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
- package/lib/hosted/node/plugin-service.d.ts +3 -6
- package/lib/hosted/node/plugin-service.d.ts.map +1 -1
- package/lib/hosted/node/plugin-service.js +7 -40
- package/lib/hosted/node/plugin-service.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +3 -2
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +6 -2
- package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +2 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editor-opener.js +6 -2
- package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
- package/lib/main/browser/custom-editors/custom-editors-main.js +1 -2
- package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
- package/lib/main/browser/debug/debug-main.js +1 -1
- package/lib/main/browser/debug/debug-main.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
- package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
- package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-service.js +15 -0
- package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +2 -2
- package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
- package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.d.ts +4 -4
- package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
- package/lib/main/browser/dialogs/modal-notification.js +21 -10
- package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
- package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
- package/lib/main/browser/editors-and-documents-main.js +3 -4
- package/lib/main/browser/editors-and-documents-main.js.map +1 -1
- package/lib/main/browser/languages-main.js +1 -1
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/message-registry-main.js +1 -1
- package/lib/main/browser/message-registry-main.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/plugin-ext-widget.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-widget.js +3 -2
- package/lib/main/browser/plugin-ext-widget.js.map +1 -1
- package/lib/main/browser/plugin-shared-style.js +1 -1
- package/lib/main/browser/plugin-shared-style.js.map +1 -1
- package/lib/main/browser/quick-open-main.d.ts +3 -6
- package/lib/main/browser/quick-open-main.d.ts.map +1 -1
- package/lib/main/browser/quick-open-main.js +48 -100
- package/lib/main/browser/quick-open-main.js.map +1 -1
- package/lib/main/browser/timeline-main.d.ts.map +1 -1
- package/lib/main/browser/timeline-main.js +1 -1
- package/lib/main/browser/timeline-main.js.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.d.ts +3 -2
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +64 -24
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
- package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-widget.js +3 -1
- package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
- package/lib/main/browser/view/tree-view-widget.d.ts +3 -4
- package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
- package/lib/main/browser/view/tree-view-widget.js +25 -28
- package/lib/main/browser/view/tree-view-widget.js.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-frontend-security-warnings.js +8 -5
- package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
- package/lib/main/browser/webview/webview-preferences.d.ts.map +1 -1
- package/lib/main/browser/webview/webview-preferences.js +3 -2
- package/lib/main/browser/webview/webview-preferences.js.map +1 -1
- package/lib/main/browser/webview/webview.d.ts +1 -1
- package/lib/main/browser/webview/webview.d.ts.map +1 -1
- package/lib/main/browser/webview/webview.js +2 -2
- package/lib/main/browser/webview/webview.js.map +1 -1
- package/lib/plugin/comments.d.ts.map +1 -1
- package/lib/plugin/comments.js +2 -3
- package/lib/plugin/comments.js.map +1 -1
- package/lib/plugin/custom-editors.d.ts +1 -2
- package/lib/plugin/custom-editors.d.ts.map +1 -1
- package/lib/plugin/custom-editors.js +2 -3
- package/lib/plugin/custom-editors.js.map +1 -1
- package/lib/plugin/decorations.d.ts.map +1 -1
- package/lib/plugin/decorations.js +2 -3
- package/lib/plugin/decorations.js.map +1 -1
- package/lib/plugin/document-data.d.ts.map +1 -1
- package/lib/plugin/document-data.js +1 -1
- package/lib/plugin/document-data.js.map +1 -1
- package/lib/plugin/documents.d.ts.map +1 -1
- package/lib/plugin/documents.js +1 -2
- package/lib/plugin/documents.js.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-event-service-ext-impl.js +2 -3
- package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
- package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
- package/lib/plugin/file-system-ext-impl.js +12 -13
- package/lib/plugin/file-system-ext-impl.js.map +1 -1
- package/lib/plugin/known-commands.spec.js +1 -2
- package/lib/plugin/known-commands.spec.js.map +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts +1 -1
- package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
- package/lib/plugin/languages/call-hierarchy.js +8 -3
- package/lib/plugin/languages/call-hierarchy.js.map +1 -1
- package/lib/plugin/languages/rename.d.ts +1 -2
- package/lib/plugin/languages/rename.d.ts.map +1 -1
- package/lib/plugin/languages/rename.js.map +1 -1
- package/lib/plugin/languages.d.ts +1 -1
- package/lib/plugin/languages.d.ts.map +1 -1
- package/lib/plugin/languages.js +2 -1
- package/lib/plugin/languages.js.map +1 -1
- package/lib/plugin/message-registry.d.ts.map +1 -1
- package/lib/plugin/message-registry.js +8 -5
- package/lib/plugin/message-registry.js.map +1 -1
- package/lib/plugin/node/debug/debug.d.ts +4 -3
- package/lib/plugin/node/debug/debug.d.ts.map +1 -1
- package/lib/plugin/node/debug/debug.js +34 -15
- package/lib/plugin/node/debug/debug.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
- package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
- package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +8 -3
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/plugin-manager.d.ts +2 -0
- package/lib/plugin/plugin-manager.d.ts.map +1 -1
- package/lib/plugin/plugin-manager.js +24 -3
- package/lib/plugin/plugin-manager.js.map +1 -1
- package/lib/plugin/plugin-storage.d.ts +4 -0
- package/lib/plugin/plugin-storage.d.ts.map +1 -1
- package/lib/plugin/plugin-storage.js +6 -1
- package/lib/plugin/plugin-storage.js.map +1 -1
- package/lib/plugin/preference-registry.spec.js.map +1 -1
- package/lib/plugin/quick-open.d.ts +1 -3
- package/lib/plugin/quick-open.d.ts.map +1 -1
- package/lib/plugin/quick-open.js +10 -25
- package/lib/plugin/quick-open.js.map +1 -1
- package/lib/plugin/tasks/tasks.d.ts +1 -1
- package/lib/plugin/tasks/tasks.d.ts.map +1 -1
- package/lib/plugin/tasks/tasks.js +3 -2
- package/lib/plugin/tasks/tasks.js.map +1 -1
- package/lib/plugin/timeline.d.ts.map +1 -1
- package/lib/plugin/timeline.js +1 -2
- package/lib/plugin/timeline.js.map +1 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +18 -11
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +55 -1
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +81 -1
- package/lib/plugin/types-impl.js.map +1 -1
- package/lib/plugin/webviews.d.ts +1 -2
- package/lib/plugin/webviews.d.ts.map +1 -1
- package/lib/plugin/webviews.js.map +1 -1
- package/package.json +31 -27
- package/src/common/arrays.ts +8 -0
- package/src/common/connection.ts +1 -2
- package/src/common/plugin-api-rpc-model.ts +4 -0
- package/src/common/plugin-api-rpc.ts +31 -10
- package/src/common/plugin-protocol.ts +2 -0
- package/src/hosted/browser/hosted-plugin.ts +19 -12
- package/src/hosted/browser/worker/debug-stub.ts +1 -0
- package/src/hosted/node/hosted-plugin-deployer-handler.ts +13 -40
- package/src/hosted/node/hosted-plugin-localization-service.ts +201 -0
- package/src/hosted/node/hosted-plugin-process.ts +4 -6
- package/src/hosted/node/plugin-ext-hosted-backend-module.ts +2 -0
- package/src/hosted/node/plugin-manifest-loader.ts +4 -56
- package/src/hosted/node/plugin-service.ts +7 -40
- package/src/hosted/node/scanners/scanner-theia.ts +4 -2
- package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +6 -2
- package/src/main/browser/custom-editors/custom-editor-opener.tsx +8 -4
- package/src/main/browser/custom-editors/custom-editors-main.ts +1 -2
- package/src/main/browser/debug/debug-main.ts +1 -1
- package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
- package/src/main/browser/debug/plugin-debug-service.ts +23 -0
- package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
- package/src/main/browser/dialogs/modal-notification.ts +24 -13
- package/src/main/browser/dialogs/style/modal-notification.css +17 -2
- package/src/main/browser/editors-and-documents-main.ts +1 -2
- package/src/main/browser/languages-main.ts +1 -1
- package/src/main/browser/message-registry-main.ts +1 -1
- package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
- package/src/main/browser/plugin-ext-widget.tsx +3 -2
- package/src/main/browser/plugin-shared-style.ts +1 -1
- package/src/main/browser/quick-open-main.ts +54 -109
- package/src/main/browser/style/index.css +1 -5
- package/src/main/browser/style/plugin-sidebar.css +1 -1
- package/src/main/browser/timeline-main.ts +1 -2
- package/src/main/browser/view/plugin-view-registry.ts +68 -26
- package/src/main/browser/view/plugin-view-widget.ts +7 -2
- package/src/main/browser/view/tree-view-widget.tsx +41 -46
- package/src/main/browser/webview/pre/host.js +20 -12
- package/src/main/browser/webview/pre/main.js +1 -2
- package/src/main/browser/webview/pre/service-worker.js +1 -1
- package/src/main/browser/webview/webview-frontend-security-warnings.ts +8 -7
- package/src/main/browser/webview/webview-preferences.ts +3 -2
- package/src/main/browser/webview/webview.ts +2 -2
- package/src/plugin/comments.ts +1 -2
- package/src/plugin/custom-editors.ts +2 -4
- package/src/plugin/decorations.ts +1 -2
- package/src/plugin/document-data.ts +1 -2
- package/src/plugin/documents.ts +1 -2
- package/src/plugin/file-system-event-service-ext-impl.ts +1 -2
- package/src/plugin/file-system-ext-impl.ts +1 -2
- package/src/plugin/known-commands.spec.ts +1 -2
- package/src/plugin/languages/call-hierarchy.ts +14 -5
- package/src/plugin/languages/rename.ts +1 -2
- package/src/plugin/languages.ts +5 -2
- package/src/plugin/message-registry.ts +9 -6
- package/src/plugin/node/debug/debug.ts +40 -19
- package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
- package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
- package/src/plugin/plugin-context.ts +21 -10
- package/src/plugin/plugin-manager.ts +26 -4
- package/src/plugin/plugin-storage.ts +7 -2
- package/src/plugin/preference-registry.spec.ts +1 -2
- package/src/plugin/quick-open.ts +12 -29
- package/src/plugin/tasks/tasks.ts +3 -2
- package/src/plugin/timeline.ts +1 -2
- package/src/plugin/type-converters.ts +20 -13
- package/src/plugin/types-impl.ts +77 -1
- package/src/plugin/webviews.ts +1 -2
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
17
17
|
|
|
18
|
-
import { InputBoxOptions
|
|
18
|
+
import { InputBoxOptions } from '@theia/plugin';
|
|
19
19
|
import { interfaces } from '@theia/core/shared/inversify';
|
|
20
20
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
21
21
|
import {
|
|
@@ -23,15 +23,17 @@ import {
|
|
|
23
23
|
QuickOpenMain,
|
|
24
24
|
MAIN_RPC_CONTEXT,
|
|
25
25
|
TransferInputBox,
|
|
26
|
-
TransferQuickPick,
|
|
27
26
|
TransferQuickPickItems,
|
|
28
27
|
TransferQuickInput,
|
|
29
28
|
TransferQuickInputButton
|
|
30
29
|
} from '../../common/plugin-api-rpc';
|
|
31
30
|
import {
|
|
32
|
-
InputOptions,
|
|
31
|
+
InputOptions,
|
|
32
|
+
PickOptions,
|
|
33
|
+
QuickInputButton,
|
|
34
|
+
QuickInputButtonHandle,
|
|
35
|
+
QuickInputService
|
|
33
36
|
} from '@theia/core/lib/browser';
|
|
34
|
-
import { QuickPickService } from '@theia/core/lib/common/quick-pick-service';
|
|
35
37
|
import { DisposableCollection, Disposable } from '@theia/core/lib/common/disposable';
|
|
36
38
|
import { CancellationToken } from '@theia/core/lib/common/cancellation';
|
|
37
39
|
import { MonacoQuickInputService } from '@theia/monaco/lib/browser/monaco-quick-input-service';
|
|
@@ -47,7 +49,6 @@ export interface QuickInputSession {
|
|
|
47
49
|
export class QuickOpenMainImpl implements QuickOpenMain, Disposable {
|
|
48
50
|
|
|
49
51
|
private quickInputService: QuickInputService;
|
|
50
|
-
private quickPickService: QuickPickService;
|
|
51
52
|
private proxy: QuickOpenExt;
|
|
52
53
|
private delegate: MonacoQuickInputService;
|
|
53
54
|
private readonly items: Record<number, {
|
|
@@ -61,7 +62,6 @@ export class QuickOpenMainImpl implements QuickOpenMain, Disposable {
|
|
|
61
62
|
this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.QUICK_OPEN_EXT);
|
|
62
63
|
this.delegate = container.get(MonacoQuickInputService);
|
|
63
64
|
this.quickInputService = container.get(QuickInputService);
|
|
64
|
-
this.quickPickService = container.get(QuickPickService);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
dispose(): void {
|
|
@@ -194,54 +194,55 @@ export class QuickOpenMainImpl implements QuickOpenMain, Disposable {
|
|
|
194
194
|
|
|
195
195
|
private sessions = new Map<number, QuickInputSession>();
|
|
196
196
|
|
|
197
|
-
$createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput
|
|
197
|
+
$createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput): Promise<void> {
|
|
198
198
|
const sessionId = params.id;
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
199
|
+
let session = this.sessions.get(sessionId);
|
|
200
|
+
if (!session) {
|
|
201
|
+
if (params.type === 'quickPick') {
|
|
202
|
+
const quickPick = this.quickInputService.createQuickPick();
|
|
203
|
+
quickPick.onDidAccept(() => {
|
|
204
|
+
this.proxy.$acceptOnDidAccept(sessionId);
|
|
205
|
+
});
|
|
206
|
+
quickPick.onDidChangeActive((items: Array<monaco.quickInput.IQuickPickItem>) => {
|
|
207
|
+
this.proxy.$onDidChangeActive(sessionId, items.map(item => (item as TransferQuickPickItems).handle));
|
|
208
|
+
});
|
|
209
|
+
quickPick.onDidChangeSelection((items: Array<monaco.quickInput.IQuickPickItem>) => {
|
|
210
|
+
this.proxy.$onDidChangeSelection(sessionId, items.map(item => (item as TransferQuickPickItems).handle));
|
|
211
|
+
});
|
|
212
|
+
quickPick.onDidTriggerButton((button: QuickInputButtonHandle) => {
|
|
213
|
+
this.proxy.$acceptOnDidTriggerButton(sessionId, button);
|
|
214
|
+
});
|
|
215
|
+
quickPick.onDidChangeValue((value: string) => {
|
|
216
|
+
this.proxy.$acceptDidChangeValue(sessionId, value);
|
|
217
|
+
});
|
|
218
|
+
quickPick.onDidHide(() => {
|
|
219
|
+
this.proxy.$acceptOnDidHide(sessionId);
|
|
220
|
+
});
|
|
221
|
+
session = {
|
|
222
|
+
input: quickPick,
|
|
223
|
+
handlesToItems: new Map()
|
|
224
|
+
};
|
|
225
|
+
} else {
|
|
226
|
+
const inputBox = this.quickInputService.createInputBox();
|
|
227
|
+
inputBox.onDidAccept(() => {
|
|
228
|
+
this.proxy.$acceptOnDidAccept(sessionId);
|
|
229
|
+
});
|
|
230
|
+
inputBox.onDidTriggerButton((button: QuickInputButtonHandle) => {
|
|
231
|
+
this.proxy.$acceptOnDidTriggerButton(sessionId, button);
|
|
232
|
+
});
|
|
233
|
+
inputBox.onDidChangeValue((value: string) => {
|
|
234
|
+
this.proxy.$acceptDidChangeValue(sessionId, value);
|
|
235
|
+
});
|
|
236
|
+
inputBox.onDidHide(() => {
|
|
237
|
+
this.proxy.$acceptOnDidHide(sessionId);
|
|
238
|
+
});
|
|
239
|
+
session = {
|
|
240
|
+
input: inputBox,
|
|
241
|
+
handlesToItems: new Map()
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
this.sessions.set(sessionId, session);
|
|
245
|
+
}
|
|
245
246
|
if (session) {
|
|
246
247
|
const { input, handlesToItems } = session;
|
|
247
248
|
for (const param in params) {
|
|
@@ -297,47 +298,6 @@ export class QuickOpenMainImpl implements QuickOpenMain, Disposable {
|
|
|
297
298
|
return Promise.resolve(undefined);
|
|
298
299
|
}
|
|
299
300
|
|
|
300
|
-
async $showCustomQuickPick<T extends QuickPickItemExt>(options: TransferQuickPick<T>): Promise<void> {
|
|
301
|
-
const sessionId = options.id;
|
|
302
|
-
const toDispose = new DisposableCollection();
|
|
303
|
-
|
|
304
|
-
toDispose.push(this.quickPickService.onDidAccept(() => {
|
|
305
|
-
this.proxy.$acceptOnDidAccept(sessionId);
|
|
306
|
-
}));
|
|
307
|
-
toDispose.push(this.quickPickService.onDidChangeActive((e: { quickPick: any, activeItems: Array<QuickPickValue<number>> }) => {
|
|
308
|
-
this.proxy.$onDidChangeActive(sessionId, e.activeItems.map(item => item.value!));
|
|
309
|
-
}));
|
|
310
|
-
toDispose.push(this.quickPickService.onDidChangeSelection((e: { quickPick: any, selectedItems: Array<QuickPickValue<number>> }) => {
|
|
311
|
-
this.proxy.$onDidChangeSelection(sessionId, e.selectedItems.map(item => item.value!));
|
|
312
|
-
}));
|
|
313
|
-
toDispose.push(this.quickPickService.onDidChangeValue((e: { quickPick: any, filter: string }) => {
|
|
314
|
-
this.proxy.$acceptDidChangeValue(sessionId, e.filter);
|
|
315
|
-
}));
|
|
316
|
-
toDispose.push(this.quickPickService.onDidTriggerButton(button => {
|
|
317
|
-
this.proxy.$acceptOnDidTriggerButton(sessionId, button);
|
|
318
|
-
}));
|
|
319
|
-
toDispose.push(this.quickPickService.onDidHide(() => {
|
|
320
|
-
this.proxy.$acceptOnDidHide(sessionId);
|
|
321
|
-
if (!toDispose.disposed) {
|
|
322
|
-
toDispose.dispose();
|
|
323
|
-
}
|
|
324
|
-
}));
|
|
325
|
-
this.toDispose.push(toDispose);
|
|
326
|
-
|
|
327
|
-
this.quickPickService.show(this.convertToQuickPickItem(options.items), {
|
|
328
|
-
buttons: options.buttons ? this.convertToQuickInputButtons(options.buttons) : [],
|
|
329
|
-
placeholder: options.placeholder,
|
|
330
|
-
matchOnDescription: options.matchOnDescription,
|
|
331
|
-
step: options.step,
|
|
332
|
-
title: options.title,
|
|
333
|
-
totalSteps: options.totalSteps,
|
|
334
|
-
ignoreFocusOut: options.ignoreFocusOut,
|
|
335
|
-
value: options.value,
|
|
336
|
-
matchOnLabel: true,
|
|
337
|
-
runIfSingle: false,
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
|
|
341
301
|
$hide(): void {
|
|
342
302
|
this.delegate.hide();
|
|
343
303
|
}
|
|
@@ -351,21 +311,6 @@ export class QuickOpenMainImpl implements QuickOpenMain, Disposable {
|
|
|
351
311
|
return Promise.resolve(undefined);
|
|
352
312
|
}
|
|
353
313
|
|
|
354
|
-
private convertToQuickPickItem(items: TransferQuickPickItems[] | undefined): Array<QuickPickItem> {
|
|
355
|
-
const convertedItems: QuickPickValue<number>[] = [];
|
|
356
|
-
if (items) {
|
|
357
|
-
for (const i of items) {
|
|
358
|
-
convertedItems.push({
|
|
359
|
-
label: i.label,
|
|
360
|
-
description: i.description,
|
|
361
|
-
detail: i.detail,
|
|
362
|
-
value: i.handle
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
}
|
|
366
|
-
return convertedItems;
|
|
367
|
-
}
|
|
368
|
-
|
|
369
314
|
private convertToQuickInputButtons(buttons: Array<TransferQuickInputButton>): Array<QuickInputButton> {
|
|
370
315
|
return buttons.map((button, i) => ({
|
|
371
316
|
iconPath: getIconUris(button.iconPath),
|
|
@@ -37,11 +37,7 @@
|
|
|
37
37
|
.theia-plugin-view-container {
|
|
38
38
|
-webkit-mask: url('');
|
|
39
39
|
mask: url('');
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
.theia-plugin-test-tab-icon {
|
|
43
|
-
-webkit-mask: url('test.svg');
|
|
44
|
-
mask: url('test.svg');
|
|
40
|
+
background-color: var(--theia-activityBar-inactiveForeground);
|
|
45
41
|
}
|
|
46
42
|
|
|
47
43
|
.theia-plugin-file-icon,
|
|
@@ -30,7 +30,6 @@
|
|
|
30
30
|
.theia-plugins .pluginHeaderContainer {
|
|
31
31
|
padding: 5px 15px;
|
|
32
32
|
font-size: var(--theia-ui-font-size0);
|
|
33
|
-
border-bottom: 1px solid;
|
|
34
33
|
}
|
|
35
34
|
|
|
36
35
|
.theia-side-panel .theia-plugins .pluginHeaderContainer {
|
|
@@ -48,6 +47,7 @@
|
|
|
48
47
|
.theia-plugins .pluginName {
|
|
49
48
|
flex: 1;
|
|
50
49
|
margin-right: 5px;
|
|
50
|
+
margin-left: 4px;
|
|
51
51
|
font-size: var(--theia-ui-font-size1);
|
|
52
52
|
font-weight: 400;
|
|
53
53
|
}
|
|
@@ -14,12 +14,11 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { interfaces } from '@theia/core/shared/inversify';
|
|
17
|
-
import { TimelineMain } from '../../common/plugin-api-rpc';
|
|
17
|
+
import { MAIN_RPC_CONTEXT, TimelineExt, TimelineMain } from '../../common/plugin-api-rpc';
|
|
18
18
|
import { RPCProtocol } from '../../common/rpc-protocol';
|
|
19
19
|
import { TimelineService } from '@theia/timeline/lib/browser/timeline-service';
|
|
20
20
|
import { Emitter } from '@theia/core/lib/common';
|
|
21
21
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
22
|
-
import { MAIN_RPC_CONTEXT, TimelineExt } from '../../common/plugin-api-rpc';
|
|
23
22
|
import {
|
|
24
23
|
InternalTimelineOptions,
|
|
25
24
|
Timeline,
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import { injectable, inject, postConstruct, optional } from '@theia/core/shared/inversify';
|
|
18
18
|
import {
|
|
19
|
-
ApplicationShell, ViewContainer as ViewContainerWidget, WidgetManager,
|
|
19
|
+
ApplicationShell, ViewContainer as ViewContainerWidget, WidgetManager, QuickViewService,
|
|
20
20
|
ViewContainerIdentifier, ViewContainerTitleOptions, Widget, FrontendApplicationContribution,
|
|
21
|
-
StatefulWidget, CommonMenus, BaseWidget, TreeViewWelcomeWidget
|
|
21
|
+
StatefulWidget, CommonMenus, BaseWidget, TreeViewWelcomeWidget, codicon, ViewContainerPart
|
|
22
22
|
} from '@theia/core/lib/browser';
|
|
23
23
|
import { ViewContainer, View, ViewWelcome } from '../../../common';
|
|
24
24
|
import { PluginSharedStyle } from '../plugin-shared-style';
|
|
@@ -31,16 +31,15 @@ import { DebugFrontendApplicationContribution } from '@theia/debug/lib/browser/d
|
|
|
31
31
|
import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
32
32
|
import { CommandRegistry } from '@theia/core/lib/common/command';
|
|
33
33
|
import { MenuModelRegistry } from '@theia/core/lib/common/menu';
|
|
34
|
-
import { QuickViewService } from '@theia/core/lib/browser';
|
|
35
34
|
import { Emitter } from '@theia/core/lib/common/event';
|
|
36
35
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
37
|
-
import { SearchInWorkspaceWidget } from '@theia/search-in-workspace/lib/browser/search-in-workspace-widget';
|
|
38
36
|
import { ViewContextKeyService } from './view-context-key-service';
|
|
39
37
|
import { PROBLEMS_WIDGET_ID } from '@theia/markers/lib/browser/problem/problem-widget';
|
|
40
38
|
import { OUTPUT_WIDGET_KIND } from '@theia/output/lib/browser/output-widget';
|
|
41
39
|
import { DebugConsoleContribution } from '@theia/debug/lib/browser/console/debug-console-contribution';
|
|
42
40
|
import { TERMINAL_WIDGET_FACTORY_ID } from '@theia/terminal/lib/browser/terminal-widget-impl';
|
|
43
41
|
import { TreeViewWidget } from './tree-view-widget';
|
|
42
|
+
import { SEARCH_VIEW_CONTAINER_ID } from '@theia/search-in-workspace/lib/browser/search-in-workspace-factory';
|
|
44
43
|
|
|
45
44
|
export const PLUGIN_VIEW_FACTORY_ID = 'plugin-view';
|
|
46
45
|
export const PLUGIN_VIEW_CONTAINER_FACTORY_ID = 'plugin-view-container';
|
|
@@ -100,8 +99,8 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
100
99
|
protected init(): void {
|
|
101
100
|
// VS Code Viewlets
|
|
102
101
|
this.trackVisibleWidget(EXPLORER_VIEW_CONTAINER_ID, { viewletId: 'workbench.view.explorer' });
|
|
103
|
-
this.trackVisibleWidget(SearchInWorkspaceWidget.ID, { viewletId: 'workbench.view.search', sideArea: true });
|
|
104
102
|
this.trackVisibleWidget(SCM_VIEW_CONTAINER_ID, { viewletId: 'workbench.view.scm' });
|
|
103
|
+
this.trackVisibleWidget(SEARCH_VIEW_CONTAINER_ID, { viewletId: 'workbench.view.search' });
|
|
105
104
|
this.trackVisibleWidget(DebugWidget.ID, { viewletId: 'workbench.view.debug' });
|
|
106
105
|
// TODO workbench.view.extensions - Theia does not have a proper extension view yet
|
|
107
106
|
|
|
@@ -111,7 +110,6 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
111
110
|
this.trackVisibleWidget(DebugConsoleContribution.options.id, { panelId: 'workbench.panel.repl' });
|
|
112
111
|
this.trackVisibleWidget(TERMINAL_WIDGET_FACTORY_ID, { panelId: 'workbench.panel.terminal' });
|
|
113
112
|
// TODO workbench.panel.comments - Theia does not have a proper comments view yet
|
|
114
|
-
this.trackVisibleWidget(SearchInWorkspaceWidget.ID, { panelId: 'workbench.view.search', sideArea: false });
|
|
115
113
|
|
|
116
114
|
this.updateFocusedView();
|
|
117
115
|
this.shell.onDidChangeActiveWidget(() => this.updateFocusedView());
|
|
@@ -123,6 +121,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
123
121
|
if (factoryId === SCM_VIEW_CONTAINER_ID && widget instanceof ViewContainerWidget) {
|
|
124
122
|
waitUntil(this.prepareViewContainer('scm', widget));
|
|
125
123
|
}
|
|
124
|
+
if (factoryId === SEARCH_VIEW_CONTAINER_ID && widget instanceof ViewContainerWidget) {
|
|
125
|
+
waitUntil(this.prepareViewContainer('search', widget));
|
|
126
|
+
}
|
|
126
127
|
if (factoryId === DebugWidget.ID && widget instanceof DebugWidget) {
|
|
127
128
|
const viewContainer = widget['sessionWidget']['viewContainer'];
|
|
128
129
|
waitUntil(this.prepareViewContainer('debug', viewContainer));
|
|
@@ -146,7 +147,7 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
146
147
|
});
|
|
147
148
|
this.doRegisterViewContainer('test', 'left', {
|
|
148
149
|
label: 'Test',
|
|
149
|
-
iconClass: '
|
|
150
|
+
iconClass: codicon('beaker'),
|
|
150
151
|
closeable: true
|
|
151
152
|
});
|
|
152
153
|
this.contextKeyService.onDidChange(e => {
|
|
@@ -401,7 +402,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
401
402
|
return;
|
|
402
403
|
}
|
|
403
404
|
const [, view] = data;
|
|
404
|
-
widget.title.label
|
|
405
|
+
if (!widget.title.label) {
|
|
406
|
+
widget.title.label = view.name;
|
|
407
|
+
}
|
|
405
408
|
const currentDataWidget = widget.widgets[0];
|
|
406
409
|
const viewDataWidget = await this.createViewDataWidget(view.id);
|
|
407
410
|
if (widget.isDisposed) {
|
|
@@ -466,6 +469,14 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
466
469
|
}
|
|
467
470
|
for (const viewId of this.getContainerViews(viewContainerId)) {
|
|
468
471
|
const identifier = this.toPluginViewWidgetIdentifier(viewId);
|
|
472
|
+
// Keep existing widget in its current container and reregister its part to the plugin view widget events.
|
|
473
|
+
const existingWidget = this.widgetManager.tryGetWidget<PluginViewWidget>(PLUGIN_VIEW_FACTORY_ID, identifier);
|
|
474
|
+
if (existingWidget && existingWidget.currentViewContainerId) {
|
|
475
|
+
const currentContainer = await this.getPluginViewContainer(existingWidget.currentViewContainerId);
|
|
476
|
+
if (currentContainer && this.registerWidgetPartEvents(existingWidget, currentContainer)) {
|
|
477
|
+
continue;
|
|
478
|
+
}
|
|
479
|
+
}
|
|
469
480
|
const widget = await this.widgetManager.getOrCreateWidget<PluginViewWidget>(PLUGIN_VIEW_FACTORY_ID, identifier);
|
|
470
481
|
if (containerWidget.getTrackableWidgets().indexOf(widget) === -1) {
|
|
471
482
|
containerWidget.addWidget(widget, {
|
|
@@ -473,27 +484,49 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
473
484
|
initiallyHidden: !this.isViewVisible(viewId)
|
|
474
485
|
});
|
|
475
486
|
}
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
part.onDidChangeVisibility(() => widget.suppressUpdateViewVisibility = part.isHidden);
|
|
487
|
+
this.registerWidgetPartEvents(widget, containerWidget);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
480
490
|
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
491
|
+
protected registerWidgetPartEvents(widget: PluginViewWidget, containerWidget: ViewContainerWidget): ViewContainerPart | undefined {
|
|
492
|
+
const part = containerWidget.getPartFor(widget);
|
|
493
|
+
if (part) {
|
|
494
|
+
|
|
495
|
+
widget.currentViewContainerId = this.getViewContainerId(containerWidget);
|
|
496
|
+
part.onDidMove(event => { widget.currentViewContainerId = this.getViewContainerId(event); });
|
|
497
|
+
|
|
498
|
+
// if a view is explicitly hidden then suppress updating visibility based on `when` closure
|
|
499
|
+
part.onDidChangeVisibility(() => widget.suppressUpdateViewVisibility = part.isHidden);
|
|
500
|
+
|
|
501
|
+
const tryFireOnDidExpandView = () => {
|
|
502
|
+
if (widget.widgets.length === 0) {
|
|
503
|
+
if (!part.collapsed && part.isVisible) {
|
|
504
|
+
const viewId = this.toViewId(widget.options);
|
|
505
|
+
this.onDidExpandViewEmitter.fire(viewId);
|
|
488
506
|
}
|
|
489
|
-
}
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
507
|
+
} else {
|
|
508
|
+
toFire.dispose();
|
|
509
|
+
}
|
|
510
|
+
};
|
|
511
|
+
const toFire = new DisposableCollection(
|
|
512
|
+
part.onCollapsed(tryFireOnDidExpandView),
|
|
513
|
+
part.onDidChangeVisibility(tryFireOnDidExpandView)
|
|
514
|
+
);
|
|
494
515
|
|
|
495
|
-
|
|
496
|
-
|
|
516
|
+
tryFireOnDidExpandView();
|
|
517
|
+
return part;
|
|
518
|
+
}
|
|
519
|
+
};
|
|
520
|
+
|
|
521
|
+
protected getViewContainerId(container: ViewContainerWidget): string | undefined {
|
|
522
|
+
const description = this.widgetManager.getDescription(container);
|
|
523
|
+
switch (description?.factoryId) {
|
|
524
|
+
case EXPLORER_VIEW_CONTAINER_ID: return 'explorer';
|
|
525
|
+
case SCM_VIEW_CONTAINER_ID: return 'scm';
|
|
526
|
+
case SEARCH_VIEW_CONTAINER_ID: return 'search';
|
|
527
|
+
case undefined: return container.parent?.parent instanceof DebugWidget ? 'debug' : container.id;
|
|
528
|
+
case PLUGIN_VIEW_CONTAINER_FACTORY_ID: return this.toViewContainerId(description.options);
|
|
529
|
+
default: return container.id;
|
|
497
530
|
}
|
|
498
531
|
}
|
|
499
532
|
|
|
@@ -504,6 +537,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
504
537
|
if (viewContainerId === 'scm') {
|
|
505
538
|
return this.widgetManager.getWidget<ViewContainerWidget>(SCM_VIEW_CONTAINER_ID);
|
|
506
539
|
}
|
|
540
|
+
if (viewContainerId === 'search') {
|
|
541
|
+
return this.widgetManager.getWidget<ViewContainerWidget>(SEARCH_VIEW_CONTAINER_ID);
|
|
542
|
+
}
|
|
507
543
|
if (viewContainerId === 'debug') {
|
|
508
544
|
const debug = await this.widgetManager.getWidget(DebugWidget.ID);
|
|
509
545
|
if (debug instanceof DebugWidget) {
|
|
@@ -546,6 +582,12 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
|
|
|
546
582
|
await this.prepareViewContainer('scm', scm);
|
|
547
583
|
}
|
|
548
584
|
})().catch(console.error));
|
|
585
|
+
promises.push((async () => {
|
|
586
|
+
const search = await this.widgetManager.getWidget(SEARCH_VIEW_CONTAINER_ID);
|
|
587
|
+
if (search instanceof ViewContainerWidget) {
|
|
588
|
+
await this.prepareViewContainer('search', search);
|
|
589
|
+
}
|
|
590
|
+
})().catch(console.error));
|
|
549
591
|
promises.push((async () => {
|
|
550
592
|
const debug = await this.widgetManager.getWidget(DebugWidget.ID);
|
|
551
593
|
if (debug instanceof DebugWidget) {
|
|
@@ -46,6 +46,8 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
|
|
|
46
46
|
@inject(PluginViewWidgetIdentifier)
|
|
47
47
|
readonly options: PluginViewWidgetIdentifier;
|
|
48
48
|
|
|
49
|
+
currentViewContainerId: string | undefined;
|
|
50
|
+
|
|
49
51
|
constructor() {
|
|
50
52
|
super();
|
|
51
53
|
this.node.tabIndex = -1;
|
|
@@ -75,7 +77,8 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
|
|
|
75
77
|
label: this.title.label,
|
|
76
78
|
message: this.message,
|
|
77
79
|
widgets: this.widgets,
|
|
78
|
-
suppressUpdateViewVisibility: this._suppressUpdateViewVisibility
|
|
80
|
+
suppressUpdateViewVisibility: this._suppressUpdateViewVisibility,
|
|
81
|
+
currentViewContainerId: this.currentViewContainerId
|
|
79
82
|
};
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -83,6 +86,7 @@ export class PluginViewWidget extends Panel implements StatefulWidget, Descripti
|
|
|
83
86
|
this.title.label = state.label;
|
|
84
87
|
this.message = state.message;
|
|
85
88
|
this.suppressUpdateViewVisibility = state.suppressUpdateViewVisibility;
|
|
89
|
+
this.currentViewContainerId = state.currentViewContainerId;
|
|
86
90
|
for (const widget of state.widgets) {
|
|
87
91
|
this.addWidget(widget);
|
|
88
92
|
}
|
|
@@ -150,6 +154,7 @@ export namespace PluginViewWidget {
|
|
|
150
154
|
label: string,
|
|
151
155
|
message?: string,
|
|
152
156
|
widgets: ReadonlyArray<Widget>,
|
|
153
|
-
suppressUpdateViewVisibility: boolean
|
|
157
|
+
suppressUpdateViewVisibility: boolean;
|
|
158
|
+
currentViewContainerId: string | undefined;
|
|
154
159
|
}
|
|
155
160
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
|
|
17
17
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
18
18
|
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
19
|
-
import { TreeViewsExt, TreeViewSelection } from '../../../common/plugin-api-rpc';
|
|
19
|
+
import { TreeViewsExt, TreeViewItemCollapsibleState, TreeViewItem, TreeViewSelection } from '../../../common/plugin-api-rpc';
|
|
20
20
|
import { Command } from '../../../common/plugin-api-rpc-model';
|
|
21
21
|
import {
|
|
22
22
|
TreeNode,
|
|
@@ -29,9 +29,10 @@ import {
|
|
|
29
29
|
TREE_NODE_SEGMENT_GROW_CLASS,
|
|
30
30
|
TREE_NODE_TAIL_CLASS,
|
|
31
31
|
TreeModelImpl,
|
|
32
|
-
TreeViewWelcomeWidget
|
|
32
|
+
TreeViewWelcomeWidget,
|
|
33
|
+
TooltipService,
|
|
34
|
+
TooltipAttributes
|
|
33
35
|
} from '@theia/core/lib/browser';
|
|
34
|
-
import { TreeViewItem, TreeViewItemCollapsibleState } from '../../../common/plugin-api-rpc';
|
|
35
36
|
import { MenuPath, MenuModelRegistry, ActionMenuNode } from '@theia/core/lib/common/menu';
|
|
36
37
|
import * as React from '@theia/core/shared/react';
|
|
37
38
|
import { PluginSharedStyle } from '../plugin-shared-style';
|
|
@@ -42,6 +43,8 @@ import { MessageService } from '@theia/core/lib/common/message-service';
|
|
|
42
43
|
import { View } from '../../../common/plugin-protocol';
|
|
43
44
|
import CoreURI from '@theia/core/lib/common/uri';
|
|
44
45
|
import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
|
|
46
|
+
import * as markdownit from 'markdown-it';
|
|
47
|
+
import { isMarkdownString } from '../../../plugin/markdown-string';
|
|
45
48
|
|
|
46
49
|
export const TREE_NODE_HYPERLINK = 'theia-TreeNodeHyperlink';
|
|
47
50
|
export const VIEW_ITEM_CONTEXT_MENU: MenuPath = ['view-item-context-menu'];
|
|
@@ -245,6 +248,9 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
|
|
|
245
248
|
@inject(ContextKeyService)
|
|
246
249
|
protected readonly contextKeyService: ContextKeyService;
|
|
247
250
|
|
|
251
|
+
@inject(TooltipService)
|
|
252
|
+
protected readonly tooltipService: TooltipService;
|
|
253
|
+
|
|
248
254
|
protected readonly onDidChangeVisibilityEmitter = new Emitter<boolean>();
|
|
249
255
|
readonly onDidChangeVisibility = this.onDidChangeVisibilityEmitter.event;
|
|
250
256
|
|
|
@@ -274,13 +280,32 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
|
|
|
274
280
|
classes.push(TREE_NODE_SEGMENT_GROW_CLASS);
|
|
275
281
|
}
|
|
276
282
|
const className = classes.join(' ');
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
283
|
+
|
|
284
|
+
let attrs: React.HTMLAttributes<HTMLElement> & Partial<TooltipAttributes> = {
|
|
285
|
+
...this.decorateCaption(node, {}),
|
|
286
|
+
className,
|
|
287
|
+
id: node.id
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
if (node.tooltip && isMarkdownString(node.tooltip)) {
|
|
291
|
+
// Render markdown in custom tooltip
|
|
292
|
+
const tooltip = markdownit().render(node.tooltip.value);
|
|
293
|
+
|
|
294
|
+
attrs = {
|
|
295
|
+
...attrs,
|
|
296
|
+
'data-tip': tooltip,
|
|
297
|
+
'data-for': this.tooltipService.tooltipId
|
|
298
|
+
};
|
|
299
|
+
} else {
|
|
300
|
+
const title = node.tooltip ||
|
|
301
|
+
(node.resourceUri && this.labelProvider.getLongName(new CoreURI(node.resourceUri)))
|
|
302
|
+
|| this.toNodeName(node);
|
|
303
|
+
|
|
304
|
+
attrs = {
|
|
305
|
+
...attrs,
|
|
306
|
+
title
|
|
307
|
+
};
|
|
308
|
+
}
|
|
284
309
|
|
|
285
310
|
const children: React.ReactNode[] = [];
|
|
286
311
|
const caption = this.toNodeName(node);
|
|
@@ -294,43 +319,11 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
|
|
|
294
319
|
} else if (!highlight) {
|
|
295
320
|
children.push(caption);
|
|
296
321
|
}
|
|
297
|
-
return React.createElement('div', attrs, ...children);
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
protected getCaption(node: TreeNode): React.ReactNode {
|
|
301
|
-
const nodes: React.ReactNode[] = [];
|
|
302
|
-
|
|
303
|
-
const name = this.toNodeName(node) || '';
|
|
304
322
|
const description = this.toNodeDescription(node);
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
const regex = /\[([^\[]+)\]\(([^\)]+)\)/g;
|
|
309
|
-
const matchResult = work.match(regex);
|
|
310
|
-
|
|
311
|
-
if (matchResult) {
|
|
312
|
-
matchResult.forEach((match, index) => {
|
|
313
|
-
nodes.push(<span key={`m${index}`}>{work.substring(0, work.indexOf(match))}</span>);
|
|
314
|
-
|
|
315
|
-
const execResult = regex.exec(name);
|
|
316
|
-
nodes.push(<a key={`l${index}`}
|
|
317
|
-
href={execResult![2]}
|
|
318
|
-
target='_blank'
|
|
319
|
-
className={TREE_NODE_HYPERLINK}
|
|
320
|
-
onClick={e => e.stopPropagation()}>{execResult![1]}</a>
|
|
321
|
-
);
|
|
322
|
-
|
|
323
|
-
work = work.substring(work.indexOf(match) + match.length);
|
|
324
|
-
});
|
|
323
|
+
if (description) {
|
|
324
|
+
children.push(<span className='theia-tree-view-description'>{description}</span>);
|
|
325
325
|
}
|
|
326
|
-
|
|
327
|
-
return <div className='noWrapInfoTree'>
|
|
328
|
-
{...nodes}
|
|
329
|
-
{work && <span>{work}</span>}
|
|
330
|
-
{description && <span className='theia-tree-view-description'>
|
|
331
|
-
{description}
|
|
332
|
-
</span>}
|
|
333
|
-
</div>;
|
|
326
|
+
return React.createElement('div', attrs, ...children);
|
|
334
327
|
}
|
|
335
328
|
|
|
336
329
|
protected renderTailDecorations(node: TreeViewNode, props: NodeProps): React.ReactNode {
|
|
@@ -444,7 +437,9 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
|
|
|
444
437
|
}
|
|
445
438
|
|
|
446
439
|
protected render(): React.ReactNode {
|
|
447
|
-
|
|
440
|
+
const node = React.createElement('div', this.createContainerAttributes(), this.renderSearchInfo(), this.renderTree(this.model));
|
|
441
|
+
this.tooltipService.update();
|
|
442
|
+
return node;
|
|
448
443
|
}
|
|
449
444
|
|
|
450
445
|
protected renderSearchInfo(): React.ReactNode {
|
|
@@ -25,19 +25,27 @@
|
|
|
25
25
|
const hostMessaging = new class HostMessaging {
|
|
26
26
|
constructor() {
|
|
27
27
|
this.handlers = new Map();
|
|
28
|
-
window.addEventListener('message',
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
28
|
+
window.addEventListener('message', e => {
|
|
29
|
+
// Note: `window.parent === window` when there is no parent...
|
|
30
|
+
const sourceIsSelfOrParentFrame = e.source === window.parent;
|
|
31
|
+
let sourceIsChildFrame = false;
|
|
32
|
+
for (let i = 0; i < window.frames.length; i++) {
|
|
33
|
+
const frame = window.frames[i];
|
|
34
|
+
if (e.source === frame) {
|
|
35
|
+
sourceIsChildFrame = true;
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
33
38
|
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
handler
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
if (sourceIsChildFrame && e.data && (e.data.command === 'onmessage' || e.data.command === 'do-update-state')) {
|
|
40
|
+
this.postMessage(e.data.command, e.data.data);
|
|
41
|
+
} else if (sourceIsChildFrame || sourceIsSelfOrParentFrame) {
|
|
42
|
+
const channel = e.data.channel;
|
|
43
|
+
const handler = this.handlers.get(channel);
|
|
44
|
+
if (handler) {
|
|
45
|
+
handler(e, e.data.args);
|
|
46
|
+
} else {
|
|
47
|
+
console.error('no handler for ', e);
|
|
48
|
+
}
|
|
41
49
|
}
|
|
42
50
|
});
|
|
43
51
|
}
|