@theia/plugin-ext 1.18.0-next.73c11a11 → 1.18.0-next.77

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 (149) 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 +22 -3
  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/plugin-debug-adapter-contribution.d.ts +1 -1
  33. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  34. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  35. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  36. package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
  37. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  38. package/lib/main/browser/debug/plugin-debug-service.js +15 -0
  39. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  40. package/lib/main/browser/dialogs/modal-notification.d.ts +1 -1
  41. package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
  42. package/lib/main/browser/dialogs/modal-notification.js +4 -4
  43. package/lib/main/browser/dialogs/modal-notification.js.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/plugin-ext-widget.d.ts.map +1 -1
  48. package/lib/main/browser/plugin-ext-widget.js +3 -2
  49. package/lib/main/browser/plugin-ext-widget.js.map +1 -1
  50. package/lib/main/browser/plugin-icon-theme-service.d.ts +2 -0
  51. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  52. package/lib/main/browser/plugin-icon-theme-service.js +15 -2
  53. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  54. package/lib/main/browser/plugin-shared-style.js +1 -1
  55. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  56. package/lib/main/browser/quick-open-main.d.ts +2 -5
  57. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  58. package/lib/main/browser/quick-open-main.js +48 -100
  59. package/lib/main/browser/quick-open-main.js.map +1 -1
  60. package/lib/main/browser/view/plugin-view-registry.js +1 -1
  61. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  62. package/lib/main/browser/view/plugin-view-widget.d.ts +7 -1
  63. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  64. package/lib/main/browser/view/plugin-view-widget.js +10 -0
  65. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  66. package/lib/main/browser/view/tree-views-main.d.ts +1 -0
  67. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  68. package/lib/main/browser/view/tree-views-main.js +6 -0
  69. package/lib/main/browser/view/tree-views-main.js.map +1 -1
  70. package/lib/main/browser/webview/webview.js +1 -1
  71. package/lib/main/browser/webview/webview.js.map +1 -1
  72. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  73. package/lib/plugin/languages/call-hierarchy.js +2 -1
  74. package/lib/plugin/languages/call-hierarchy.js.map +1 -1
  75. package/lib/plugin/languages.d.ts.map +1 -1
  76. package/lib/plugin/languages.js +2 -1
  77. package/lib/plugin/languages.js.map +1 -1
  78. package/lib/plugin/node/debug/debug.d.ts +3 -2
  79. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  80. package/lib/plugin/node/debug/debug.js +24 -11
  81. package/lib/plugin/node/debug/debug.js.map +1 -1
  82. package/lib/plugin/plugin-context.d.ts.map +1 -1
  83. package/lib/plugin/plugin-context.js +7 -3
  84. package/lib/plugin/plugin-context.js.map +1 -1
  85. package/lib/plugin/plugin-manager.d.ts +2 -0
  86. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  87. package/lib/plugin/plugin-manager.js +24 -3
  88. package/lib/plugin/plugin-manager.js.map +1 -1
  89. package/lib/plugin/plugin-storage.d.ts +4 -0
  90. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  91. package/lib/plugin/plugin-storage.js +6 -1
  92. package/lib/plugin/plugin-storage.js.map +1 -1
  93. package/lib/plugin/quick-open.d.ts +1 -3
  94. package/lib/plugin/quick-open.d.ts.map +1 -1
  95. package/lib/plugin/quick-open.js +4 -26
  96. package/lib/plugin/quick-open.js.map +1 -1
  97. package/lib/plugin/tasks/tasks.d.ts +1 -1
  98. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  99. package/lib/plugin/tasks/tasks.js +3 -2
  100. package/lib/plugin/tasks/tasks.js.map +1 -1
  101. package/lib/plugin/tree/tree-views.d.ts +3 -0
  102. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  103. package/lib/plugin/tree/tree-views.js +15 -1
  104. package/lib/plugin/tree/tree-views.js.map +1 -1
  105. package/lib/plugin/type-converters.d.ts.map +1 -1
  106. package/lib/plugin/type-converters.js +9 -5
  107. package/lib/plugin/type-converters.js.map +1 -1
  108. package/lib/plugin/types-impl.d.ts +24 -1
  109. package/lib/plugin/types-impl.d.ts.map +1 -1
  110. package/lib/plugin/types-impl.js +28 -1
  111. package/lib/plugin/types-impl.js.map +1 -1
  112. package/package.json +29 -27
  113. package/src/common/arrays.ts +8 -0
  114. package/src/common/plugin-api-rpc-model.ts +2 -0
  115. package/src/common/plugin-api-rpc.ts +24 -3
  116. package/src/common/plugin-protocol.ts +1 -0
  117. package/src/hosted/browser/hosted-plugin.ts +17 -8
  118. package/src/hosted/browser/worker/debug-stub.ts +1 -0
  119. package/src/hosted/node/scanners/scanner-theia.ts +3 -2
  120. package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +2 -1
  121. package/src/main/browser/custom-editors/custom-editor-opener.tsx +7 -2
  122. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
  123. package/src/main/browser/debug/plugin-debug-service.ts +23 -0
  124. package/src/main/browser/dialogs/modal-notification.ts +6 -6
  125. package/src/main/browser/plugin-ext-frontend-module.ts +6 -4
  126. package/src/main/browser/plugin-ext-widget.tsx +3 -2
  127. package/src/main/browser/plugin-icon-theme-service.ts +12 -2
  128. package/src/main/browser/plugin-shared-style.ts +1 -1
  129. package/src/main/browser/quick-open-main.ts +53 -108
  130. package/src/main/browser/style/index.css +1 -5
  131. package/src/main/browser/style/plugin-sidebar.css +1 -1
  132. package/src/main/browser/view/plugin-view-registry.ts +2 -2
  133. package/src/main/browser/view/plugin-view-widget.ts +15 -1
  134. package/src/main/browser/view/tree-views-main.ts +7 -0
  135. package/src/main/browser/webview/pre/host.js +19 -10
  136. package/src/main/browser/webview/pre/main.js +1 -2
  137. package/src/main/browser/webview/pre/service-worker.js +1 -1
  138. package/src/main/browser/webview/webview.ts +1 -1
  139. package/src/plugin/languages/call-hierarchy.ts +2 -1
  140. package/src/plugin/languages.ts +2 -1
  141. package/src/plugin/node/debug/debug.ts +26 -12
  142. package/src/plugin/plugin-context.ts +16 -7
  143. package/src/plugin/plugin-manager.ts +26 -4
  144. package/src/plugin/plugin-storage.ts +6 -0
  145. package/src/plugin/quick-open.ts +5 -29
  146. package/src/plugin/tasks/tasks.ts +3 -2
  147. package/src/plugin/tree/tree-views.ts +17 -1
  148. package/src/plugin/type-converters.ts +9 -6
  149. package/src/plugin/types-impl.ts +30 -1
