@theia/plugin-ext 1.18.0-next.907a9c21 → 1.18.0-next.95

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 (139) hide show
  1. package/LICENSE +642 -0
  2. package/lib/common/arrays.d.ts +4 -0
  3. package/lib/common/arrays.d.ts.map +1 -1
  4. package/lib/common/arrays.js +9 -1
  5. package/lib/common/arrays.js.map +1 -1
  6. package/lib/common/plugin-api-rpc-model.d.ts +2 -0
  7. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  8. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  9. package/lib/common/plugin-api-rpc.d.ts +26 -8
  10. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  11. package/lib/common/plugin-api-rpc.js +21 -1
  12. package/lib/common/plugin-api-rpc.js.map +1 -1
  13. package/lib/common/plugin-protocol.d.ts.map +1 -1
  14. package/lib/common/plugin-protocol.js.map +1 -1
  15. package/lib/hosted/browser/hosted-plugin.d.ts +3 -2
  16. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  17. package/lib/hosted/browser/hosted-plugin.js +15 -7
  18. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  19. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  20. package/lib/hosted/browser/worker/debug-stub.js +1 -0
  21. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  22. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  23. package/lib/hosted/node/scanners/scanner-theia.js +1 -1
  24. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  25. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
  26. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +2 -1
  27. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
  28. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +1 -0
  29. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  30. package/lib/main/browser/custom-editors/custom-editor-opener.js +6 -2
  31. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  32. package/lib/main/browser/debug/debug-main.js +1 -1
  33. package/lib/main/browser/debug/debug-main.js.map +1 -1
  34. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  35. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  36. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  37. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  38. package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
  39. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  40. package/lib/main/browser/debug/plugin-debug-service.js +15 -0
  41. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  42. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +2 -2
  43. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  44. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  45. package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
  46. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  47. package/lib/main/browser/quick-open-main.d.ts +3 -6
  48. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  49. package/lib/main/browser/quick-open-main.js +48 -100
  50. package/lib/main/browser/quick-open-main.js.map +1 -1
  51. package/lib/main/browser/view/plugin-view-registry.d.ts +3 -1
  52. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  53. package/lib/main/browser/view/plugin-view-registry.js +61 -20
  54. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  55. package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
  56. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  57. package/lib/main/browser/view/plugin-view-widget.js +3 -1
  58. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  59. package/lib/main/browser/webview/webview.d.ts +1 -1
  60. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  61. package/lib/main/browser/webview/webview.js +2 -2
  62. package/lib/main/browser/webview/webview.js.map +1 -1
  63. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  64. package/lib/plugin/languages/call-hierarchy.js +2 -1
  65. package/lib/plugin/languages/call-hierarchy.js.map +1 -1
  66. package/lib/plugin/languages.d.ts.map +1 -1
  67. package/lib/plugin/languages.js +2 -1
  68. package/lib/plugin/languages.js.map +1 -1
  69. package/lib/plugin/node/debug/debug.d.ts +4 -3
  70. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  71. package/lib/plugin/node/debug/debug.js +34 -15
  72. package/lib/plugin/node/debug/debug.js.map +1 -1
  73. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
  74. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  75. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  76. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
  77. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  78. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
  79. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  80. package/lib/plugin/plugin-context.d.ts.map +1 -1
  81. package/lib/plugin/plugin-context.js +9 -3
  82. package/lib/plugin/plugin-context.js.map +1 -1
  83. package/lib/plugin/plugin-manager.d.ts +2 -0
  84. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  85. package/lib/plugin/plugin-manager.js +24 -3
  86. package/lib/plugin/plugin-manager.js.map +1 -1
  87. package/lib/plugin/plugin-storage.d.ts +4 -0
  88. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  89. package/lib/plugin/plugin-storage.js +6 -1
  90. package/lib/plugin/plugin-storage.js.map +1 -1
  91. package/lib/plugin/quick-open.d.ts +1 -3
  92. package/lib/plugin/quick-open.d.ts.map +1 -1
  93. package/lib/plugin/quick-open.js +10 -25
  94. package/lib/plugin/quick-open.js.map +1 -1
  95. package/lib/plugin/tasks/tasks.d.ts +1 -1
  96. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  97. package/lib/plugin/tasks/tasks.js +3 -2
  98. package/lib/plugin/tasks/tasks.js.map +1 -1
  99. package/lib/plugin/type-converters.d.ts.map +1 -1
  100. package/lib/plugin/type-converters.js +9 -5
  101. package/lib/plugin/type-converters.js.map +1 -1
  102. package/lib/plugin/types-impl.d.ts +54 -1
  103. package/lib/plugin/types-impl.d.ts.map +1 -1
  104. package/lib/plugin/types-impl.js +81 -1
  105. package/lib/plugin/types-impl.js.map +1 -1
  106. package/package.json +29 -27
  107. package/src/common/arrays.ts +8 -0
  108. package/src/common/plugin-api-rpc-model.ts +2 -0
  109. package/src/common/plugin-api-rpc.ts +28 -8
  110. package/src/common/plugin-protocol.ts +1 -0
  111. package/src/hosted/browser/hosted-plugin.ts +17 -8
  112. package/src/hosted/browser/worker/debug-stub.ts +1 -0
  113. package/src/hosted/node/scanners/scanner-theia.ts +2 -1
  114. package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +2 -1
  115. package/src/main/browser/custom-editors/custom-editor-opener.tsx +7 -2
  116. package/src/main/browser/debug/debug-main.ts +1 -1
  117. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
  118. package/src/main/browser/debug/plugin-debug-service.ts +23 -0
  119. package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
  120. package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
  121. package/src/main/browser/quick-open-main.ts +54 -109
  122. package/src/main/browser/view/plugin-view-registry.ts +66 -23
  123. package/src/main/browser/view/plugin-view-widget.ts +7 -2
  124. package/src/main/browser/webview/pre/host.js +19 -10
  125. package/src/main/browser/webview/pre/main.js +1 -2
  126. package/src/main/browser/webview/pre/service-worker.js +1 -1
  127. package/src/main/browser/webview/webview.ts +2 -2
  128. package/src/plugin/languages/call-hierarchy.ts +2 -1
  129. package/src/plugin/languages.ts +2 -1
  130. package/src/plugin/node/debug/debug.ts +40 -19
  131. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
  132. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
  133. package/src/plugin/plugin-context.ts +20 -7
  134. package/src/plugin/plugin-manager.ts +26 -4
  135. package/src/plugin/plugin-storage.ts +6 -0
  136. package/src/plugin/quick-open.ts +12 -29
  137. package/src/plugin/tasks/tasks.ts +3 -2
  138. package/src/plugin/type-converters.ts +9 -6
  139. package/src/plugin/types-impl.ts +76 -1
