@theia/plugin-ext 1.18.0-next.86181832 → 1.18.0-next.89

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.
Files changed (109) hide show
  1. package/LICENSE +642 -0
  2. package/lib/common/plugin-api-rpc-model.d.ts +2 -0
  3. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  4. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  5. package/lib/common/plugin-api-rpc.d.ts +25 -6
  6. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  7. package/lib/common/plugin-api-rpc.js +21 -1
  8. package/lib/common/plugin-api-rpc.js.map +1 -1
  9. package/lib/common/plugin-protocol.d.ts.map +1 -1
  10. package/lib/common/plugin-protocol.js.map +1 -1
  11. package/lib/hosted/browser/hosted-plugin.d.ts +3 -2
  12. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  13. package/lib/hosted/browser/hosted-plugin.js +15 -7
  14. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  15. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  16. package/lib/hosted/browser/worker/debug-stub.js +1 -0
  17. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  18. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  19. package/lib/hosted/node/scanners/scanner-theia.js +1 -1
  20. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  21. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
  22. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +2 -1
  23. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
  24. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  25. package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -1
  26. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  27. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  28. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  29. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  30. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  31. package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
  32. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  33. package/lib/main/browser/debug/plugin-debug-service.js +15 -0
  34. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  35. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +1 -1
  36. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  37. package/lib/main/browser/quick-open-main.d.ts +1 -1
  38. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  39. package/lib/main/browser/quick-open-main.js.map +1 -1
  40. package/lib/main/browser/view/plugin-view-registry.d.ts +3 -1
  41. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  42. package/lib/main/browser/view/plugin-view-registry.js +61 -20
  43. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  44. package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
  45. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  46. package/lib/main/browser/view/plugin-view-widget.js +3 -1
  47. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  48. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  49. package/lib/plugin/languages/call-hierarchy.js +2 -1
  50. package/lib/plugin/languages/call-hierarchy.js.map +1 -1
  51. package/lib/plugin/node/debug/debug.d.ts +4 -3
  52. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  53. package/lib/plugin/node/debug/debug.js +34 -15
  54. package/lib/plugin/node/debug/debug.js.map +1 -1
  55. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
  56. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  57. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  58. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
  59. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  60. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
  61. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  62. package/lib/plugin/plugin-context.d.ts.map +1 -1
  63. package/lib/plugin/plugin-context.js +9 -3
  64. package/lib/plugin/plugin-context.js.map +1 -1
  65. package/lib/plugin/plugin-manager.d.ts +2 -0
  66. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  67. package/lib/plugin/plugin-manager.js +24 -3
  68. package/lib/plugin/plugin-manager.js.map +1 -1
  69. package/lib/plugin/plugin-storage.d.ts +4 -0
  70. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  71. package/lib/plugin/plugin-storage.js +6 -1
  72. package/lib/plugin/plugin-storage.js.map +1 -1
  73. package/lib/plugin/quick-open.d.ts.map +1 -1
  74. package/lib/plugin/quick-open.js +9 -2
  75. package/lib/plugin/quick-open.js.map +1 -1
  76. package/lib/plugin/type-converters.d.ts.map +1 -1
  77. package/lib/plugin/type-converters.js +7 -4
  78. package/lib/plugin/type-converters.js.map +1 -1
  79. package/lib/plugin/types-impl.d.ts +54 -1
  80. package/lib/plugin/types-impl.d.ts.map +1 -1
  81. package/lib/plugin/types-impl.js +81 -1
  82. package/lib/plugin/types-impl.js.map +1 -1
  83. package/package.json +29 -27
  84. package/src/common/plugin-api-rpc-model.ts +2 -0
  85. package/src/common/plugin-api-rpc.ts +27 -6
  86. package/src/common/plugin-protocol.ts +1 -0
  87. package/src/hosted/browser/hosted-plugin.ts +17 -8
  88. package/src/hosted/browser/worker/debug-stub.ts +1 -0
  89. package/src/hosted/node/scanners/scanner-theia.ts +2 -1
  90. package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +2 -1
  91. package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -1
  92. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
  93. package/src/main/browser/debug/plugin-debug-service.ts +23 -0
  94. package/src/main/browser/debug/plugin-debug-session-factory.ts +1 -1
  95. package/src/main/browser/quick-open-main.ts +1 -1
  96. package/src/main/browser/view/plugin-view-registry.ts +66 -23
  97. package/src/main/browser/view/plugin-view-widget.ts +7 -2
  98. package/src/main/browser/webview/pre/host.js +19 -10
  99. package/src/main/browser/webview/pre/main.js +0 -1
  100. package/src/plugin/languages/call-hierarchy.ts +2 -1
  101. package/src/plugin/node/debug/debug.ts +40 -19
  102. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
  103. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
  104. package/src/plugin/plugin-context.ts +20 -7
  105. package/src/plugin/plugin-manager.ts +26 -4
  106. package/src/plugin/plugin-storage.ts +6 -0
  107. package/src/plugin/quick-open.ts +10 -3
  108. package/src/plugin/type-converters.ts +7 -5
  109. package/src/plugin/types-impl.ts +76 -1