@@ -19,7 +19,7 @@ import { CommunicationProvider } from '@theia/debug/lib/common/debug-model';
19
19
  import * as theia from '@theia/plugin';
20
20
  import { URI } from '@theia/core/shared/vscode-uri';
21
21
  import { Breakpoint } from '../../../common/plugin-api-rpc-model';
22
- import { DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
22
+ import { DebugConfigurationProviderTriggerKind, DebugExt, DebugMain, PLUGIN_RPC_CONTEXT as Ext, TerminalOptionsExt } from '../../../common/plugin-api-rpc';
23
23
  import { PluginPackageDebuggersContribution } from '../../../common/plugin-protocol';
24
24
  import { RPCProtocol } from '../../../common/rpc-protocol';
25
25
  import { PluginWebSocketChannel } from '../../../common/connection';
@@ -43,8 +43,11 @@ export class DebugExtImpl implements DebugExt {
43
43
  // debug sessions by sessionId
44
44
  private sessions = new Map<string, PluginDebugAdapterSession>();
45
45
 
46
- // providers by type
46
+ // providers by type (initial)
47
47
  private configurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
48
+ // providers by type (dynamic)
49
+ private dynamicConfigurationProviders = new Map<string, Set<theia.DebugConfigurationProvider>>();
50
+
48
51
  /**
49
52
  * Only use internally, don't send it to the frontend. It's expensive!
50
53
  * It's already there as a part of the plugin metadata.
@@ -182,19 +185,22 @@ export class DebugExtImpl implements DebugExt {
182
185
  });
183
186
  }
184
187
 
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);
188
+ registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider, trigger: theia.DebugConfigurationProviderTriggerKind): Disposable {
189
+ console.log(`Debug configuration provider has been registered: ${debugType}, trigger: ${trigger}`);
190
+ const providersByTriggerKind = trigger === DebugConfigurationProviderTriggerKind.Initial ? this.configurationProviders : this.dynamicConfigurationProviders;
191
+ let providers = providersByTriggerKind.get(debugType);
192
+ if (!providers) {
193
+ providersByTriggerKind.set(debugType, providers = new Set());
194
+ }
189
195
  providers.add(provider);
190
196
 
191
197
  return Disposable.create(() => {
192
198
  // eslint-disable-next-line @typescript-eslint/no-shadow
193
- const providers = this.configurationProviders.get(debugType);
199
+ const providers = providersByTriggerKind.get(debugType);
194
200
  if (providers) {
195
201
  providers.delete(provider);
196
202
  if (providers.size === 0) {
197
- this.configurationProviders.delete(debugType);
203
+ providersByTriggerKind.delete(debugType);
198
204
  }
199
205
  }
200
206
  });
@@ -319,10 +325,10 @@ export class DebugExtImpl implements DebugExt {
319
325
  return undefined;
320
326
  }
321
327
 
322
- async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration[]> {
328
+ async $provideDebugConfigurations(debugType: string, workspaceFolderUri: string | undefined, dynamic: boolean = false): Promise<theia.DebugConfiguration[]> {
323
329
  let result: theia.DebugConfiguration[] = [];
324
330
 
325
- const providers = this.configurationProviders.get(debugType);
331
+ const providers = dynamic ? this.dynamicConfigurationProviders.get(debugType) : this.configurationProviders.get(debugType);
326
332
  if (providers) {
327
333
  for (const provider of providers) {
328
334
  if (provider.provideDebugConfigurations) {
@@ -337,7 +343,11 @@ export class DebugExtImpl implements DebugExt {
337
343
  async $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolderUri: string | undefined): Promise<theia.DebugConfiguration | undefined> {
338
344
  let current = debugConfiguration;
339
345
 
340
- for (const providers of [this.configurationProviders.get(debugConfiguration.type), this.configurationProviders.get('*')]) {
346
+ for (const providers of [
347
+ this.configurationProviders.get(debugConfiguration.type),
348
+ this.dynamicConfigurationProviders.get(debugConfiguration.type),
349
+ this.configurationProviders.get('*')
350
+ ]) {
341
351
  if (providers) {
342
352
  for (const provider of providers) {
343
353
  if (provider.resolveDebugConfiguration) {
@@ -363,7 +373,11 @@ export class DebugExtImpl implements DebugExt {
363
373
  Promise<theia.DebugConfiguration | undefined> {
364
374
  let current = debugConfiguration;
365
375
 
366
- for (const providers of [this.configurationProviders.get(debugConfiguration.type), this.configurationProviders.get('*')]) {
376
+ for (const providers of [
377
+ this.configurationProviders.get(debugConfiguration.type),
378
+ this.dynamicConfigurationProviders.get(debugConfiguration.type),
379
+ this.configurationProviders.get('*')
380
+ ]) {
367
381
  if (providers) {
368
382
  for (const provider of providers) {
369
383
  if (provider.resolveDebugConfigurationWithSubstitutedVariables) {
@@ -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';
@@ -134,7 +135,8 @@ import {
134
135
  ColorThemeKind,
135
136
  SourceControlInputBoxValidationType,
136
137
  URI,
137
- FileDecoration
138
+ FileDecoration,
139
+ ExtensionMode
138
140
  } from './types-impl';
139
141
  import { AuthenticationExtImpl } from './authentication-ext';
140
142
  import { SymbolKind } from '../common/plugin-api-rpc-model';
@@ -149,7 +151,7 @@ import { LanguagesExtImpl } from './languages';
149
151
  import { fromDocumentSelector, pluginToPluginInfo, fromGlobPattern } from './type-converters';
150
152
  import { DialogsExtImpl } from './dialogs';
151
153
  import { NotificationExtImpl } from './notification';
152
- import { CancellationToken } from '@theia/core/lib/common/cancellation';
154
+ import { CancellationToken, CancellationError } from '@theia/core/lib/common/cancellation';
153
155
  import { score } from '@theia/callhierarchy/lib/common/language-selector';
154
156
  import { MarkdownString } from './markdown-string';
155
157
  import { TreeViewsExtImpl } from './tree/tree-views';
@@ -767,8 +769,12 @@ export function createAPIFactory(
767
769
  registerDebugAdapterDescriptorFactory(debugType: string, factory: theia.DebugAdapterDescriptorFactory): Disposable {
768
770
  return debugExt.registerDebugAdapterDescriptorFactory(debugType, factory);
769
771
  },
770
- registerDebugConfigurationProvider(debugType: string, provider: theia.DebugConfigurationProvider): Disposable {
771
- return debugExt.registerDebugConfigurationProvider(debugType, provider);
772
+ registerDebugConfigurationProvider(
773
+ debugType: string,
774
+ provider: theia.DebugConfigurationProvider,
775
+ triggerKind?: theia.DebugConfigurationProviderTriggerKind
776
+ ): Disposable {
777
+ return debugExt.registerDebugConfigurationProvider(debugType, provider, triggerKind || DebugConfigurationProviderTriggerKind.Initial);
772
778
  },
773
779
  registerDebugAdapterTrackerFactory(debugType: string, factory: theia.DebugAdapterTrackerFactory): Disposable {
774
780
  return debugExt.registerDebugAdapterTrackerFactory(debugType, factory);
@@ -924,6 +930,7 @@ export function createAPIFactory(
924
930
  Task2,
925
931
  DebugAdapterExecutable,
926
932
  DebugAdapterServer,
933
+ DebugConfigurationProviderTriggerKind,
927
934
  Breakpoint,
928
935
  SourceBreakpoint,
929
936
  FunctionBreakpoint,
@@ -952,7 +959,9 @@ export function createAPIFactory(
952
959
  SemanticTokensEdit,
953
960
  ColorThemeKind,
954
961
  SourceControlInputBoxValidationType,
955
- FileDecoration
962
+ FileDecoration,
963
+ CancellationError,
964
+ ExtensionMode
956
965
  };
957
966
  };
958
967
  }
@@ -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
  }
@@ -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));
@@ -616,6 +613,7 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
616
613
  this._handlesToItems.set(i, item);
617
614
  this._itemsToHandles.set(item, i);
618
615
  });
616
+ items.forEach((item, i) => Object.assign(item, { handle: i }));
619
617
  this.update({
620
618
  items
621
619
  });
@@ -690,26 +688,4 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
690
688
  this._selectedItems = items;
691
689
  this._onDidChangeSelectionEmitter.fire(items);
692
690
  }
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
691
  }
@@ -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
 
@@ -189,6 +189,26 @@ export enum ColorThemeKind {
189
189
  HighContrast = 3
190
190
  }
191
191
 
192
+ export enum ExtensionMode {
193
+ /**
194
+ * The extension is installed normally (for example, from the marketplace
195
+ * or VSIX) in the editor.
196
+ */
197
+ Production = 1,
198
+
199
+ /**
200
+ * The extension is running from an `--extensionDevelopmentPath` provided
201
+ * when launching the editor.
202
+ */
203
+ Development = 2,
204
+
205
+ /**
206
+ * The extension is running from an `--extensionTestsPath` and
207
+ * the extension host is running unit tests.
208
+ */
209
+ Test = 3,
210
+ }
211
+
192
212
  /**
193
213
  * Represents the validation type of the Source Control input.
194
214
  */
@@ -702,6 +722,12 @@ export class ThemeIcon {
702
722
 
703
723
  }
704
724
 
725
+ export namespace ThemeIcon {
726
+ export function is(item: unknown): item is ThemeIcon {
727
+ return typeof item === 'object' && !!item && 'id' in item;
728
+ }
729
+ }
730
+
705
731
  export enum TextEditorRevealType {
706
732
  Default = 0,
707
733
  InCenter = 1,
@@ -886,7 +912,9 @@ export enum CompletionItemKind {
886
912
  Struct = 21,
887
913
  Event = 22,
888
914
  Operator = 23,
889
- TypeParameter = 24
915
+ TypeParameter = 24,
916
+ User = 25,
917
+ Issue = 26
890
918
  }
891
919
 
892
920
  @es5ClassCompat
@@ -2338,6 +2366,7 @@ export class CallHierarchyItem {
2338
2366
  uri: URI;
2339
2367
  range: Range;
2340
2368
  selectionRange: Range;
2369
+ tags?: readonly SymbolTag[];
2341
2370
 
2342
2371
  constructor(kind: SymbolKind, name: string, detail: string, uri: URI, range: Range, selectionRange: Range) {
2343
2372
  this.kind = kind;