@theia/plugin-ext 1.18.0-next.8e7f15b3 → 1.18.0-next.93

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 (168) 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 +27 -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 +2 -2
  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/dialogs/modal-notification.d.ts +1 -1
  45. package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
  46. package/lib/main/browser/dialogs/modal-notification.js +4 -4
  47. package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
  48. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  49. package/lib/main/browser/plugin-ext-frontend-module.js +5 -3
  50. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  51. package/lib/main/browser/plugin-ext-widget.d.ts.map +1 -1
  52. package/lib/main/browser/plugin-ext-widget.js +3 -2
  53. package/lib/main/browser/plugin-ext-widget.js.map +1 -1
  54. package/lib/main/browser/plugin-icon-theme-service.d.ts +2 -0
  55. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  56. package/lib/main/browser/plugin-icon-theme-service.js +15 -2
  57. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  58. package/lib/main/browser/plugin-shared-style.js +1 -1
  59. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  60. package/lib/main/browser/quick-open-main.d.ts +3 -6
  61. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  62. package/lib/main/browser/quick-open-main.js +48 -100
  63. package/lib/main/browser/quick-open-main.js.map +1 -1
  64. package/lib/main/browser/view/plugin-view-registry.d.ts +3 -1
  65. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  66. package/lib/main/browser/view/plugin-view-registry.js +62 -21
  67. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  68. package/lib/main/browser/view/plugin-view-widget.d.ts +9 -1
  69. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  70. package/lib/main/browser/view/plugin-view-widget.js +13 -1
  71. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  72. package/lib/main/browser/view/tree-views-main.d.ts +1 -0
  73. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  74. package/lib/main/browser/view/tree-views-main.js +6 -0
  75. package/lib/main/browser/view/tree-views-main.js.map +1 -1
  76. package/lib/main/browser/webview/webview.d.ts +1 -1
  77. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  78. package/lib/main/browser/webview/webview.js +2 -2
  79. package/lib/main/browser/webview/webview.js.map +1 -1
  80. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  81. package/lib/plugin/languages/call-hierarchy.js +2 -1
  82. package/lib/plugin/languages/call-hierarchy.js.map +1 -1
  83. package/lib/plugin/languages.d.ts.map +1 -1
  84. package/lib/plugin/languages.js +2 -1
  85. package/lib/plugin/languages.js.map +1 -1
  86. package/lib/plugin/node/debug/debug.d.ts +4 -3
  87. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  88. package/lib/plugin/node/debug/debug.js +34 -15
  89. package/lib/plugin/node/debug/debug.js.map +1 -1
  90. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
  91. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  92. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  93. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
  94. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  95. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
  96. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  97. package/lib/plugin/plugin-context.d.ts.map +1 -1
  98. package/lib/plugin/plugin-context.js +9 -3
  99. package/lib/plugin/plugin-context.js.map +1 -1
  100. package/lib/plugin/plugin-manager.d.ts +2 -0
  101. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  102. package/lib/plugin/plugin-manager.js +24 -3
  103. package/lib/plugin/plugin-manager.js.map +1 -1
  104. package/lib/plugin/plugin-storage.d.ts +4 -0
  105. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  106. package/lib/plugin/plugin-storage.js +6 -1
  107. package/lib/plugin/plugin-storage.js.map +1 -1
  108. package/lib/plugin/quick-open.d.ts +1 -3
  109. package/lib/plugin/quick-open.d.ts.map +1 -1
  110. package/lib/plugin/quick-open.js +12 -27
  111. package/lib/plugin/quick-open.js.map +1 -1
  112. package/lib/plugin/tasks/tasks.d.ts +1 -1
  113. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  114. package/lib/plugin/tasks/tasks.js +3 -2
  115. package/lib/plugin/tasks/tasks.js.map +1 -1
  116. package/lib/plugin/tree/tree-views.d.ts +3 -0
  117. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  118. package/lib/plugin/tree/tree-views.js +15 -1
  119. package/lib/plugin/tree/tree-views.js.map +1 -1
  120. package/lib/plugin/type-converters.d.ts.map +1 -1
  121. package/lib/plugin/type-converters.js +9 -5
  122. package/lib/plugin/type-converters.js.map +1 -1
  123. package/lib/plugin/types-impl.d.ts +57 -1
  124. package/lib/plugin/types-impl.d.ts.map +1 -1
  125. package/lib/plugin/types-impl.js +88 -1
  126. package/lib/plugin/types-impl.js.map +1 -1
  127. package/package.json +29 -27
  128. package/src/common/arrays.ts +8 -0
  129. package/src/common/plugin-api-rpc-model.ts +2 -0
  130. package/src/common/plugin-api-rpc.ts +29 -8
  131. package/src/common/plugin-protocol.ts +1 -0
  132. package/src/hosted/browser/hosted-plugin.ts +17 -8
  133. package/src/hosted/browser/worker/debug-stub.ts +1 -0
  134. package/src/hosted/node/scanners/scanner-theia.ts +3 -2
  135. package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +2 -1
  136. package/src/main/browser/custom-editors/custom-editor-opener.tsx +7 -2
  137. package/src/main/browser/debug/debug-main.ts +1 -1
  138. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
  139. package/src/main/browser/debug/plugin-debug-service.ts +23 -0
  140. package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
  141. package/src/main/browser/dialogs/modal-notification.ts +6 -6
  142. package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
  143. package/src/main/browser/plugin-ext-widget.tsx +3 -2
  144. package/src/main/browser/plugin-icon-theme-service.ts +12 -2
  145. package/src/main/browser/plugin-shared-style.ts +1 -1
  146. package/src/main/browser/quick-open-main.ts +54 -109
  147. package/src/main/browser/style/index.css +1 -5
  148. package/src/main/browser/style/plugin-sidebar.css +1 -1
  149. package/src/main/browser/view/plugin-view-registry.ts +67 -24
  150. package/src/main/browser/view/plugin-view-widget.ts +22 -3
  151. package/src/main/browser/view/tree-views-main.ts +7 -0
  152. package/src/main/browser/webview/pre/host.js +19 -10
  153. package/src/main/browser/webview/pre/main.js +1 -2
  154. package/src/main/browser/webview/pre/service-worker.js +1 -1
  155. package/src/main/browser/webview/webview.ts +2 -2
  156. package/src/plugin/languages/call-hierarchy.ts +2 -1
  157. package/src/plugin/languages.ts +2 -1
  158. package/src/plugin/node/debug/debug.ts +40 -19
  159. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
  160. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
  161. package/src/plugin/plugin-context.ts +20 -7
  162. package/src/plugin/plugin-manager.ts +26 -4
  163. package/src/plugin/plugin-storage.ts +6 -0
  164. package/src/plugin/quick-open.ts +14 -31
  165. package/src/plugin/tasks/tasks.ts +3 -2
  166. package/src/plugin/tree/tree-views.ts +17 -1
  167. package/src/plugin/type-converters.ts +9 -6
  168. package/src/plugin/types-impl.ts +82 -1
