@theia/plugin-ext 1.51.0 → 1.52.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (269) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +13 -2
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.d.ts +25 -17
  4. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  5. package/lib/common/plugin-api-rpc.js.map +1 -1
  6. package/lib/hosted/browser/worker/worker-main.js +2 -2
  7. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  8. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  9. package/lib/hosted/node/scanners/scanner-theia.js +1 -0
  10. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  11. package/lib/main/browser/authentication-main.d.ts +4 -2
  12. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  13. package/lib/main/browser/command-registry-main.d.ts +4 -2
  14. package/lib/main/browser/command-registry-main.d.ts.map +1 -1
  15. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +4 -2
  16. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  17. package/lib/main/browser/debug/debug-main.d.ts +3 -0
  18. package/lib/main/browser/debug/debug-main.d.ts.map +1 -1
  19. package/lib/main/browser/debug/debug-main.js +20 -2
  20. package/lib/main/browser/debug/debug-main.js.map +1 -1
  21. package/lib/main/browser/debug/plugin-debug-service.d.ts +4 -2
  22. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  23. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +7 -4
  24. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  25. package/lib/main/browser/debug/plugin-debug-session-factory.js +6 -5
  26. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  27. package/lib/main/browser/languages-main.d.ts +4 -2
  28. package/lib/main/browser/languages-main.d.ts.map +1 -1
  29. package/lib/main/browser/notebooks/notebooks-main.d.ts +4 -2
  30. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
  31. package/lib/main/browser/quick-open-main.d.ts +7 -3
  32. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  33. package/lib/main/browser/quick-open-main.js +21 -38
  34. package/lib/main/browser/quick-open-main.js.map +1 -1
  35. package/lib/main/browser/terminal-main.d.ts +9 -4
  36. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  37. package/lib/main/browser/terminal-main.js +21 -2
  38. package/lib/main/browser/terminal-main.js.map +1 -1
  39. package/lib/main/browser/view/tree-view-decorator-service.d.ts +4 -2
  40. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  41. package/lib/main/browser/view/tree-view-widget.d.ts +4 -2
  42. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  43. package/lib/main/browser/view/tree-views-main.d.ts +4 -2
  44. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  45. package/lib/main/browser/webview/webview.d.ts +4 -2
  46. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  47. package/lib/main/browser/webview-views/webview-views-main.d.ts +4 -2
  48. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
  49. package/lib/main/browser/webviews-main.d.ts +4 -2
  50. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  51. package/lib/main/browser/workspace-main.d.ts +4 -2
  52. package/lib/main/browser/workspace-main.d.ts.map +1 -1
  53. package/lib/plugin/authentication-ext.d.ts +4 -2
  54. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  55. package/lib/plugin/clipboard-ext.d.ts +4 -2
  56. package/lib/plugin/clipboard-ext.d.ts.map +1 -1
  57. package/lib/plugin/command-registry.d.ts +4 -2
  58. package/lib/plugin/command-registry.d.ts.map +1 -1
  59. package/lib/plugin/comments.d.ts +4 -2
  60. package/lib/plugin/comments.d.ts.map +1 -1
  61. package/lib/plugin/custom-editors.d.ts +4 -2
  62. package/lib/plugin/custom-editors.d.ts.map +1 -1
  63. package/lib/plugin/debug/debug-ext.d.ts +12 -3
  64. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  65. package/lib/plugin/debug/debug-ext.js +46 -3
  66. package/lib/plugin/debug/debug-ext.js.map +1 -1
  67. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +4 -2
  68. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -1
  69. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +4 -2
  70. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  71. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts +4 -2
  72. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -1
  73. package/lib/plugin/decorations.d.ts +4 -2
  74. package/lib/plugin/decorations.d.ts.map +1 -1
  75. package/lib/plugin/dialogs.d.ts +4 -2
  76. package/lib/plugin/dialogs.d.ts.map +1 -1
  77. package/lib/plugin/document-data.d.ts +4 -2
  78. package/lib/plugin/document-data.d.ts.map +1 -1
  79. package/lib/plugin/documents.d.ts +4 -2
  80. package/lib/plugin/documents.d.ts.map +1 -1
  81. package/lib/plugin/env.d.ts +4 -2
  82. package/lib/plugin/env.d.ts.map +1 -1
  83. package/lib/plugin/file-system-event-service-ext-impl.d.ts +4 -2
  84. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  85. package/lib/plugin/file-system-ext-impl.d.ts +4 -2
  86. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  87. package/lib/plugin/label-service.d.ts +4 -2
  88. package/lib/plugin/label-service.d.ts.map +1 -1
  89. package/lib/plugin/languages/call-hierarchy.d.ts +4 -2
  90. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  91. package/lib/plugin/languages/code-action.d.ts +4 -2
  92. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  93. package/lib/plugin/languages/color.d.ts +4 -2
  94. package/lib/plugin/languages/color.d.ts.map +1 -1
  95. package/lib/plugin/languages/completion.d.ts +4 -2
  96. package/lib/plugin/languages/completion.d.ts.map +1 -1
  97. package/lib/plugin/languages/declaration.d.ts +4 -2
  98. package/lib/plugin/languages/declaration.d.ts.map +1 -1
  99. package/lib/plugin/languages/definition.d.ts +4 -2
  100. package/lib/plugin/languages/definition.d.ts.map +1 -1
  101. package/lib/plugin/languages/diagnostics.d.ts +4 -2
  102. package/lib/plugin/languages/diagnostics.d.ts.map +1 -1
  103. package/lib/plugin/languages/document-drop-edit.d.ts +4 -2
  104. package/lib/plugin/languages/document-drop-edit.d.ts.map +1 -1
  105. package/lib/plugin/languages/document-formatting.d.ts +4 -2
  106. package/lib/plugin/languages/document-formatting.d.ts.map +1 -1
  107. package/lib/plugin/languages/document-highlight.d.ts +4 -2
  108. package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
  109. package/lib/plugin/languages/evaluatable-expression.d.ts +4 -2
  110. package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -1
  111. package/lib/plugin/languages/folding.d.ts +4 -2
  112. package/lib/plugin/languages/folding.d.ts.map +1 -1
  113. package/lib/plugin/languages/hover.d.ts +4 -2
  114. package/lib/plugin/languages/hover.d.ts.map +1 -1
  115. package/lib/plugin/languages/implementation.d.ts +4 -2
  116. package/lib/plugin/languages/implementation.d.ts.map +1 -1
  117. package/lib/plugin/languages/inlay-hints.d.ts +4 -2
  118. package/lib/plugin/languages/inlay-hints.d.ts.map +1 -1
  119. package/lib/plugin/languages/inline-completion.d.ts +4 -2
  120. package/lib/plugin/languages/inline-completion.d.ts.map +1 -1
  121. package/lib/plugin/languages/inline-values.d.ts +4 -2
  122. package/lib/plugin/languages/inline-values.d.ts.map +1 -1
  123. package/lib/plugin/languages/lens.d.ts +4 -2
  124. package/lib/plugin/languages/lens.d.ts.map +1 -1
  125. package/lib/plugin/languages/link-provider.d.ts +4 -2
  126. package/lib/plugin/languages/link-provider.d.ts.map +1 -1
  127. package/lib/plugin/languages/linked-editing-range.d.ts +4 -2
  128. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -1
  129. package/lib/plugin/languages/on-type-formatting.d.ts +4 -2
  130. package/lib/plugin/languages/on-type-formatting.d.ts.map +1 -1
  131. package/lib/plugin/languages/outline.d.ts +4 -2
  132. package/lib/plugin/languages/outline.d.ts.map +1 -1
  133. package/lib/plugin/languages/range-formatting.d.ts +4 -2
  134. package/lib/plugin/languages/range-formatting.d.ts.map +1 -1
  135. package/lib/plugin/languages/reference.d.ts +4 -2
  136. package/lib/plugin/languages/reference.d.ts.map +1 -1
  137. package/lib/plugin/languages/rename.d.ts +4 -2
  138. package/lib/plugin/languages/rename.d.ts.map +1 -1
  139. package/lib/plugin/languages/selection-range.d.ts +4 -2
  140. package/lib/plugin/languages/selection-range.d.ts.map +1 -1
  141. package/lib/plugin/languages/semantic-highlighting.d.ts +4 -2
  142. package/lib/plugin/languages/semantic-highlighting.d.ts.map +1 -1
  143. package/lib/plugin/languages/signature.d.ts +4 -2
  144. package/lib/plugin/languages/signature.d.ts.map +1 -1
  145. package/lib/plugin/languages/type-definition.d.ts +4 -2
  146. package/lib/plugin/languages/type-definition.d.ts.map +1 -1
  147. package/lib/plugin/languages/type-hierarchy.d.ts +4 -2
  148. package/lib/plugin/languages/type-hierarchy.d.ts.map +1 -1
  149. package/lib/plugin/languages/util.d.ts +4 -2
  150. package/lib/plugin/languages/util.d.ts.map +1 -1
  151. package/lib/plugin/languages/workspace-symbol.d.ts +4 -2
  152. package/lib/plugin/languages/workspace-symbol.d.ts.map +1 -1
  153. package/lib/plugin/languages-utils.d.ts +4 -2
  154. package/lib/plugin/languages-utils.d.ts.map +1 -1
  155. package/lib/plugin/languages.d.ts +4 -2
  156. package/lib/plugin/languages.d.ts.map +1 -1
  157. package/lib/plugin/markdown-string.d.ts +4 -2
  158. package/lib/plugin/markdown-string.d.ts.map +1 -1
  159. package/lib/plugin/message-registry.d.ts +4 -2
  160. package/lib/plugin/message-registry.d.ts.map +1 -1
  161. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +4 -2
  162. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -1
  163. package/lib/plugin/notebook/notebook-document.d.ts +4 -2
  164. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -1
  165. package/lib/plugin/notebook/notebook-documents.d.ts +4 -2
  166. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -1
  167. package/lib/plugin/notebook/notebook-editor.d.ts +4 -2
  168. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -1
  169. package/lib/plugin/notebook/notebook-editors.d.ts +4 -2
  170. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -1
  171. package/lib/plugin/notebook/notebook-kernels.d.ts +4 -2
  172. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  173. package/lib/plugin/notebook/notebook-renderers.d.ts +4 -2
  174. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -1
  175. package/lib/plugin/notebook/notebooks.d.ts +4 -2
  176. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  177. package/lib/plugin/notification.d.ts +4 -2
  178. package/lib/plugin/notification.d.ts.map +1 -1
  179. package/lib/plugin/output-channel/log-output-channel.d.ts +4 -2
  180. package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -1
  181. package/lib/plugin/output-channel/output-channel-item.d.ts +4 -2
  182. package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
  183. package/lib/plugin/output-channel-registry.d.ts +4 -2
  184. package/lib/plugin/output-channel-registry.d.ts.map +1 -1
  185. package/lib/plugin/plugin-context.d.ts +4 -2
  186. package/lib/plugin/plugin-context.d.ts.map +1 -1
  187. package/lib/plugin/plugin-context.js +20 -9
  188. package/lib/plugin/plugin-context.js.map +1 -1
  189. package/lib/plugin/plugin-icon-path.d.ts +2 -1
  190. package/lib/plugin/plugin-icon-path.d.ts.map +1 -1
  191. package/lib/plugin/plugin-icon-path.js +5 -1
  192. package/lib/plugin/plugin-icon-path.js.map +1 -1
  193. package/lib/plugin/plugin-manager.d.ts +4 -2
  194. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  195. package/lib/plugin/plugin-storage.d.ts +4 -2
  196. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  197. package/lib/plugin/preference-registry.d.ts +4 -2
  198. package/lib/plugin/preference-registry.d.ts.map +1 -1
  199. package/lib/plugin/quick-open.d.ts +7 -19
  200. package/lib/plugin/quick-open.d.ts.map +1 -1
  201. package/lib/plugin/quick-open.js +22 -39
  202. package/lib/plugin/quick-open.js.map +1 -1
  203. package/lib/plugin/scm.d.ts +4 -2
  204. package/lib/plugin/scm.d.ts.map +1 -1
  205. package/lib/plugin/secrets-ext.d.ts +4 -2
  206. package/lib/plugin/secrets-ext.d.ts.map +1 -1
  207. package/lib/plugin/status-bar/status-bar-item.d.ts +4 -2
  208. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  209. package/lib/plugin/status-bar-message-registry.d.ts +4 -2
  210. package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
  211. package/lib/plugin/tabs.d.ts +4 -2
  212. package/lib/plugin/tabs.d.ts.map +1 -1
  213. package/lib/plugin/tasks/task-provider.d.ts +4 -2
  214. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  215. package/lib/plugin/tasks/tasks.d.ts +4 -2
  216. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  217. package/lib/plugin/terminal-ext.d.ts +13 -16
  218. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  219. package/lib/plugin/terminal-ext.js +14 -21
  220. package/lib/plugin/terminal-ext.js.map +1 -1
  221. package/lib/plugin/test-item.d.ts +4 -2
  222. package/lib/plugin/test-item.d.ts.map +1 -1
  223. package/lib/plugin/tests.d.ts +9 -6
  224. package/lib/plugin/tests.d.ts.map +1 -1
  225. package/lib/plugin/tests.js +22 -16
  226. package/lib/plugin/tests.js.map +1 -1
  227. package/lib/plugin/text-editor.d.ts +4 -2
  228. package/lib/plugin/text-editor.d.ts.map +1 -1
  229. package/lib/plugin/text-editors.d.ts +4 -2
  230. package/lib/plugin/text-editors.d.ts.map +1 -1
  231. package/lib/plugin/timeline.d.ts +4 -2
  232. package/lib/plugin/timeline.d.ts.map +1 -1
  233. package/lib/plugin/tree/tree-views.d.ts +4 -2
  234. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  235. package/lib/plugin/tree/tree-views.js.map +1 -1
  236. package/lib/plugin/type-converters.d.ts +7 -6
  237. package/lib/plugin/type-converters.d.ts.map +1 -1
  238. package/lib/plugin/type-converters.js +9 -7
  239. package/lib/plugin/type-converters.js.map +1 -1
  240. package/lib/plugin/types-impl.d.ts +31 -6
  241. package/lib/plugin/types-impl.d.ts.map +1 -1
  242. package/lib/plugin/types-impl.js +29 -1
  243. package/lib/plugin/types-impl.js.map +1 -1
  244. package/lib/plugin/webview-views.d.ts +4 -2
  245. package/lib/plugin/webview-views.d.ts.map +1 -1
  246. package/lib/plugin/webviews.d.ts +4 -2
  247. package/lib/plugin/webviews.d.ts.map +1 -1
  248. package/lib/plugin/window-state.d.ts +4 -2
  249. package/lib/plugin/window-state.d.ts.map +1 -1
  250. package/lib/plugin/workspace.d.ts +4 -2
  251. package/lib/plugin/workspace.d.ts.map +1 -1
  252. package/package.json +29 -29
  253. package/src/common/plugin-api-rpc-model.ts +10 -0
  254. package/src/common/plugin-api-rpc.ts +17 -11
  255. package/src/hosted/browser/worker/worker-main.ts +2 -2
  256. package/src/hosted/node/scanners/scanner-theia.ts +1 -0
  257. package/src/main/browser/debug/debug-main.ts +26 -2
  258. package/src/main/browser/debug/plugin-debug-session-factory.ts +13 -3
  259. package/src/main/browser/quick-open-main.ts +23 -45
  260. package/src/main/browser/terminal-main.ts +26 -6
  261. package/src/plugin/debug/debug-ext.ts +56 -6
  262. package/src/plugin/plugin-context.ts +26 -12
  263. package/src/plugin/plugin-icon-path.ts +5 -2
  264. package/src/plugin/quick-open.ts +9 -32
  265. package/src/plugin/terminal-ext.ts +27 -33
  266. package/src/plugin/tests.ts +27 -22
  267. package/src/plugin/tree/tree-views.ts +1 -1
  268. package/src/plugin/type-converters.ts +8 -8
  269. package/src/plugin/types-impl.ts +38 -6