@@ -91,6 +91,7 @@ import type {
91
91
  TimelineProviderDescriptor
92
92
  } from '@theia/timeline/lib/common/timeline-model';
93
93
  import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
94
+ // eslint-disable-next-line @theia/runtime-import-check
94
95
  import { ThemeType } from '@theia/core/lib/browser/theming';
95
96
  import { Disposable } from '@theia/core/lib/common/disposable';
96
97
  import { PickOptions, QuickInputButtonHandle, QuickPickItem } from '@theia/core/lib/browser';
@@ -554,7 +555,7 @@ export interface TransferQuickInputButton extends theia.QuickInputButton {
554
555
  handle?: number;
555
556
  }
556
557
 
557
- export type TransferQuickInput<T extends theia.QuickPickItem> = TransferQuickPick<T> | TransferInputBox;
558
+ export type TransferQuickInput = TransferQuickPick | TransferInputBox;
558
559
 
559
560
  export interface BaseTransferQuickInput {
560
561
  [key: string]: any;
@@ -565,14 +566,14 @@ export interface BaseTransferQuickInput {
565
566
  visible?: boolean;
566
567
  }
567
568
 
568
- export interface TransferQuickPick<T extends theia.QuickPickItem> extends BaseTransferQuickInput {
569
+ export interface TransferQuickPick extends BaseTransferQuickInput {
569
570
  type?: 'quickPick';
570
571
  value?: string;
571
572
  placeholder?: string;
572
573
  buttons?: TransferQuickInputButton[];
573
574
  items?: TransferQuickPickItems[];
574
- activeItems?: ReadonlyArray<T>;
575
- selectedItems?: ReadonlyArray<T>;
575
+ activeItems?: ReadonlyArray<theia.QuickPickItem>;
576
+ selectedItems?: ReadonlyArray<theia.QuickPickItem>;
576
577
  canSelectMany?: boolean;
577
578
  ignoreFocusOut?: boolean;
578
579
  matchOnDescription?: boolean;
@@ -604,7 +605,7 @@ export interface QuickOpenMain {
604
605
  $setItems(instance: number, items: TransferQuickPickItems[]): Promise<any>;
605
606
  $setError(instance: number, error: Error): Promise<void>;
606
607
  $input(options: theia.InputBoxOptions, validateInput: boolean, token: CancellationToken): Promise<string | undefined>;
607
- $createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput<T>): Promise<void>;
608
+ $createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput): Promise<void>;
608
609
  $dispose(id: number): Promise<void>;
609
610
 
610
611
  $hide(): void;
@@ -1594,13 +1595,33 @@ export interface StorageExt {
1594
1595
  $updatePluginsWorkspaceData(data: KeysToKeysToAnyValue): void;
1595
1596
  }
1596
1597
 
1598
+ /**
1599
+ * A DebugConfigurationProviderTriggerKind specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` should be called.
1600
+ * Currently there are two situations:
1601
+ * (1) providing debug configurations to populate a newly created `launch.json`
1602
+ * (2) providing dynamically generated configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
1603
+ * A trigger kind is used when registering a `DebugConfigurationProvider` with {@link debug.registerDebugConfigurationProvider}.
1604
+ */
1605
+ export enum DebugConfigurationProviderTriggerKind {
1606
+ /**
1607
+ * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug
1608
+ * configurations for a newly created launch.json.
1609
+ */
1610
+ Initial = 1,
1611
+ /**
1612
+ * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI
1613
+ * (e.g. via the "Select and Start Debugging" command).
1614
+ */
1615
+ Dynamic = 2
1616
+ }
1617
+
1597
1618
  export interface DebugExt {
1598
1619
  $onSessionCustomEvent(sessionId: string, event: string, body?: any): void;
1599
1620
  $breakpointsDidChange(added: Breakpoint[], removed: string[], changed: Breakpoint[]): void;
1600
1621
  $sessionDidCreate(sessionId: string): void;
1601
1622
  $sessionDidDestroy(sessionId: string): void;
1602
1623
  $sessionDidChange(sessionId: string | undefined): void;
1603
- $provideDebugConfigurations(debugType: string, workspaceFolder: string | undefined): Promise<theia.DebugConfiguration[]>;
1624
+ $provideDebugConfigurations(debugType: string, workspaceFolder: string | undefined, dynamic?: boolean): Promise<theia.DebugConfiguration[]>;
1604
1625
  $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolder: string | undefined): Promise<theia.DebugConfiguration | undefined>;
1605
1626
  $resolveDebugConfigurationWithSubstitutedVariables(debugConfiguration: theia.DebugConfiguration, workspaceFolder: string | undefined):
1606
1627
  Promise<theia.DebugConfiguration | undefined>;
@@ -23,6 +23,7 @@ import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-sch
23
23
  import { RecursivePartial } from '@theia/core/lib/common/types';
24
24
  import { PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/common/preferences/preference-schema';
25
25
  import { ProblemMatcherContribution, ProblemPatternContribution, TaskDefinition } from '@theia/task/lib/common';
26
+ // eslint-disable-next-line @theia/runtime-import-check
26
27
  import { ColorDefinition } from '@theia/core/lib/browser/color-registry';
27
28
  import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
28
29
 
@@ -66,7 +66,7 @@ import { PluginCustomEditorRegistry } from '../../main/browser/custom-editors/pl
66
66
  import { CustomEditorWidget } from '../../main/browser/custom-editors/custom-editor-widget';
67
67
 
68
68
  export type PluginHost = 'frontend' | string;
69
- export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker';
69
+ export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker' | 'onDebugDynamicConfigurations';
70
70
 
71
71
  export const PluginProgressLocation = 'plugin';
72
72
 
@@ -198,6 +198,8 @@ export class HostedPluginSupport {
198
198
  this.debugSessionManager.onWillStartDebugSession(event => this.ensureDebugActivation(event));
199
199
  this.debugSessionManager.onWillResolveDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugResolve', event.debugType));
200
200
  this.debugConfigurationManager.onWillProvideDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugInitialConfigurations'));
201
+ // Activate all providers of dynamic configurations, i.e. Let the user pick a configuration from all the available ones.
202
+ this.debugConfigurationManager.onWillProvideDynamicDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugDynamicConfigurations', '*'));
201
203
  this.viewRegistry.onDidExpandView(id => this.activateByView(id));
202
204
  this.taskProviderRegistry.onWillProvideTaskProvider(event => this.ensureTaskActivation(event));
203
205
  this.taskResolverRegistry.onWillProvideTaskResolver(event => this.ensureTaskActivation(event));
@@ -302,12 +304,15 @@ export class HostedPluginSupport {
302
304
  */
303
305
  protected async syncPlugins(): Promise<void> {
304
306
  let initialized = 0;
305
- const syncPluginsMeasurement = this.createMeasurement('syncPlugins');
307
+ const waitPluginsMeasurement = this.createMeasurement('waitForDeployment');
308
+ let syncPluginsMeasurement: () => number;
306
309
 
307
310
  const toUnload = new Set(this.contributions.keys());
308
311
  try {
309
312
  const pluginIds: string[] = [];
310
313
  const deployedPluginIds = await this.server.getDeployedPluginIds();
314
+ this.logMeasurement('Waiting for backend deployment', waitPluginsMeasurement);
315
+ syncPluginsMeasurement = this.createMeasurement('syncPlugins');
311
316
  for (const pluginId of deployedPluginIds) {
312
317
  toUnload.delete(pluginId);
313
318
  if (!this.contributions.has(pluginId)) {
@@ -336,7 +341,7 @@ export class HostedPluginSupport {
336
341
  }
337
342
  }
338
343
 
339
- this.logMeasurement('Sync', initialized, syncPluginsMeasurement);
344
+ this.logMeasurement(`Sync of ${this.getPluginCount(initialized)}`, syncPluginsMeasurement);
340
345
  }
341
346
 
342
347
  /**
@@ -374,7 +379,7 @@ export class HostedPluginSupport {
374
379
  }
375
380
  }
376
381
 
377
- this.logMeasurement('Load contributions', loaded, loadPluginsMeasurement);
382
+ this.logMeasurement(`Load contributions of ${this.getPluginCount(loaded)}`, loadPluginsMeasurement);
378
383
 
379
384
  return hostContributions;
380
385
  }
@@ -444,7 +449,7 @@ export class HostedPluginSupport {
444
449
  return;
445
450
  }
446
451
 
447
- this.logMeasurement('Start', started, startPluginsMeasurement);
452
+ this.logMeasurement(`Start of ${this.getPluginCount(started)}`, startPluginsMeasurement);
448
453
  }
449
454
 
450
455
  protected async obtainManager(host: string, hostContributions: PluginContributions[], toDisconnect: DisposableCollection): Promise<PluginManagerExt | undefined> {
@@ -712,15 +717,19 @@ export class HostedPluginSupport {
712
717
  };
713
718
  }
714
719
 
715
- protected logMeasurement(prefix: string, count: number, measurement: () => number): void {
720
+ protected logMeasurement(measurementName: string, measurement: () => number): void {
716
721
  const duration = measurement();
717
722
  if (duration === Number.NaN) {
718
723
  // Measurement was prevented by native API, do not log NaN duration
719
724
  return;
720
725
  }
721
726
 
722
- const pluginCount = `${count} plugin${count === 1 ? '' : 's'}`;
723
- console.log(`[${this.clientId}] ${prefix} of ${pluginCount} took: ${duration.toFixed(1)} ms`);
727
+ const timeFromFrontendStart = `Finished ${(performance.now() / 1000).toFixed(3)} s after frontend start`;
728
+ console.log(`[${this.clientId}] ${measurementName} took: ${duration.toFixed(1)} ms [${timeFromFrontendStart}]`);
729
+ }
730
+
731
+ protected getPluginCount(plugins: number): string {
732
+ return `${plugins} plugin${plugins === 1 ? '' : 's'}`;
724
733
  }
725
734
 
726
735
  protected readonly webviewsToRestore = new Set<WebviewWidget>();
@@ -14,6 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
+ // eslint-disable-next-line @theia/runtime-import-check
17
18
  import { DebugExtImpl } from '../../../plugin/node/debug/debug';
18
19
  import { RPCProtocol } from '../../../common/rpc-protocol';
19
20
 
@@ -73,6 +73,7 @@ import {
73
73
  ProblemPatternContribution,
74
74
  TaskDefinition
75
75
  } from '@theia/task/lib/common/task-protocol';
76
+ // eslint-disable-next-line @theia/runtime-import-check
76
77
  import { ColorDefinition } from '@theia/core/lib/browser/color-registry';
77
78
  import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
78
79
  import { PluginUriFactory } from './plugin-uri-factory';
@@ -217,7 +218,7 @@ export class TheiaPluginScanner implements PluginScanner {
217
218
 
218
219
  for (const location of Object.keys(viewsContainers)) {
219
220
  const containers = this.readViewsContainers(viewsContainers[location], rawPlugin);
220
- const loc = location === 'activitybar' ? 'left' : location;
221
+ const loc = location === 'activitybar' ? 'left' : location === 'panel' ? 'bottom' : location;
221
222
  if (contributions.viewsContainers[loc]) {
222
223
  contributions.viewsContainers[loc] = contributions.viewsContainers[loc].concat(containers);
223
224
  } else {
@@ -151,7 +151,8 @@ export function toDefinition(definition: model.CallHierarchyDefinition | undefin
151
151
  selectionRange: toRange(definition.selectionRange),
152
152
  symbolName: definition.name,
153
153
  symbolKind: SymbolKindConverter.toSymbolKind(definition.kind),
154
- containerName: undefined
154
+ containerName: undefined,
155
+ tags: definition.tags
155
156
  };
156
157
  }
157
158
 
@@ -56,7 +56,8 @@ export class CustomEditorOpener implements OpenHandler {
56
56
  switch (this.editor.priority) {
57
57
  case CustomEditorPriority.default: return 500;
58
58
  case CustomEditorPriority.builtin: return 400;
59
- case CustomEditorPriority.option: return 300;
59
+ /** `option` should not open the custom-editor by default. */
60
+ case CustomEditorPriority.option: return 1;
60
61
  default: return 200;
61
62
  }
62
63
  }
@@ -14,7 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { DebugExt, } from '../../../common/plugin-api-rpc';
17
+ import { DebugExt } from '../../../common/plugin-api-rpc';
18
18
  import { DebugConfiguration } from '@theia/debug/lib/common/debug-configuration';
19
19
  import { MaybePromise } from '@theia/core/lib/common/types';
20
20
  import { DebuggerDescription } from '@theia/debug/lib/common/debug-service';
@@ -37,8 +37,8 @@ export class PluginDebugAdapterContribution {
37
37
  return this.description.label;
38
38
  }
39
39
 
40
- async provideDebugConfigurations(workspaceFolderUri: string | undefined): Promise<DebugConfiguration[]> {
41
- return this.debugExt.$provideDebugConfigurations(this.type, workspaceFolderUri);
40
+ async provideDebugConfigurations(workspaceFolderUri: string | undefined, dynamic: boolean = false): Promise<DebugConfiguration[]> {
41
+ return this.debugExt.$provideDebugConfigurations(this.type, workspaceFolderUri, dynamic);
42
42
  }
43
43
 
44
44
  async resolveDebugConfiguration(config: DebugConfiguration, workspaceFolderUri: string | undefined): Promise<DebugConfiguration | undefined> {
@@ -25,6 +25,7 @@ import { WorkspaceService } from '@theia/workspace/lib/browser';
25
25
  import { DebuggerContribution } from '../../../common/plugin-protocol';
26
26
  import { DebugRequestTypes } from '@theia/debug/lib/browser/debug-session-connection';
27
27
  import * as theia from '@theia/plugin';
28
+
28
29
  /**
29
30
  * Debug adapter contribution registrator.
30
31
  */
@@ -111,6 +112,28 @@ export class PluginDebugService implements DebugService, PluginDebugAdapterContr
111
112
  }
112
113
  }
113
114
 
115
+ async provideDynamicDebugConfigurations(): Promise<{ type: string, configurations: DebugConfiguration[] }[]> {
116
+ const result: Promise<{ type: string, configurations: theia.DebugConfiguration[] }>[] = [];
117
+
118
+ for (const [type, contributor] of this.contributors.entries()) {
119
+ const typeConfigurations = this.resolveDynamicConfigurationsForType(type, contributor);
120
+ result.push(typeConfigurations);
121
+ }
122
+
123
+ return Promise.all(result);
124
+ }
125
+
126
+ protected async resolveDynamicConfigurationsForType(
127
+ type: string,
128
+ contributor: PluginDebugAdapterContribution): Promise<{ type: string, configurations: DebugConfiguration[] }> {
129
+
130
+ const configurations = await contributor.provideDebugConfigurations(undefined, true);
131
+ for (const configuration of configurations) {
132
+ configuration.dynamic = true;
133
+ }
134
+ return { type, configurations };
135
+ }
136
+
114
137
  async resolveDebugConfiguration(config: DebugConfiguration, workspaceFolderUri: string | undefined): Promise<DebugConfiguration> {
115
138
  let resolved = config;
116
139
 
@@ -30,7 +30,7 @@ import { TerminalWidgetOptions, TerminalWidget } from '@theia/terminal/lib/brows
30
30
  import { TerminalOptionsExt } from '../../../common/plugin-api-rpc';
31
31
  import { FileService } from '@theia/filesystem/lib/browser/file-service';
32
32
  import { DebugContribution } from '@theia/debug/lib/browser/debug-contribution';
33
- import { ContributionProvider } from '@theia/core';
33
+ import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
34
34
 
35
35
  export class PluginDebugSession extends DebugSession {
36
36
  constructor(
@@ -194,7 +194,7 @@ 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<T>): Promise<void> {
197
+ $createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput): Promise<void> {
198
198
  const sessionId = params.id;
199
199
  let session = this.sessions.get(sessionId);
200
200
  if (!session) {
@@ -18,7 +18,7 @@ import { injectable, inject, postConstruct, optional } from '@theia/core/shared/
18
18
  import {
19
19
  ApplicationShell, ViewContainer as ViewContainerWidget, WidgetManager,
20
20
  ViewContainerIdentifier, ViewContainerTitleOptions, Widget, FrontendApplicationContribution,
21
- StatefulWidget, CommonMenus, BaseWidget, TreeViewWelcomeWidget, codicon
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';
@@ -34,13 +34,13 @@ import { MenuModelRegistry } from '@theia/core/lib/common/menu';
34
34
  import { QuickViewService } from '@theia/core/lib/browser';
35
35
  import { Emitter } from '@theia/core/lib/common/event';
36
36
  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
37
  import { ViewContextKeyService } from './view-context-key-service';
39
38
  import { PROBLEMS_WIDGET_ID } from '@theia/markers/lib/browser/problem/problem-widget';
40
39
  import { OUTPUT_WIDGET_KIND } from '@theia/output/lib/browser/output-widget';
41
40
  import { DebugConsoleContribution } from '@theia/debug/lib/browser/console/debug-console-contribution';
42
41
  import { TERMINAL_WIDGET_FACTORY_ID } from '@theia/terminal/lib/browser/terminal-widget-impl';
43
42
  import { TreeViewWidget } from './tree-view-widget';
43
+ import { SEARCH_VIEW_CONTAINER_ID } from '@theia/search-in-workspace/lib/browser/search-in-workspace-factory';
44
44
 
45
45
  export const PLUGIN_VIEW_FACTORY_ID = 'plugin-view';
46
46
  export const PLUGIN_VIEW_CONTAINER_FACTORY_ID = 'plugin-view-container';
@@ -100,8 +100,8 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
100
100
  protected init(): void {
101
101
  // VS Code Viewlets
102
102
  this.trackVisibleWidget(EXPLORER_VIEW_CONTAINER_ID, { viewletId: 'workbench.view.explorer' });
103
- this.trackVisibleWidget(SearchInWorkspaceWidget.ID, { viewletId: 'workbench.view.search', sideArea: true });
104
103
  this.trackVisibleWidget(SCM_VIEW_CONTAINER_ID, { viewletId: 'workbench.view.scm' });
104
+ this.trackVisibleWidget(SEARCH_VIEW_CONTAINER_ID, { viewletId: 'workbench.view.search' });
105
105
  this.trackVisibleWidget(DebugWidget.ID, { viewletId: 'workbench.view.debug' });
106
106
  // TODO workbench.view.extensions - Theia does not have a proper extension view yet
107
107
 
@@ -111,7 +111,6 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
111
111
  this.trackVisibleWidget(DebugConsoleContribution.options.id, { panelId: 'workbench.panel.repl' });
112
112
  this.trackVisibleWidget(TERMINAL_WIDGET_FACTORY_ID, { panelId: 'workbench.panel.terminal' });
113
113
  // 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
114
 
116
115
  this.updateFocusedView();
117
116
  this.shell.onDidChangeActiveWidget(() => this.updateFocusedView());
@@ -123,6 +122,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
123
122
  if (factoryId === SCM_VIEW_CONTAINER_ID && widget instanceof ViewContainerWidget) {
124
123
  waitUntil(this.prepareViewContainer('scm', widget));
125
124
  }
125
+ if (factoryId === SEARCH_VIEW_CONTAINER_ID && widget instanceof ViewContainerWidget) {
126
+ waitUntil(this.prepareViewContainer('search', widget));
127
+ }
126
128
  if (factoryId === DebugWidget.ID && widget instanceof DebugWidget) {
127
129
  const viewContainer = widget['sessionWidget']['viewContainer'];
128
130
  waitUntil(this.prepareViewContainer('debug', viewContainer));
@@ -401,7 +403,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
401
403
  return;
402
404
  }
403
405
  const [, view] = data;
404
- widget.title.label = view.name;
406
+ if (!widget.title.label) {
407
+ widget.title.label = view.name;
408
+ }
405
409
  const currentDataWidget = widget.widgets[0];
406
410
  const viewDataWidget = await this.createViewDataWidget(view.id);
407
411
  if (widget.isDisposed) {
@@ -466,6 +470,14 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
466
470
  }
467
471
  for (const viewId of this.getContainerViews(viewContainerId)) {
468
472
  const identifier = this.toPluginViewWidgetIdentifier(viewId);
473
+ // Keep existing widget in its current container and reregister its part to the plugin view widget events.
474
+ const existingWidget = this.widgetManager.tryGetWidget<PluginViewWidget>(PLUGIN_VIEW_FACTORY_ID, identifier);
475
+ if (existingWidget && existingWidget.currentViewContainerId) {
476
+ const currentContainer = await this.getPluginViewContainer(existingWidget.currentViewContainerId);
477
+ if (currentContainer && this.registerWidgetPartEvents(existingWidget, currentContainer)) {
478
+ continue;
479
+ }
480
+ }
469
481
  const widget = await this.widgetManager.getOrCreateWidget<PluginViewWidget>(PLUGIN_VIEW_FACTORY_ID, identifier);
470
482
  if (containerWidget.getTrackableWidgets().indexOf(widget) === -1) {
471
483
  containerWidget.addWidget(widget, {
@@ -473,27 +485,49 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
473
485
  initiallyHidden: !this.isViewVisible(viewId)
474
486
  });
475
487
  }
476
- const part = containerWidget.getPartFor(widget);
477
- if (part) {
478
- // if a view is explicitly hidden then suppress updating visibility based on `when` closure
479
- part.onDidChangeVisibility(() => widget.suppressUpdateViewVisibility = part.isHidden);
488
+ this.registerWidgetPartEvents(widget, containerWidget);
489
+ }
490
+ }
480
491
 
481
- const tryFireOnDidExpandView = () => {
482
- if (widget.widgets.length === 0) {
483
- if (!part.collapsed && part.isVisible) {
484
- this.onDidExpandViewEmitter.fire(viewId);
485
- }
486
- } else {
487
- toFire.dispose();
492
+ protected registerWidgetPartEvents(widget: PluginViewWidget, containerWidget: ViewContainerWidget): ViewContainerPart | undefined {
493
+ const part = containerWidget.getPartFor(widget);
494
+ if (part) {
495
+
496
+ widget.currentViewContainerId = this.getViewContainerId(containerWidget);
497
+ part.onDidMove(event => { widget.currentViewContainerId = this.getViewContainerId(event); });
498
+
499
+ // if a view is explicitly hidden then suppress updating visibility based on `when` closure
500
+ part.onDidChangeVisibility(() => widget.suppressUpdateViewVisibility = part.isHidden);
501
+
502
+ const tryFireOnDidExpandView = () => {
503
+ if (widget.widgets.length === 0) {
504
+ if (!part.collapsed && part.isVisible) {
505
+ const viewId = this.toViewId(widget.options);
506
+ this.onDidExpandViewEmitter.fire(viewId);
488
507
  }
489
- };
490
- const toFire = new DisposableCollection(
491
- part.onCollapsed(tryFireOnDidExpandView),
492
- part.onDidChangeVisibility(tryFireOnDidExpandView)
493
- );
508
+ } else {
509
+ toFire.dispose();
510
+ }
511
+ };
512
+ const toFire = new DisposableCollection(
513
+ part.onCollapsed(tryFireOnDidExpandView),
514
+ part.onDidChangeVisibility(tryFireOnDidExpandView)
515
+ );
494
516
 
495
- tryFireOnDidExpandView();
496
- }
517
+ tryFireOnDidExpandView();
518
+ return part;
519
+ }
520
+ };
521
+
522
+ protected getViewContainerId(container: ViewContainerWidget): string | undefined {
523
+ const description = this.widgetManager.getDescription(container);
524
+ switch (description?.factoryId) {
525
+ case EXPLORER_VIEW_CONTAINER_ID: return 'explorer';
526
+ case SCM_VIEW_CONTAINER_ID: return 'scm';
527
+ case SEARCH_VIEW_CONTAINER_ID: return 'search';
528
+ case undefined: return container.parent?.parent instanceof DebugWidget ? 'debug' : container.id;
529
+ case PLUGIN_VIEW_CONTAINER_FACTORY_ID: return this.toViewContainerId(description.options);
530
+ default: return container.id;
497
531
  }
498
532
  }
499
533
 
@@ -504,6 +538,9 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
504
538
  if (viewContainerId === 'scm') {
505
539
  return this.widgetManager.getWidget<ViewContainerWidget>(SCM_VIEW_CONTAINER_ID);
506
540
  }
541
+ if (viewContainerId === 'search') {
542
+ return this.widgetManager.getWidget<ViewContainerWidget>(SEARCH_VIEW_CONTAINER_ID);
543
+ }
507
544
  if (viewContainerId === 'debug') {
508
545
  const debug = await this.widgetManager.getWidget(DebugWidget.ID);
509
546
  if (debug instanceof DebugWidget) {
@@ -546,6 +583,12 @@ export class PluginViewRegistry implements FrontendApplicationContribution {
546
583
  await this.prepareViewContainer('scm', scm);
547
584
  }
548
585
  })().catch(console.error));
586
+ promises.push((async () => {
587
+ const search = await this.widgetManager.getWidget(SEARCH_VIEW_CONTAINER_ID);
588
+ if (search instanceof ViewContainerWidget) {
589
+ await this.prepareViewContainer('search', search);
590
+ }
591
+ })().catch(console.error));
549
592
  promises.push((async () => {
550
593
  const debug = await this.widgetManager.getWidget(DebugWidget.ID);
551
594
  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
  }
@@ -25,19 +25,28 @@
25
25
  const hostMessaging = new class HostMessaging {
26
26
  constructor() {
27
27
  this.handlers = new Map();
28
- window.addEventListener('message', (e) => {
29
- if (e.data && (e.data.command === 'onmessage' || e.data.command === 'do-update-state')) {
28
+ window.addEventListener('message', e => {
29
+ let sourceIsChildFrame = false;
30
+ for (let i = 0; i < window.frames.length; i++) {
31
+ const frame = window.frames[i];
32
+ if (e.source === frame) {
33
+ sourceIsChildFrame = true;
34
+ break;
35
+ }
36
+ }
37
+ if (sourceIsChildFrame && e.data && (e.data.command === 'onmessage' || e.data.command === 'do-update-state')) {
30
38
  // Came from inner iframe
31
39
  this.postMessage(e.data.command, e.data.data);
32
- return;
33
40
  }
34
-
35
- const channel = e.data.channel;
36
- const handler = this.handlers.get(channel);
37
- if (handler) {
38
- handler(e, e.data.args);
39
- } else {
40
- console.error('no handler for ', e);
41
+ // Note: `window.parent === window` when there is no parent...
42
+ if (sourceIsChildFrame || e.source === window.parent) {
43
+ const channel = e.data.channel;
44
+ const handler = this.handlers.get(channel);
45
+ if (handler) {
46
+ handler(e, e.data.args);
47
+ } else {
48
+ console.error('no handler for ', e);
49
+ }
41
50
  }
42
51
  });
43
52
  }
@@ -193,7 +193,6 @@
193
193
  initialScrollProgress: undefined
194
194
  };
195
195
 
196
-
197
196
  /**
198
197
  * @param {HTMLDocument?} document
199
198
  * @param {HTMLElement?} body
@@ -72,7 +72,8 @@ export class CallHierarchyAdapter {
72
72
  range: this.fromRange(item.range),
73
73
  selectionRange: this.fromRange(item.selectionRange),
74
74
  name: item.name,
75
- kind: item.kind
75
+ kind: item.kind,
76
+ tags: item.tags
76
77
  };
77
78
  }
78
79