@@ -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';
@@ -41,7 +41,7 @@ export function isPromiseCanceledError(error: any): boolean {
41
41
  }
42
42
 
43
43
  export function getIconUris(iconPath: theia.QuickInputButton['iconPath']): { dark: URI, light: URI } | { id: string } {
44
- if (iconPath instanceof ThemeIcon) {
44
+ if (ThemeIcon.is(iconPath)) {
45
45
  return { id: iconPath.id };
46
46
  }
47
47
  const dark = getDarkIconUri(iconPath as URI | { light: URI; dark: URI; });
@@ -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
@@ -439,7 +436,7 @@ export class QuickInputExt implements QuickInput {
439
436
  const relativePath = path.relative(packagePath, normalizedPath);
440
437
  return PluginPackage.toPluginUrl(this.plugin.rawModel, relativePath);
441
438
  };
442
- if ('id' in iconPath || iconPath instanceof ThemeIcon) {
439
+ if (ThemeIcon.is(iconPath)) {
443
440
  return iconPath;
444
441
  } else if (typeof iconPath === 'string' || iconPath instanceof monaco.Uri) {
445
442
  return URI.parse(toUrl(iconPath));
@@ -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') {
@@ -100,6 +100,12 @@ export class TreeViewsExtImpl implements TreeViewsExt {
100
100
  set title(title: string) {
101
101
  treeView.title = title;
102
102
  },
103
+ get description(): string {
104
+ return treeView.description;
105
+ },
106
+ set description(description: string) {
107
+ treeView.description = description;
108
+ },
103
109
  reveal: (element: T, revealOptions?: Partial<TreeViewRevealOptions>): Thenable<void> =>
104
110
  treeView.reveal(element, revealOptions),
105
111
 
@@ -227,6 +233,16 @@ class TreeViewExtImpl<T> implements Disposable {
227
233
  this.proxy.$setTitle(this.treeViewId, title);
228
234
  }
229
235
 
236
+ private _description: string = '';
237
+ get description(): string {
238
+ return this._description;
239
+ }
240
+
241
+ set description(description: string) {
242
+ this._description = description;
243
+ this.proxy.$setDescription(this.treeViewId, this._description);
244
+ }
245
+
230
246
  getTreeItem(treeItemId: string): T | undefined {
231
247
  const element = this.nodes.get(treeItemId);
232
248
  return element && element.value;
@@ -353,7 +369,7 @@ class TreeViewExtImpl<T> implements Disposable {
353
369
  const { iconPath } = treeItem;
354
370
  if (typeof iconPath === 'string' && iconPath.indexOf('fa-') !== -1) {
355
371
  icon = iconPath;
356
- } else if (iconPath instanceof ThemeIcon) {
372
+ } else if (ThemeIcon.is(iconPath)) {
357
373
  themeIconId = iconPath.id;
358
374
  } else {
359
375
  iconUrl = PluginIconPath.toUrl(<PluginIconPath | undefined>iconPath, this.plugin);
@@ -27,6 +27,7 @@ import { isMarkdownString, MarkdownString } from './markdown-string';
27
27
  import * as types from './types-impl';
28
28
  import { UriComponents } from '../common/uri-components';
29
29
  import { TaskGroup } from './types-impl';
30
+ import { isReadonlyArray } from '../common/arrays';
30
31
 
31
32
  const SIDE_GROUP = -2;
32
33
  const ACTIVE_GROUP = -1;
@@ -168,10 +169,7 @@ export function fromRangeOrRangeWithMessage(ranges: theia.Range[] | theia.Decora
168
169
  };
169
170
  });
170
171
  } else {
171
- return ranges.map((r): DecorationOptions =>
172
- ({
173
- range: fromRange(r)!
174
- }));
172
+ return ranges.map(r => ({ range: fromRange(r) }));
175
173
  }
176
174
  }
177
175
 
@@ -213,7 +211,7 @@ export function toMarkdown(value: model.MarkdownString): MarkdownString {
213
211
  export function fromDocumentSelector(selector: theia.DocumentSelector | undefined): LanguageSelector | undefined {
214
212
  if (!selector) {
215
213
  return undefined;
216
- } else if (Array.isArray(selector)) {
214
+ } else if (isReadonlyArray(selector)) {
217
215
  return <LanguageSelector>selector.map(fromDocumentSelector);
218
216
  } else if (typeof selector === 'string') {
219
217
  return selector;
@@ -271,6 +269,8 @@ export function fromCompletionItemKind(kind?: types.CompletionItemKind): model.C
271
269
  case types.CompletionItemKind.Event: return model.CompletionItemKind.Event;
272
270
  case types.CompletionItemKind.Operator: return model.CompletionItemKind.Operator;
273
271
  case types.CompletionItemKind.TypeParameter: return model.CompletionItemKind.TypeParameter;
272
+ case types.CompletionItemKind.User: return model.CompletionItemKind.User;
273
+ case types.CompletionItemKind.Issue: return model.CompletionItemKind.Issue;
274
274
  }
275
275
  return model.CompletionItemKind.Property;
276
276
  }
@@ -302,6 +302,8 @@ export function toCompletionItemKind(kind?: model.CompletionItemKind): types.Com
302
302
  case model.CompletionItemKind.Event: return types.CompletionItemKind.Event;
303
303
  case model.CompletionItemKind.Operator: return types.CompletionItemKind.Operator;
304
304
  case model.CompletionItemKind.TypeParameter: return types.CompletionItemKind.TypeParameter;
305
+ case model.CompletionItemKind.User: return types.CompletionItemKind.User;
306
+ case model.CompletionItemKind.Issue: return types.CompletionItemKind.Issue;
305
307
  }
306
308
  return types.CompletionItemKind.Property;
307
309
  }
@@ -681,7 +683,8 @@ export function fromCallHierarchyItem(item: theia.CallHierarchyItem): model.Call
681
683
  detail: item.detail,
682
684
  uri: item.uri,
683
685
  range: fromRange(item.range),
684
- selectionRange: fromRange(item.selectionRange)
686
+ selectionRange: fromRange(item.selectionRange),
687
+ tags: item.tags
685
688
  };
686
689
  }
687
690