@@ -18,14 +18,14 @@ import { Emitter } from '@theia/core/lib/common/event';
18
18
  import { Path } from '@theia/core/lib/common/path';
19
19
  import * as theia from '@theia/plugin';
20
20
  import { URI } from '@theia/core/shared/vscode-uri';
21
- import { Breakpoint } from '../../common/plugin-api-rpc-model';
21
+ import { Breakpoint, DebugStackFrameDTO, DebugThreadDTO } from '../../common/plugin-api-rpc-model';
22
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 { CommandRegistryImpl } from '../command-registry';
26
26
  import { ConnectionImpl } from '../../common/connection';
27
27
  import { DEBUG_SCHEME, SCHEME_PATTERN } from '@theia/debug/lib/common/debug-uri-utils';
28
- import { Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range, URI as URIImpl } from '../types-impl';
28
+ import { Disposable, Breakpoint as BreakpointExt, SourceBreakpoint, FunctionBreakpoint, Location, Range, URI as URIImpl, DebugStackFrame, DebugThread } from '../types-impl';
29
29
  import { PluginDebugAdapterSession } from './plugin-debug-adapter-session';
30
30
  import { PluginDebugAdapterTracker } from './plugin-debug-adapter-tracker';
31
31
  import { generateUuid } from '@theia/core/lib/common/uuid';