@@ -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
@@ -477,7 +476,7 @@
477
476
  const newFrame = document.createElement('iframe');
478
477
  newFrame.setAttribute('id', 'pending-frame');
479
478
  newFrame.setAttribute('frameborder', '0');
480
- newFrame.setAttribute('sandbox', options.allowScripts ? 'allow-scripts allow-forms allow-same-origin' : 'allow-same-origin');
479
+ newFrame.setAttribute('sandbox', options.allowScripts ? 'allow-scripts allow-forms allow-same-origin allow-downloads' : 'allow-same-origin');
481
480
  if (host.fakeLoad) {
482
481
  // We should just be able to use srcdoc, but I wasn't
483
482
  // seeing the service worker applying properly.
@@ -248,7 +248,7 @@ async function processLocalhostRequest(event, requestUrl) {
248
248
  const origin = requestUrl.origin;
249
249
 
250
250
  const resolveRedirect = redirectOrigin => {
251
- if (!redirectOrigin) {
251
+ if (!redirectOrigin || requestUrl.origin === redirectOrigin) {
252
252
  return fetch(event.request);
253
253
  }
254
254
  const location = event.request.url.replace(new RegExp(`^${requestUrl.origin}(/|$)`), `${redirectOrigin}$1`);
@@ -40,7 +40,7 @@ import { Schemes } from '../../../common/uri-components';
40
40
  import { PluginSharedStyle } from '../plugin-shared-style';
41
41
  import { WebviewThemeDataProvider } from './webview-theme-data-provider';
42
42
  import { ExternalUriService } from '@theia/core/lib/browser/external-uri-service';
43
- import { OutputChannelManager } from '@theia/output/lib/common/output-channel';
43
+ import { OutputChannelManager } from '@theia/output/lib/browser/output-channel';
44
44
  import { WebviewPreferences } from './webview-preferences';
45
45
  import { WebviewResourceCache } from './webview-resource-cache';
46
46
  import { Endpoint } from '@theia/core/lib/browser/endpoint';
@@ -249,7 +249,7 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget {
249
249
 
250
250
  const element = document.createElement('iframe');
251
251
  element.className = 'webview';
252
- element.sandbox.add('allow-scripts', 'allow-forms', 'allow-same-origin');
252
+ element.sandbox.add('allow-scripts', 'allow-forms', 'allow-same-origin', 'allow-downloads');
253
253
  element.setAttribute('src', `${this.externalEndpoint}/index.html?id=${this.identifier.id}`);
254
254
  element.style.border = 'none';
255
255
  element.style.width = '100%';
@@ -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
 
@@ -90,6 +90,7 @@ import { DeclarationAdapter } from './languages/declaration';
90
90
  import { CallHierarchyAdapter } from './languages/call-hierarchy';
91
91
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
92
92
  import { DocumentSemanticTokensAdapter, DocumentRangeSemanticTokensAdapter } from './languages/semantic-highlighting';
93
+ import { isReadonlyArray } from '../common/arrays';
93
94
 
94
95
  type Adapter = CompletionAdapter |
95
96
  SignatureHelpAdapter |
@@ -204,7 +205,7 @@ export class LanguagesExtImpl implements LanguagesExt {
204
205
  }
205
206
 
206
207
  private transformDocumentSelector(selector: theia.DocumentSelector): SerializedDocumentFilter[] {
207
- if (Array.isArray(selector)) {
208
+ if (isReadonlyArray(selector)) {
208
209
  return selector.map(sel => this.doTransformDocumentSelector(sel)!);
209
210
  }
210
211
 
@@ -15,22 +15,25 @@
15
15
  ********************************************************************************/
16
16
  import { Emitter } from '@theia/core/lib/common/event';
17
17
  import { Path } from '@theia/core/lib/common/path';
18
- import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
19
18
  import * as theia from '@theia/plugin';
20
19
  import { URI } from '@theia/core/shared/vscode-uri';
21
20
  import { Breakpoint } from '../../../common/plugin-api-rpc-model';
22
- import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
21
+ import { DebugConfigurationProviderTriggerKind, DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
23
22
  import { PluginPackageDebuggersContribution } from '../../../common/plugin-protocol';
24
23
  import { RPCProtocol } from '../../../common/rpc-protocol';
25
24
  import { PluginWebSocketChannel } from '../../../common/connection';
26
25
  import { CommandRegistryImpl } from '../../command-registry';
27
26
  import { ConnectionExtImpl } from '../../connection-ext';
28
- import { Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range } from '../../types-impl';
27
+ import {
28
+ Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range,
29
+ DebugAdapterServer, DebugAdapterExecutable, DebugAdapterNamedPipeServer, DebugAdapterInlineImplementation
30
+ } from '../../types-impl';
29
31
  import { resolveDebugAdapterExecutable } from './plugin-debug-adapter-executable-resolver';
30
32
  import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
31
- import { connectDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
33
+ import { connectInlineDebugAdapter, connectPipeDebugAdapter, connectSocketDebugAdapter, startDebugAdapter } from './plugin-debug-adapter-starter';
32
34
  import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
33
35
  import uuid = require('uuid');
36
+ import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
34
37
 
35
38
  /* eslint-disable @typescript-eslint/no-explicit-any */
36
39
 
@@ -43,8 +46,11 @@ export class DebugExtImpl implements DebugExt {
43
46
  // debug sessions by sessionId
44
47
  private sessions = new Map<string, PluginDebugAdapterSession>();
45
48
 
46
- // providers by type
49
+ // providers by type (initial)
47
50
  private configurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
51
+ // providers by type (dynamic)
52
+ private dynamicConfigurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
53
+
48
54
  /**
49
55
  * Only use internally, don't send it to the frontend. It's expensive!
50
56
  * It's already there as a part of the plugin metadata.
@@ -182,19 +188,22 @@ export class DebugExtImpl implements DebugExt {
182
188
  });
183
189
  }
184
190
 
185
- registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider): Disposable {
186
- console.log(`Debug configuration provider has been registered: ${debugType}`);
187
- const providers = this.configurationProviders.get(debugType) || new Set<theia.DebugConfigurationProvider>();
188
- this.configurationProviders.set(debugType, providers);
191
+ registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider, trigger: theia.DebugConfigurationProviderTriggerKind): Disposable {
192
+ console.log(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
193
+ const providersByTriggerKind = trigger === DebugConfigurationProviderTriggerKind.Initial ? this.configurationProviders : this.dynamicConfigurationProviders;
194
+ let providers = providersByTriggerKind.get(debugType);
195
+ if (!providers) {
196
+ providersByTriggerKind.set(debugType, providers = new Set());
197
+ }
189
198
  providers.add(provider);
190
199
 
191
200
  return Disposable.create(() => {
192
201
  // eslint-disable-next-line @typescript-eslint/no-shadow
193
- const providers = this.configurationProviders.get(debugType);
202
+ const providers = providersByTriggerKind.get(debugType);
194
203
  if (providers) {
195
204
  providers.delete(provider);
196
205
  if (providers.size === 0) {
197
- this.configurationProviders.delete(debugType);
206
+ providersByTriggerKind.delete(debugType);
198
207
  }
199
208
  }
200
209
  });
@@ -319,10 +328,10 @@ export class DebugExtImpl implements DebugExt {
319
328
  return undefined;
320
329
  }
321
330
 
322
- async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration[]> {
331
+ async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined, dynamic: boolean = false): Promise<theia.DebugConfiguration[]> {
323
332
  let result: theia.DebugConfiguration[] = [];
324
333
 
325
- const providers = this.configurationProviders.get(debugType);
334
+ const providers = dynamic ? this.dynamicConfigurationProviders.get(debugType) : this.configurationProviders.get(debugType);
326
335
  if (providers) {
327
336
  for (const provider of providers) {
328
337
  if (provider.provideDebugConfigurations) {
@@ -337,7 +346,11 @@ export class DebugExtImpl implements DebugExt {
337
346
  async $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration | undefined> {
338
347
  let current = debugConfiguration;
339
348
 
340
- for (const providers of [this.configurationProviders.get(debugConfiguration.type), this.configurationProviders.get('*')]) {
349
+ for (const providers of [
350
+ this.configurationProviders.get(debugConfiguration.type),
351
+ this.dynamicConfigurationProviders.get(debugConfiguration.type),
352
+ this.configurationProviders.get('*')
353
+ ]) {
341
354
  if (providers) {
342
355
  for (const provider of providers) {
343
356
  if (provider.resolveDebugConfiguration) {
@@ -363,7 +376,11 @@ export class DebugExtImpl implements DebugExt {
363
376
  Promise<theia.DebugConfiguration | undefined> {
364
377
  let current = debugConfiguration;
365
378
 
366
- for (const providers of [this.configurationProviders.get(debugConfiguration.type), this.configurationProviders.get('*')]) {
379
+ for (const providers of [
380
+ this.configurationProviders.get(debugConfiguration.type),
381
+ this.dynamicConfigurationProviders.get(debugConfiguration.type),
382
+ this.configurationProviders.get('*')
383
+ ]) {
367
384
  if (providers) {
368
385
  for (const provider of providers) {
369
386
  if (provider.resolveDebugConfigurationWithSubstitutedVariables) {
@@ -409,16 +426,20 @@ export class DebugExtImpl implements DebugExt {
409
426
  // @param executable The debug adapter's executable information as specified in the package.json (or undefined if no such information exists).
410
427
  const descriptor = await descriptorFactory.createDebugAdapterDescriptor(session, executable);
411
428
  if (descriptor) {
412
- if ('port' in descriptor) {
413
- return connectDebugAdapter(descriptor);
414
- } else {
429
+ if (DebugAdapterServer.is(descriptor)) {
430
+ return connectSocketDebugAdapter(descriptor);
431
+ } else if (DebugAdapterExecutable.is(descriptor)) {
415
432
  return startDebugAdapter(descriptor);
433
+ } else if (DebugAdapterNamedPipeServer.is(descriptor)) {
434
+ return connectPipeDebugAdapter(descriptor);
435
+ } else if (DebugAdapterInlineImplementation.is(descriptor)) {
436
+ return connectInlineDebugAdapter(descriptor);
416
437
  }
417
438
  }
418
439
  }
419
440
 
420
441
  if ('debugServer' in debugConfiguration) {
421
- return connectDebugAdapter({ port: debugConfiguration.debugServer });
442
+ return connectSocketDebugAdapter({ port: debugConfiguration.debugServer });
422
443
  } else {
423
444
  if (!executable) {
424
445
  throw new Error('It is not possible to provide debug adapter executable.');
@@ -14,23 +14,23 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
18
17
  import { DebugAdapterSessionImpl } from '@theia/debug/lib/node/debug-adapter-session';
19
18
  import * as theia from '@theia/plugin';
20
19
  import { IWebSocket } from '@theia/core/shared/vscode-ws-jsonrpc';
20
+ import { CommunicationProvider, DebugAdapterSession } from '@theia/debug/lib/node/debug-model';
21
21
 
22
22
  /* eslint-disable @typescript-eslint/no-explicit-any */
23
23
 
24
24
  /**
25
25
  * Server debug adapter session.
26
26
  */
27
- export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession {
27
+ export class PluginDebugAdapterSession extends DebugAdapterSessionImpl implements theia.DebugSession, DebugAdapterSession {
28
28
  readonly type: string;
29
29
  readonly name: string;
30
30
  readonly configuration: theia.DebugConfiguration;
31
31
 
32
32
  constructor(
33
- protected readonly communicationProvider: CommunicationProvider,
33
+ readonly communicationProvider: CommunicationProvider,
34
34
  protected readonly tracker: theia.DebugAdapterTracker,
35
35
  protected readonly theiaSession: theia.DebugSession) {
36
36
 
@@ -15,15 +15,18 @@
15
15
  ********************************************************************************/
16
16
 
17
17
  import * as net from 'net';
18
- import * as theia from '@theia/plugin';
19
- import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
20
18
  import { ChildProcess, spawn, fork, ForkOptions } from 'child_process';
19
+ import { CommunicationProvider } from '@theia/debug/lib/node/debug-model';
20
+ import { StreamCommunicationProvider } from '@theia/debug/lib/node/stream-communication-provider';
21
+ import { Disposable } from '@theia/core/lib/common/disposable';
22
+ import { DebugAdapterExecutable, DebugAdapterInlineImplementation, DebugAdapterNamedPipeServer, DebugAdapterServer } from '../../types-impl';
23
+ import { InlineCommunicationProvider } from '@theia/debug/lib/node/inline-communication-provider';
21
24
  const isElectron = require('is-electron');
22
25
 
23
26
  /**
24
27
  * Starts debug adapter process.
25
28
  */
26
- export function startDebugAdapter(executable: theia.DebugAdapterExecutable): CommunicationProvider {
29
+ export function startDebugAdapter(executable: DebugAdapterExecutable): CommunicationProvider {
27
30
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
31
  const options: any = { stdio: ['pipe', 'pipe', 2] };
29
32
 
@@ -63,21 +66,28 @@ export function startDebugAdapter(executable: theia.DebugAdapterExecutable): Com
63
66
  childProcess = spawn(command, args, options);
64
67
  }
65
68
 
66
- return {
67
- input: childProcess.stdin!,
68
- output: childProcess.stdout!,
69
- dispose: () => childProcess.kill()
70
- };
69
+ const provider = new StreamCommunicationProvider(childProcess.stdout!, childProcess.stdin!);
70
+ provider.push(Disposable.create(() => childProcess.kill()));
71
+ return provider;
71
72
  }
72
73
 
73
74
  /**
74
75
  * Connects to a remote debug server.
75
76
  */
76
- export function connectDebugAdapter(server: theia.DebugAdapterServer): CommunicationProvider {
77
+ export function connectSocketDebugAdapter(server: DebugAdapterServer): CommunicationProvider {
77
78
  const socket = net.createConnection(server.port, server.host);
78
- return {
79
- input: socket,
80
- output: socket,
81
- dispose: () => socket.end()
82
- };
79
+ const provider = new StreamCommunicationProvider(socket, socket);
80
+ provider.push(Disposable.create(() => socket.end()));
81
+ return provider;
82
+ }
83
+
84
+ export function connectPipeDebugAdapter(adapter: DebugAdapterNamedPipeServer): CommunicationProvider {
85
+ const socket = net.createConnection(adapter.path);
86
+ const provider = new StreamCommunicationProvider(socket, socket);
87
+ provider.push(Disposable.create(() => socket.end()));
88
+ return provider;
89
+ }
90
+
91
+ export function connectInlineDebugAdapter(adapter: DebugAdapterInlineImplementation): CommunicationProvider {
92
+ return new InlineCommunicationProvider(adapter.implementation);
83
93
  }
@@ -17,7 +17,7 @@
17
17
  /* eslint-disable @typescript-eslint/no-explicit-any */
18
18
  /* tslint:disable:typedef */
19
19
 
20
- import * as theia from '@theia/plugin';
20
+ import type * as theia from '@theia/plugin';
21
21
  import { CommandRegistryImpl } from './command-registry';
22
22
  import { Emitter } from '@theia/core/lib/common/event';
23
23
  import { CancellationTokenSource } from '@theia/core/lib/common/cancellation';
@@ -27,7 +27,8 @@ import {
27
27
  Plugin as InternalPlugin,
28
28
  PluginManager,
29
29
  PluginAPIFactory,
30
- MainMessageType
30
+ MainMessageType,
31
+ DebugConfigurationProviderTriggerKind
31
32
  } from '../common/plugin-api-rpc';
32
33
  import { RPCProtocol } from '../common/rpc-protocol';
33
34
  import { MessageRegistryExt } from './message-registry';
@@ -105,6 +106,8 @@ import {
105
106
  Task2,
106
107
  DebugAdapterExecutable,
107
108
  DebugAdapterServer,
109
+ DebugAdapterNamedPipeServer,
110
+ DebugAdapterInlineImplementation,
108
111
  Breakpoint,
109
112
  SourceBreakpoint,
110
113
  FunctionBreakpoint,
@@ -134,7 +137,8 @@ import {
134
137
  ColorThemeKind,
135
138
  SourceControlInputBoxValidationType,
136
139
  URI,
137
- FileDecoration
140
+ FileDecoration,
141
+ ExtensionMode
138
142
  } from './types-impl';
139
143
  import { AuthenticationExtImpl } from './authentication-ext';
140
144
  import { SymbolKind } from '../common/plugin-api-rpc-model';
@@ -149,7 +153,7 @@ import { LanguagesExtImpl } from './languages';
149
153
  import { fromDocumentSelector, pluginToPluginInfo, fromGlobPattern } from './type-converters';
150
154
  import { DialogsExtImpl } from './dialogs';
151
155
  import { NotificationExtImpl } from './notification';
152
- import { CancellationToken } from '@theia/core/lib/common/cancellation';
156
+ import { CancellationToken, CancellationError } from '@theia/core/lib/common/cancellation';
153
157
  import { score } from '@theia/callhierarchy/lib/common/language-selector';
154
158
  import { MarkdownString } from './markdown-string';
155
159
  import { TreeViewsExtImpl } from './tree/tree-views';
@@ -767,8 +771,12 @@ export function createAPIFactory(
767
771
  registerDebugAdapterDescriptorFactory(debugType: string, factory: theia.DebugAdapterDescriptorFactory): Disposable {
768
772
  return debugExt.registerDebugAdapterDescriptorFactory(debugType, factory);
769
773
  },
770
- registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider): Disposable {
771
- return debugExt.registerDebugConfigurationProvider(debugType, provider);
774
+ registerDebugConfigurationProvider(
775
+ debugType: string,
776
+ provider: theia.DebugConfigurationProvider,
777
+ triggerKind?: theia.DebugConfigurationProviderTriggerKind
778
+ ): Disposable {
779
+ return debugExt.registerDebugConfigurationProvider(debugType, provider, triggerKind || DebugConfigurationProviderTriggerKind.Initial);
772
780
  },
773
781
  registerDebugAdapterTrackerFactory(debugType: string, factory: theia.DebugAdapterTrackerFactory): Disposable {
774
782
  return debugExt.registerDebugAdapterTrackerFactory(debugType, factory);
@@ -924,6 +932,9 @@ export function createAPIFactory(
924
932
  Task2,
925
933
  DebugAdapterExecutable,
926
934
  DebugAdapterServer,
935
+ DebugAdapterNamedPipeServer,
936
+ DebugAdapterInlineImplementation,
937
+ DebugConfigurationProviderTriggerKind,
927
938
  Breakpoint,
928
939
  SourceBreakpoint,
929
940
  FunctionBreakpoint,
@@ -952,7 +963,9 @@ export function createAPIFactory(
952
963
  SemanticTokensEdit,
953
964
  ColorThemeKind,
954
965
  SourceControlInputBoxValidationType,
955
- FileDecoration
966
+ FileDecoration,
967
+ CancellationError,
968
+ ExtensionMode
956
969
  };
957
970
  };
958
971
  }
@@ -33,7 +33,7 @@ import * as theia from '@theia/plugin';
33
33
  import { join } from './path';
34
34
  import { EnvExtImpl } from './env';
35
35
  import { PreferenceRegistryExtImpl } from './preference-registry';
36
- import { Memento, KeyValueStorageProxy } from './plugin-storage';
36
+ import { Memento, KeyValueStorageProxy, GlobalState } from './plugin-storage';
37
37
  import { ExtPluginApi } from '../common/plugin-ext-api-contribution';
38
38
  import { RPCProtocol } from '../common/rpc-protocol';
39
39
  import { Emitter } from '@theia/core/lib/common/event';
@@ -79,7 +79,11 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
79
79
  '*',
80
80
  'onLanguage',
81
81
  'onCommand',
82
- 'onDebug', 'onDebugInitialConfigurations', 'onDebugResolve', 'onDebugAdapterProtocolTracker',
82
+ 'onDebug',
83
+ 'onDebugInitialConfigurations',
84
+ 'onDebugResolve',
85
+ 'onDebugAdapterProtocolTracker',
86
+ 'onDebugDynamicConfigurations',
83
87
  'workspaceContains',
84
88
  'onView',
85
89
  'onUri',
@@ -321,6 +325,23 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
321
325
  }
322
326
 
323
327
  async $activateByEvent(activationEvent: string): Promise<void> {
328
+ if (activationEvent.endsWith(':*')) {
329
+ const baseEvent = activationEvent.substring(0, activationEvent.length - 2);
330
+ await this.activateByBaseEvent(baseEvent);
331
+ } else {
332
+ await this.activateBySingleEvent(activationEvent);
333
+ }
334
+ }
335
+
336
+ protected async activateByBaseEvent(baseEvent: string): Promise<void> {
337
+ await Promise.all(Array.from(this.activations.keys(), activation => {
338
+ if (activation.startsWith(baseEvent)) {
339
+ return this.activateBySingleEvent(activation);
340
+ }
341
+ }));
342
+ }
343
+
344
+ protected async activateBySingleEvent(activationEvent: string): Promise<void> {
324
345
  const activations = this.activations.get(activationEvent);
325
346
  if (!activations) {
326
347
  return;
@@ -351,7 +372,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
351
372
  const pluginContext: theia.PluginContext = {
352
373
  extensionPath: plugin.pluginFolder,
353
374
  extensionUri: Uri.file(plugin.pluginFolder),
354
- globalState: new Memento(plugin.model.id, true, this.storageProxy),
375
+ globalState: new GlobalState(plugin.model.id, true, this.storageProxy),
355
376
  workspaceState: new Memento(plugin.model.id, false, this.storageProxy),
356
377
  subscriptions: subscriptions,
357
378
  asAbsolutePath: asAbsolutePath,
@@ -361,7 +382,8 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
361
382
  secrets,
362
383
  globalStoragePath: globalStoragePath,
363
384
  globalStorageUri: Uri.file(globalStoragePath),
364
- environmentVariableCollection: this.terminalService.getEnvironmentVariableCollection(plugin.model.id)
385
+ environmentVariableCollection: this.terminalService.getEnvironmentVariableCollection(plugin.model.id),
386
+ extensionMode: 1 // @todo: implement proper `extensionMode`.
365
387
  };
366
388
  this.pluginContextsMap.set(plugin.model.id, pluginContext);
367
389
 
@@ -60,6 +60,12 @@ export class Memento implements theia.Memento {
60
60
  }
61
61
  }
62
62
 
63
+ export class GlobalState extends Memento {
64
+
65
+ /** @todo: API is not yet implemented. */
66
+ setKeysForSync(keys: readonly string[]): void { }
67
+ }
68
+
63
69
  /**
64
70
  * Singleton.
65
71
  * Is used to proxy storage requests to main side.
@@ -16,7 +16,7 @@
16
16
  /* eslint-disable @typescript-eslint/no-explicit-any */
17
17
  import {
18
18
  QuickOpenExt, PLUGIN_RPC_CONTEXT as Ext, QuickOpenMain, TransferInputBox, Plugin,
19
- Item, TransferQuickInputButton, TransferQuickPickItems, TransferQuickInput, TransferQuickPick
19
+ Item, TransferQuickInputButton, TransferQuickPickItems, TransferQuickInput
20
20
  } from '../common/plugin-api-rpc';
21
21
  import * as theia from '@theia/plugin';
22
22
  import { QuickPickItem, InputBoxOptions, InputBox, QuickPick, QuickInput } from '@theia/plugin';
@@ -178,10 +178,6 @@ export class QuickOpenExtImpl implements QuickOpenExt {
178
178
  return session;
179
179
  }
180
180
 
181
- showCustomQuickPick<T extends QuickPickItem>(options: TransferQuickPick<T>): void {
182
- this.proxy.$showCustomQuickPick(options);
183
- }
184
-
185
181
  hide(): void {
186
182
  this.proxy.$hide();
187
183
  }
@@ -263,7 +259,7 @@ export class QuickInputExt implements QuickInput {
263
259
  private onDidHideEmitter: Emitter<void>;
264
260
  private onDidTriggerButtonEmitter: Emitter<theia.QuickInputButton>;
265
261
  private _updateTimeout: any;
266
- private _pendingUpdate: TransferQuickInput<any> = { id: this._id };
262
+ private _pendingUpdate: TransferQuickInput = { id: this._id };
267
263
 
268
264
  constructor(readonly quickOpen: QuickOpenExtImpl, readonly quickOpenMain: QuickOpenMain, readonly plugin: Plugin, private _onDidDispose: () => void) {
269
265
  this.title = undefined;
@@ -389,6 +385,7 @@ export class QuickInputExt implements QuickInput {
389
385
  this._fireHide();
390
386
  this.disposableCollection.dispose();
391
387
  this._onDidDispose();
388
+ this.quickOpenMain.$dispose(this._id);
392
389
  }
393
390
 
394
391
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
@@ -617,7 +614,15 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
617
614
  this._itemsToHandles.set(item, i);
618
615
  });
619
616
  this.update({
620
- items
617
+ items: items.map((item, i) => ({
618
+ type: item.type,
619
+ label: item.label,
620
+ description: item.description,
621
+ handle: i,
622
+ detail: item.detail,
623
+ picked: item.picked,
624
+ alwaysShow: item.alwaysShow
625
+ }))
621
626
  });
622
627
  }
623
628
 
@@ -690,26 +695,4 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
690
695
  this._selectedItems = items;
691
696
  this._onDidChangeSelectionEmitter.fire(items);
692
697
  }
693
-
694
- show(): void {
695
- super.show();
696
- this.quickOpen.showCustomQuickPick({
697
- id: this._id,
698
- title: this.title,
699
- step: this.step,
700
- totalSteps: this.totalSteps,
701
- enabled: this.enabled,
702
- busy: this.busy,
703
- ignoreFocusOut: this.ignoreFocusOut,
704
- value: this.value,
705
- placeholder: this.placeholder,
706
- buttons: this.buttons,
707
- items: convertToTransferQuickPickItems(this.items),
708
- canSelectMany: this.canSelectMany,
709
- matchOnDescription: this.matchOnDescription,
710
- matchOnDetail: this.matchOnDetail,
711
- activeItems: this.activeItems,
712
- selectedItems: this.selectedItems
713
- });
714
- }
715
698
  }
@@ -29,6 +29,7 @@ import { TaskProviderAdapter } from './task-provider';
29
29
  import { Emitter, Event } from '@theia/core/lib/common/event';
30
30
  import { TerminalServiceExtImpl } from '../terminal-ext';
31
31
  import { UUID } from '@theia/core/shared/@phosphor/coreutils';
32
+ import { CancellationToken } from '@theia/core/lib/common/cancellation';
32
33
 
33
34
  type ExecutionCallback = (resolvedDefinition: theia.TaskDefinition) => Thenable<theia.Pseudoterminal>;
34
35
  export class TasksExtImpl implements TasksExt {
@@ -164,10 +165,10 @@ export class TasksExtImpl implements TasksExt {
164
165
  throw new Error('Task was not successfully transformed into a task config');
165
166
  }
166
167
 
167
- $provideTasks(handle: number, token: theia.CancellationToken): Promise<TaskDto[] | undefined> {
168
+ $provideTasks(handle: number): Promise<TaskDto[] | undefined> {
168
169
  const adapter = this.adaptersMap.get(handle);
169
170
  if (adapter) {
170
- return adapter.provideTasks(token).then(tasks => {
171
+ return adapter.provideTasks(CancellationToken.None).then(tasks => {
171
172
  if (tasks) {
172
173
  for (const task of tasks) {
173
174
  if (task.taskType === 'customExecution') {