@@ -33,7 +33,8 @@ import { DebugAdapter } from '@theia/debug/lib/common/debug-model';
33
33
  import { PluginDebugAdapterCreator } from './plugin-debug-adapter-creator';
34
34
  import { NodeDebugAdapterCreator } from '../node/debug/plugin-node-debug-adapter-creator';
35
35
  import { DebugProtocol } from '@vscode/debugprotocol';
36
- import { DebugConfiguration } from '@theia/debug/lib/common/debug-configuration';
36
+ import { DebugConfiguration, DebugSessionOptions } from '@theia/debug/lib/common/debug-configuration';
37
+ import { checkTestRunInstance } from '../tests';
37
38
 
38
39
  interface ConfigurationProviderRecord {
39
40
  handle: number;
@@ -79,6 +80,9 @@ export class DebugExtImpl implements DebugExt {
79
80
  activeDebugSession: theia.DebugSession | undefined;
80
81
  activeDebugConsole: theia.DebugConsole;
81
82
 
83
+ _activeStackItem: theia.DebugStackFrame | theia.DebugThread | undefined;
84
+ private readonly onDidChangeActiveStackItemEmitter = new Emitter<theia.DebugStackFrame | theia.DebugThread | undefined>();
85
+
82
86
  private readonly _breakpoints = new Map<string, theia.Breakpoint>();
83
87
 
84
88
  private frontendAdapterCreator = new PluginDebugAdapterCreator();
@@ -149,6 +153,10 @@ export class DebugExtImpl implements DebugExt {
149
153
  return this.onDidStartDebugSessionEmitter.event;
150
154
  }
151
155
 
156
+ get onDidChangeActiveStackItem(): theia.Event<theia.DebugStackFrame | theia.DebugThread | undefined> {
157
+ return this.onDidChangeActiveStackItemEmitter.event;
158
+ }
159
+
152
160
  get onDidChangeBreakpoints(): theia.Event<theia.BreakpointsChangeEvent> {
153
161
  return this.onDidChangeBreakpointsEmitter.event;
154
162
  }
@@ -186,7 +194,7 @@ export class DebugExtImpl implements DebugExt {
186
194
  }
187
195
 
188
196
  startDebugging(folder: theia.WorkspaceFolder | undefined, nameOrConfiguration: string | theia.DebugConfiguration, options: theia.DebugSessionOptions): PromiseLike<boolean> {
189
- return this.proxy.$startDebugging(folder, nameOrConfiguration, {
197
+ const optionsDto: DebugSessionOptions = {
190
198
  parentSessionId: options.parentSession?.id,
191
199
  compact: options.compact,
192
200
  consoleMode: options.consoleMode,
@@ -194,8 +202,16 @@ export class DebugExtImpl implements DebugExt {
194
202
  suppressDebugStatusbar: options.suppressDebugStatusbar,
195
203
  suppressDebugView: options.suppressDebugView,
196
204
  lifecycleManagedByParent: options.lifecycleManagedByParent,
197
- noDebug: options.noDebug
198
- });
205
+ noDebug: options.noDebug,
206
+ };
207
+ if (options.testRun) {
208
+ const run = checkTestRunInstance(options.testRun);
209
+ optionsDto.testRun = {
210
+ controllerId: run.controller.id,
211
+ runId: run.id
212
+ };
213
+ }
214
+ return this.proxy.$startDebugging(folder, nameOrConfiguration, optionsDto);
199
215
  }
200
216
 
201
217
  stopDebugging(session?: theia.DebugSession): PromiseLike<void> {
@@ -262,6 +278,40 @@ export class DebugExtImpl implements DebugExt {
262
278
  });
263
279
  }
264
280
 
281
+ set activeStackItem(stackItem: theia.DebugStackFrame | theia.DebugThread | undefined) {
282
+ if (this._activeStackItem === stackItem) {
283
+ return;
284
+ }
285
+ this._activeStackItem = stackItem;
286
+ this.onDidChangeActiveStackItemEmitter.fire(this.activeStackItem);
287
+ }
288
+
289
+ get activeStackItem(): theia.DebugStackFrame | theia.DebugThread | undefined {
290
+ return this._activeStackItem;
291
+ }
292
+
293
+ async $onDidChangeActiveThread(debugThread: DebugThreadDTO | undefined): Promise<void> {
294
+ if (!debugThread) {
295
+ this.activeStackItem = undefined;
296
+ return;
297
+ }
298
+ const session = this.sessions.get(debugThread.sessionId);
299
+ if (session) {
300
+ this.activeStackItem = new DebugThread(session, debugThread.threadId);
301
+ }
302
+ }
303
+
304
+ async $onDidChangeActiveFrame(debugFrame: DebugStackFrameDTO | undefined): Promise<void> {
305
+ if (!debugFrame) {
306
+ this.activeStackItem = undefined;
307
+ return;
308
+ }
309
+ const session = this.sessions.get(debugFrame!.sessionId);
310
+ if (session) {
311
+ this.activeStackItem = new DebugStackFrame(session, debugFrame.threadId, debugFrame.frameId);
312
+ }
313
+ }
314
+
265
315
  async $onSessionCustomEvent(sessionId: string, event: string, body?: any): Promise<void> {
266
316
  const session = this.sessions.get(sessionId);
267
317
  if (session) {
@@ -225,7 +225,10 @@ import {
225
225
  ChatResultFeedbackKind,
226
226
  LanguageModelChatMessage,
227
227
  LanguageModelChatMessageRole,
228
- LanguageModelError
228
+ LanguageModelError,
229
+ PortAutoForwardAction,
230
+ PortAttributes,
231
+ DebugVisualization
229
232
  } from './types-impl';
230
233
  import { AuthenticationExtImpl } from './authentication-ext';
231
234
  import { SymbolKind } from '../common/plugin-api-rpc-model';
@@ -483,7 +486,7 @@ export function createAPIFactory(
483
486
  },
484
487
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
485
488
  showQuickPick(items: any, options?: theia.QuickPickOptions, token?: theia.CancellationToken): any {
486
- return quickOpenExt.showQuickPick(items, options, token);
489
+ return quickOpenExt.showQuickPick(plugin, items, options, token);
487
490
  },
488
491
  createQuickPick<T extends theia.QuickPickItem>(): theia.QuickPick<T> {
489
492
  return quickOpenExt.createQuickPick(plugin);
@@ -564,7 +567,7 @@ export function createAPIFactory(
564
567
  createTerminal(nameOrOptions: theia.TerminalOptions | theia.ExtensionTerminalOptions | theia.ExtensionTerminalOptions | (string | undefined),
565
568
  shellPath?: string,
566
569
  shellArgs?: string[] | string): theia.Terminal {
567
- return terminalExt.createTerminal(nameOrOptions, shellPath, shellArgs);
570
+ return terminalExt.createTerminal(plugin, nameOrOptions, shellPath, shellArgs);
568
571
  },
569
572
  onDidChangeTerminalState,
570
573
  onDidCloseTerminal,
@@ -814,7 +817,13 @@ export function createAPIFactory(
814
817
  },
815
818
  getCanonicalUri(uri: theia.Uri, options: theia.CanonicalUriRequestOptions, token: CancellationToken): theia.ProviderResult<theia.Uri> {
816
819
  return workspaceExt.getCanonicalUri(uri, options, token);
817
- }
820
+ },
821
+ /**
822
+ * @stubbed
823
+ * This is a stub implementation, that should minimally satisfy vscode extensions
824
+ * that currently use this proposed API.
825
+ */
826
+ registerPortAttributesProvider: () => Disposable.NULL
818
827
  };
819
828
 
820
829
  const onDidChangeLogLevel = new Emitter<theia.LogLevel>();
@@ -1092,13 +1101,11 @@ export function createAPIFactory(
1092
1101
  get onDidChangeBreakpoints(): theia.Event<theia.BreakpointsChangeEvent> {
1093
1102
  return debugExt.onDidChangeBreakpoints;
1094
1103
  },
1095
- /** @stubbed */
1096
1104
  get activeStackItem(): DebugThread | DebugStackFrame | undefined {
1097
- return undefined;
1105
+ return debugExt.activeStackItem;
1098
1106
  },
1099
- /** @stubbed */
1100
1107
  get onDidChangeActiveStackItem(): theia.Event<DebugThread | DebugStackFrame | undefined> {
1101
- return Event.None;
1108
+ return debugExt.onDidChangeActiveStackItem;
1102
1109
  },
1103
1110
  registerDebugAdapterDescriptorFactory(debugType: string, factory: theia.DebugAdapterDescriptorFactory): Disposable {
1104
1111
  return debugExt.registerDebugAdapterDescriptorFactory(debugType, factory);
@@ -1134,7 +1141,11 @@ export function createAPIFactory(
1134
1141
  },
1135
1142
  asDebugSourceUri(source: theia.DebugProtocolSource, session?: theia.DebugSession): theia.Uri {
1136
1143
  return debugExt.asDebugSourceUri(source, session);
1137
- }
1144
+ },
1145
+ /** @stubbed Due to proposed API */
1146
+ registerDebugVisualizationProvider: () => Disposable.NULL,
1147
+ /** @stubbed Due to proposed API */
1148
+ registerDebugVisualizationTreeProvider: () => Disposable.NULL
1138
1149
  };
1139
1150
 
1140
1151
  const tasks: typeof theia.tasks = {
@@ -1241,7 +1252,7 @@ export function createAPIFactory(
1241
1252
  }
1242
1253
  };
1243
1254
 
1244
- const chat: typeof theia.chat = {
1255
+ const chat: typeof theia.chat = {
1245
1256
  /** @stubbed MappedEditsProvider */
1246
1257
  registerMappedEditsProvider(documentSelector: theia.DocumentSelector, provider: theia.MappedEditsProvider): Disposable {
1247
1258
  return Disposable.NULL;
@@ -1251,7 +1262,7 @@ export function createAPIFactory(
1251
1262
  return {
1252
1263
  id,
1253
1264
  requestHandler: handler,
1254
- dispose() {},
1265
+ dispose() { },
1255
1266
  onDidReceiveFeedback: (listener, thisArgs?, disposables?) => Event.None(listener, thisArgs, disposables)
1256
1267
  };
1257
1268
  }
@@ -1481,7 +1492,10 @@ export function createAPIFactory(
1481
1492
  ChatResultFeedbackKind,
1482
1493
  LanguageModelChatMessage,
1483
1494
  LanguageModelChatMessageRole,
1484
- LanguageModelError
1495
+ LanguageModelError,
1496
+ PortAutoForwardAction,
1497
+ PortAttributes,
1498
+ DebugVisualization
1485
1499
  };
1486
1500
  };
1487
1501
  }
@@ -24,8 +24,8 @@ export type PluginIconPath = string | URI | {
24
24
  dark: string | URI
25
25
  };
26
26
  export namespace PluginIconPath {
27
- export function toUrl(iconPath: PluginIconPath | undefined, plugin: Plugin): IconUrl | undefined {
28
- if (!iconPath) {
27
+ export function toUrl(iconPath: unknown, plugin: Plugin): IconUrl | undefined {
28
+ if (!is(iconPath)) {
29
29
  return undefined;
30
30
  }
31
31
  if (typeof iconPath === 'object' && 'light' in iconPath) {
@@ -36,6 +36,9 @@ export namespace PluginIconPath {
36
36
  }
37
37
  return asString(iconPath, plugin);
38
38
  }
39
+ export function is(item: unknown): item is PluginIconPath {
40
+ return typeof item === 'string' || item instanceof URI || typeof item === 'object' && !!item && 'light' in item && 'dark' in item;
41
+ }
39
42
  export function asString(arg: string | URI, plugin: Plugin): string {
40
43
  arg = arg instanceof URI && arg.scheme === 'file' ? arg.fsPath : arg;
41
44
  if (typeof arg !== 'string') {
@@ -30,8 +30,8 @@ import { convertToTransferQuickPickItems } from './type-converters';
30
30
  import { PluginPackage } from '../common/plugin-protocol';
31
31
  import { QuickInputButtonHandle } from '@theia/core/lib/browser';
32
32
  import { MaybePromise } from '@theia/core/lib/common/types';
33
- import { ThemeIcon as MonacoThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
34
33
  import { Severity } from '@theia/core/lib/common/severity';
34
+ import { PluginIconPath } from './plugin-icon-path';
35
35
 
36
36
  const canceledName = 'Canceled';
37
37
  /**
@@ -42,27 +42,6 @@ export function isPromiseCanceledError(error: any): boolean {
42
42
  return error instanceof Error && error.name === canceledName && error.message === canceledName;
43
43
  }
44
44
 
45
- export function getIconUris(iconPath: theia.QuickInputButton['iconPath']): { dark: URI, light: URI } | { id: string } {
46
- if (ThemeIcon.is(iconPath)) {
47
- return { id: iconPath.id };
48
- }
49
- const dark = getDarkIconUri(iconPath as URI | { light: URI; dark: URI; });
50
- const light = getLightIconUri(iconPath as URI | { light: URI; dark: URI; });
51
- // Tolerate strings: https://github.com/microsoft/vscode/issues/110432#issuecomment-726144556
52
- return {
53
- dark: typeof dark === 'string' ? URI.file(dark) : dark,
54
- light: typeof light === 'string' ? URI.file(light) : light
55
- };
56
- }
57
-
58
- export function getLightIconUri(iconPath: URI | { light: URI; dark: URI; }): URI {
59
- return typeof iconPath === 'object' && 'light' in iconPath ? iconPath.light : iconPath;
60
- }
61
-
62
- export function getDarkIconUri(iconPath: URI | { light: URI; dark: URI; }): URI {
63
- return typeof iconPath === 'object' && 'dark' in iconPath ? iconPath.dark : iconPath;
64
- }
65
-
66
45
  type Item = theia.QuickPickItem | string;
67
46
 
68
47
  export class QuickOpenExtImpl implements QuickOpenExt {
@@ -77,10 +56,10 @@ export class QuickOpenExtImpl implements QuickOpenExt {
77
56
  }
78
57
 
79
58
  /* eslint-disable max-len */
80
- showQuickPick(itemsOrItemsPromise: theia.QuickPickItem[] | Promise<theia.QuickPickItem[]>, options: theia.QuickPickOptions & { canPickMany: true; }, token?: theia.CancellationToken): Promise<Array<theia.QuickPickItem> | undefined>;
81
- showQuickPick(itemsOrItemsPromise: string[] | Promise<string[]>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<string | undefined>;
82
- showQuickPick(itemsOrItemsPromise: theia.QuickPickItem[] | Promise<theia.QuickPickItem[]>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<theia.QuickPickItem | undefined>;
83
- showQuickPick(itemsOrItemsPromise: Item[] | Promise<Item[]>, options?: theia.QuickPickOptions, token: theia.CancellationToken = CancellationToken.None): Promise<Item | Item[] | undefined> {
59
+ showQuickPick(plugin: Plugin, itemsOrItemsPromise: theia.QuickPickItem[] | Promise<theia.QuickPickItem[]>, options: theia.QuickPickOptions & { canPickMany: true; }, token?: theia.CancellationToken): Promise<Array<theia.QuickPickItem> | undefined>;
60
+ showQuickPick(plugin: Plugin, itemsOrItemsPromise: string[] | Promise<string[]>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<string | undefined>;
61
+ showQuickPick(plugin: Plugin, itemsOrItemsPromise: theia.QuickPickItem[] | Promise<theia.QuickPickItem[]>, options?: theia.QuickPickOptions, token?: theia.CancellationToken): Promise<theia.QuickPickItem | undefined>;
62
+ showQuickPick(plugin: Plugin, itemsOrItemsPromise: Item[] | Promise<Item[]>, options?: theia.QuickPickOptions, token: theia.CancellationToken = CancellationToken.None): Promise<Item | Item[] | undefined> {
84
63
  this.onDidSelectItem = undefined;
85
64
 
86
65
  const itemsPromise = Promise.resolve(itemsOrItemsPromise);
@@ -104,7 +83,7 @@ export class QuickOpenExtImpl implements QuickOpenExt {
104
83
  return undefined;
105
84
  }
106
85
  return itemsPromise.then(async items => {
107
- const pickItems = convertToTransferQuickPickItems(items);
86
+ const pickItems = convertToTransferQuickPickItems(plugin, items);
108
87
 
109
88
  if (options && typeof options.onDidSelectItem === 'function') {
110
89
  this.onDidSelectItem = handle => {
@@ -398,8 +377,7 @@ export class QuickInputExt implements theia.QuickInput {
398
377
  });
399
378
  this.update({
400
379
  buttons: buttons.map<TransferQuickInputButton>((button, i) => ({
401
- iconPath: getIconUris(button.iconPath),
402
- iconClass: ThemeIcon.is(button.iconPath) ? MonacoThemeIcon.asClassName(button.iconPath) : undefined,
380
+ iconUrl: PluginIconPath.toUrl(button.iconPath, this.plugin) ?? ThemeIcon.get(button.iconPath),
403
381
  tooltip: button.tooltip,
404
382
  handle: button === QuickInputButtons.Back ? -1 : i,
405
383
  }))
@@ -640,15 +618,14 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
640
618
  pickItems.push({
641
619
  kind: 'item',
642
620
  label: item.label,
643
- iconPath: item.iconPath ? getIconUris(item.iconPath) : undefined,
621
+ iconUrl: PluginIconPath.toUrl(item.iconPath, this.plugin) ?? ThemeIcon.get(item.iconPath),
644
622
  description: item.description,
645
623
  handle,
646
624
  detail: item.detail,
647
625
  picked: item.picked,
648
626
  alwaysShow: item.alwaysShow,
649
627
  buttons: item.buttons?.map<TransferQuickInputButton>((button, index) => ({
650
- iconPath: getIconUris(button.iconPath),
651
- iconClass: ThemeIcon.is(button.iconPath) ? MonacoThemeIcon.asClassName(button.iconPath) : undefined,
628
+ iconUrl: PluginIconPath.toUrl(button.iconPath, this.plugin) ?? ThemeIcon.get(button.iconPath),
652
629
  tooltip: button.tooltip,
653
630
  handle: button === QuickInputButtons.Back ? -1 : index,
654
631
  }))
@@ -13,10 +13,10 @@
13
13
  //
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
+
16
17
  import { UUID } from '@theia/core/shared/@phosphor/coreutils';
17
18
  import { inject, injectable } from '@theia/core/shared/inversify';
18
- import { Terminal, TerminalOptions, PseudoTerminalOptions, ExtensionTerminalOptions, TerminalState } from '@theia/plugin';
19
- import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
19
+ import { TerminalServiceExt, TerminalServiceMain, PLUGIN_RPC_CONTEXT, Plugin, TerminalOptions } from '../common/plugin-api-rpc';
20
20
  import { RPCProtocol } from '../common/rpc-protocol';
21
21
  import { Event, Emitter } from '@theia/core/lib/common/event';
22
22
  import { MultiKeyMap } from '@theia/core/lib/common/collections';
@@ -26,28 +26,13 @@ import * as Converter from './type-converters';
26
26
  import { Disposable, EnvironmentVariableMutatorType, TerminalExitReason, ThemeIcon } from './types-impl';
27
27
  import { NO_ROOT_URI, SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/shell-terminal-protocol';
28
28
  import { ProvidedTerminalLink } from '../common/plugin-api-rpc-model';
29
- import { ThemeIcon as MonacoThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
30
-
31
- export function getIconUris(iconPath: theia.TerminalOptions['iconPath']): { id: string } | undefined {
32
- if (ThemeIcon.is(iconPath)) {
33
- return { id: iconPath.id };
34
- }
35
- return undefined;
36
- }
37
-
38
- export function getIconClass(options: theia.TerminalOptions | theia.ExtensionTerminalOptions): string | undefined {
39
- const iconClass = getIconUris(options.iconPath);
40
- if (iconClass) {
41
- return MonacoThemeIcon.asClassName(iconClass);
42
- }
43
- return undefined;
44
- }
29
+ import { PluginIconPath } from './plugin-icon-path';
45
30
 
46
31
  /**
47
32
  * Provides high level terminal plugin api to use in the Theia plugins.
48
33
  * This service allow(with help proxy) create and use terminal emulator.
49
34
  */
50
- @injectable()
35
+ @injectable()
51
36
  export class TerminalServiceExtImpl implements TerminalServiceExt {
52
37
  private readonly proxy: TerminalServiceMain;
53
38
 
@@ -59,17 +44,17 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
59
44
  private readonly terminalLinkProviders = new Map<string, theia.TerminalLinkProvider>();
60
45
  private readonly terminalObservers = new Map<string, theia.TerminalObserver>();
61
46
  private readonly terminalProfileProviders = new Map<string, theia.TerminalProfileProvider>();
62
- private readonly onDidCloseTerminalEmitter = new Emitter<Terminal>();
63
- readonly onDidCloseTerminal: theia.Event<Terminal> = this.onDidCloseTerminalEmitter.event;
47
+ private readonly onDidCloseTerminalEmitter = new Emitter<theia.Terminal>();
48
+ readonly onDidCloseTerminal: theia.Event<theia.Terminal> = this.onDidCloseTerminalEmitter.event;
64
49
 
65
- private readonly onDidOpenTerminalEmitter = new Emitter<Terminal>();
66
- readonly onDidOpenTerminal: theia.Event<Terminal> = this.onDidOpenTerminalEmitter.event;
50
+ private readonly onDidOpenTerminalEmitter = new Emitter<theia.Terminal>();
51
+ readonly onDidOpenTerminal: theia.Event<theia.Terminal> = this.onDidOpenTerminalEmitter.event;
67
52
 
68
- private readonly onDidChangeActiveTerminalEmitter = new Emitter<Terminal | undefined>();
69
- readonly onDidChangeActiveTerminal: theia.Event<Terminal | undefined> = this.onDidChangeActiveTerminalEmitter.event;
53
+ private readonly onDidChangeActiveTerminalEmitter = new Emitter<theia.Terminal | undefined>();
54
+ readonly onDidChangeActiveTerminal: theia.Event<theia.Terminal | undefined> = this.onDidChangeActiveTerminalEmitter.event;
70
55
 
71
- private readonly onDidChangeTerminalStateEmitter = new Emitter<Terminal>();
72
- readonly onDidChangeTerminalState: theia.Event<Terminal> = this.onDidChangeTerminalStateEmitter.event;
56
+ private readonly onDidChangeTerminalStateEmitter = new Emitter<theia.Terminal>();
57
+ readonly onDidChangeTerminalState: theia.Event<theia.Terminal> = this.onDidChangeTerminalStateEmitter.event;
73
58
 
74
59
  protected environmentVariableCollections: MultiKeyMap<string, EnvironmentVariableCollectionImpl> = new MultiKeyMap(2);
75
60
 
@@ -97,9 +82,10 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
97
82
  }
98
83
 
99
84
  createTerminal(
100
- nameOrOptions: TerminalOptions | PseudoTerminalOptions | ExtensionTerminalOptions | (string | undefined),
85
+ plugin: Plugin,
86
+ nameOrOptions: theia.TerminalOptions | theia.PseudoTerminalOptions | theia.ExtensionTerminalOptions | string | undefined,
101
87
  shellPath?: string, shellArgs?: string[] | string
102
- ): Terminal {
88
+ ): theia.Terminal {
103
89
  const id = `plugin-terminal-${UUID.uuid4()}`;
104
90
  let options: TerminalOptions;
105
91
  let pseudoTerminal: theia.Pseudoterminal | undefined = undefined;
@@ -122,7 +108,6 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
122
108
  }
123
109
 
124
110
  let parentId;
125
-
126
111
  if (options.location && typeof options.location === 'object' && 'parentTerminal' in options.location) {
127
112
  const parentTerminal = options.location.parentTerminal;
128
113
  if (parentTerminal instanceof TerminalExtImpl) {
@@ -135,6 +120,15 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
135
120
  }
136
121
  }
137
122
 
123
+ if (typeof nameOrOptions === 'object' && 'iconPath' in nameOrOptions) {
124
+ const iconPath = nameOrOptions.iconPath;
125
+ options.iconUrl = PluginIconPath.toUrl(iconPath, plugin) ?? ThemeIcon.get(iconPath);
126
+ }
127
+
128
+ if (typeof nameOrOptions === 'object' && 'color' in nameOrOptions) {
129
+ options.color = nameOrOptions.color;
130
+ }
131
+
138
132
  this.proxy.$createTerminal(id, options, parentId, !!pseudoTerminal);
139
133
 
140
134
  let creationOptions: theia.TerminalOptions | theia.ExtensionTerminalOptions = options;
@@ -462,7 +456,7 @@ export class EnvironmentVariableCollectionImpl implements theia.GlobalEnvironmen
462
456
  }
463
457
  }
464
458
 
465
- export class TerminalExtImpl implements Terminal {
459
+ export class TerminalExtImpl implements theia.Terminal {
466
460
 
467
461
  name: string;
468
462
 
@@ -476,9 +470,9 @@ export class TerminalExtImpl implements Terminal {
476
470
  return this.deferredProcessId.promise;
477
471
  }
478
472
 
479
- readonly creationOptions: Readonly<TerminalOptions | ExtensionTerminalOptions>;
473
+ readonly creationOptions: Readonly<theia.TerminalOptions | theia.ExtensionTerminalOptions>;
480
474
 
481
- state: TerminalState = { isInteractedWith: false };
475
+ state: theia.TerminalState = { isInteractedWith: false };
482
476
 
483
477
  constructor(private readonly proxy: TerminalServiceMain, private readonly options: theia.TerminalOptions | theia.ExtensionTerminalOptions) {
484
478
  this.creationOptions = this.options;
@@ -135,21 +135,7 @@ export class TestControllerImpl implements theia.TestController {
135
135
  }
136
136
 
137
137
  createTestRun(request: theia.TestRunRequest, name?: string, persist: boolean = true): theia.TestRun {
138
- return this.testRunStarted(request, name || '', persist, true);
139
- }
140
-
141
- dispose() {
142
- this.proxy.$unregisterTestController(this.id);
143
- this.onDispose();
144
- }
145
-
146
- protected testRunStarted(request: theia.TestRunRequest, name: string, persist: boolean, isRunning: boolean): TestRun {
147
- const existing = this.activeRuns.get(request);
148
- if (existing) {
149
- return existing;
150
- }
151
-
152
- const run = new TestRun(this, this.proxy, name, persist, isRunning, request.preserveFocus);
138
+ const run = new TestRun(this, this.proxy, name || '', persist, true, request.preserveFocus);
153
139
  const endListener = run.onWillFlush(() => {
154
140
  // make sure we notify the front end of test item changes before test run state is sent
155
141
  this.deltaBuilder.flush();
@@ -162,6 +148,11 @@ export class TestControllerImpl implements theia.TestController {
162
148
  return run;
163
149
  }
164
150
 
151
+ dispose() {
152
+ this.proxy.$unregisterTestController(this.id);
153
+ this.onDispose();
154
+ }
155
+
165
156
  runTestsForUI(profileId: string, name: string, includedTests: string[][], excludedTests: string[][], preserveFocus: boolean): void {
166
157
  const profile = this.getProfile(profileId);
167
158
  if (!profile) {
@@ -200,8 +191,8 @@ export class TestControllerImpl implements theia.TestController {
200
191
  includeTests, excludeTests, profile, false /* don't support continuous run yet */, preserveFocus
201
192
  );
202
193
 
203
- const run = this.testRunStarted(request, name, false, false);
204
- profile.runHandler(request, run.token);
194
+ // we do not cancel test runs via a cancellation token, but instead invoke "cancel" on the test runs
195
+ profile.runHandler(request, CancellationToken.None);
205
196
  }
206
197
 
207
198
  cancelRun(runId?: string): void {
@@ -235,7 +226,18 @@ function checkTestInstance(item?: theia.TestItem): TestItemImpl | undefined {
235
226
  return undefined;
236
227
  }
237
228
 
238
- class TestRun implements theia.TestRun {
229
+ export function checkTestRunInstance(item: theia.TestRun): TestRun;
230
+ export function checkTestRunInstance(item?: theia.TestRun): TestRun | undefined;
231
+ export function checkTestRunInstance(item?: theia.TestRun): TestRun | undefined {
232
+ if (item instanceof TestRun) {
233
+ return <TestRun>item;
234
+ } else if (item) {
235
+ throw new Error('Not a TestRun instance');
236
+ }
237
+ return undefined;
238
+ }
239
+
240
+ export class TestRun implements theia.TestRun {
239
241
  private onDidEndEmitter = new Emitter<void>();
240
242
  onDidEnd: Event<void> = this.onDidEndEmitter.event;
241
243
  private onWillFlushEmitter = new Emitter<void>();
@@ -251,10 +253,9 @@ class TestRun implements theia.TestRun {
251
253
  }, 200);
252
254
  private ended: boolean;
253
255
  private tokenSource: CancellationTokenSource;
254
- readonly token: CancellationToken;
255
256
 
256
257
  constructor(
257
- private readonly controller: TestControllerImpl,
258
+ readonly controller: TestControllerImpl,
258
259
  private readonly proxy: TestingMain,
259
260
  readonly name: string,
260
261
  readonly isPersisted: boolean,
@@ -263,10 +264,14 @@ class TestRun implements theia.TestRun {
263
264
  this.id = generateUuid();
264
265
 
265
266
  this.tokenSource = new CancellationTokenSource();
266
- this.token = this.tokenSource.token;
267
267
 
268
268
  this.proxy.$notifyTestRunCreated(this.controller.id, { id: this.id, name: this.name, isRunning }, preserveFocus);
269
269
  }
270
+
271
+ get token(): CancellationToken {
272
+ return this.tokenSource.token;
273
+ }
274
+
270
275
  enqueued(test: theia.TestItem): void {
271
276
  this.updateTestState(test, { itemPath: checkTestInstance(test).path, state: TestExecutionState.Queued });
272
277
  }
@@ -509,7 +514,7 @@ export class TestRunProfile implements theia.TestRunProfile {
509
514
  }
510
515
 
511
516
  doSetDefault(isDefault: boolean): boolean {
512
- if (this._isDefault !== isDefault) {
517
+ if (this._isDefault !== isDefault) {
513
518
  this._isDefault = isDefault;
514
519
  this.onDidChangeDefaultEmitter.fire(isDefault);
515
520
  return true;
@@ -446,7 +446,7 @@ class TreeViewExtImpl<T> implements Disposable {
446
446
  } else if (ThemeIcon.is(iconPath)) {
447
447
  themeIcon = iconPath;
448
448
  } else {
449
- iconUrl = PluginIconPath.toUrl(<PluginIconPath | undefined>iconPath, this.plugin);
449
+ iconUrl = PluginIconPath.toUrl(iconPath, this.plugin);
450
450
  }
451
451
 
452
452
  let checkboxInfo;
@@ -16,7 +16,7 @@
16
16
 
17
17
  import * as theia from '@theia/plugin';
18
18
  import * as lstypes from '@theia/core/shared/vscode-languageserver-protocol';
19
- import { InlineValueEvaluatableExpression, InlineValueText, InlineValueVariableLookup, QuickPickItemKind, URI } from './types-impl';
19
+ import { InlineValueEvaluatableExpression, InlineValueText, InlineValueVariableLookup, QuickPickItemKind, ThemeIcon, URI } from './types-impl';
20
20
  import * as rpc from '../common/plugin-api-rpc';
21
21
  import {
22
22
  DecorationOptions, EditorPosition, Plugin, Position, WorkspaceTextEditDto, WorkspaceFileEditDto, Selection, TaskDto, WorkspaceEditDto
@@ -35,7 +35,7 @@ import { CellRange, isTextStreamMime } from '@theia/notebook/lib/common';
35
35
  import { MarkdownString as MarkdownStringDTO } from '@theia/core/lib/common/markdown-rendering';
36
36
 
37
37
  import { TestItemDTO, TestMessageDTO } from '../common/test-types';
38
- import { ThemeIcon } from '@theia/monaco-editor-core/esm/vs/base/common/themables';
38
+ import { PluginIconPath } from './plugin-icon-path';
39
39
 
40
40
  const SIDE_GROUP = -2;
41
41
  const ACTIVE_GROUP = -1;
@@ -1226,7 +1226,7 @@ export function convertIconPath(iconPath: types.URI | { light: types.URI; dark:
1226
1226
  dark: iconPath.dark.toJSON(),
1227
1227
  light: iconPath.light?.toJSON()
1228
1228
  };
1229
- } else if (ThemeIcon.isThemeIcon(iconPath)) {
1229
+ } else if (ThemeIcon.is(iconPath)) {
1230
1230
  return {
1231
1231
  id: iconPath.id,
1232
1232
  color: iconPath.color ? { id: iconPath.color.id } : undefined
@@ -1236,19 +1236,19 @@ export function convertIconPath(iconPath: types.URI | { light: types.URI; dark:
1236
1236
  }
1237
1237
  }
1238
1238
 
1239
- export function convertQuickInputButton(button: theia.QuickInputButton, index: number): rpc.TransferQuickInputButton {
1239
+ export function convertQuickInputButton(plugin: Plugin, button: theia.QuickInputButton, index: number): rpc.TransferQuickInputButton {
1240
1240
  const iconPath = convertIconPath(button.iconPath);
1241
1241
  if (!iconPath) {
1242
1242
  throw new Error(`Could not convert icon path: '${button.iconPath}'`);
1243
1243
  }
1244
1244
  return {
1245
1245
  handle: index,
1246
- iconPath: iconPath,
1246
+ iconUrl: PluginIconPath.toUrl(iconPath, plugin) ?? ThemeIcon.get(iconPath),
1247
1247
  tooltip: button.tooltip
1248
1248
  };
1249
1249
  }
1250
1250
 
1251
- export function convertToTransferQuickPickItems(items: (theia.QuickPickItem | string)[]): rpc.TransferQuickPickItem[] {
1251
+ export function convertToTransferQuickPickItems(plugin: Plugin, items: (theia.QuickPickItem | string)[]): rpc.TransferQuickPickItem[] {
1252
1252
  return items.map((item, index) => {
1253
1253
  if (typeof item === 'string') {
1254
1254
  return { kind: 'item', label: item, handle: index };
@@ -1260,11 +1260,11 @@ export function convertToTransferQuickPickItems(items: (theia.QuickPickItem | st
1260
1260
  kind: 'item',
1261
1261
  label,
1262
1262
  description,
1263
- iconPath: convertIconPath(iconPath),
1263
+ iconUrl: PluginIconPath.toUrl(iconPath, plugin) ?? ThemeIcon.get(iconPath),
1264
1264
  detail,
1265
1265
  picked,
1266
1266
  alwaysShow,
1267
- buttons: buttons ? buttons.map(convertQuickInputButton) : undefined,
1267
+ buttons: buttons ? buttons.map((button, i) => convertQuickInputButton(plugin, button, i)) : undefined,
1268
1268
  handle: index,
1269
1269
  };
1270
1270
  }