@theia/plugin-ext 1.65.0-next.28 → 1.65.0-next.47

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 (261) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +1 -0
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.d.ts +1 -0
  4. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  5. package/lib/main/browser/authentication-main.d.ts +1 -0
  6. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  7. package/lib/main/browser/command-registry-main.d.ts +1 -0
  8. package/lib/main/browser/command-registry-main.d.ts.map +1 -1
  9. package/lib/main/browser/comments/comment-thread-widget.d.ts +1 -0
  10. package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
  11. package/lib/main/browser/comments/comments-main.d.ts +1 -0
  12. package/lib/main/browser/comments/comments-main.d.ts.map +1 -1
  13. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -0
  14. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  15. package/lib/main/browser/debug/plugin-debug-service.d.ts +1 -0
  16. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  17. package/lib/main/browser/languages-main.d.ts +1 -0
  18. package/lib/main/browser/languages-main.d.ts.map +1 -1
  19. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  20. package/lib/main/browser/menus/menus-contribution-handler.js +1 -1
  21. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  22. package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
  23. package/lib/main/browser/menus/vscode-theia-menu-mappings.js +1 -0
  24. package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
  25. package/lib/main/browser/notebooks/notebooks-main.d.ts +1 -0
  26. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
  27. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
  28. package/lib/main/browser/notebooks/renderers/output-webview-internal.js +7 -0
  29. package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
  30. package/lib/main/browser/plugin-ext-argument-processor.d.ts +12 -0
  31. package/lib/main/browser/plugin-ext-argument-processor.d.ts.map +1 -0
  32. package/lib/main/browser/plugin-ext-argument-processor.js +41 -0
  33. package/lib/main/browser/plugin-ext-argument-processor.js.map +1 -0
  34. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  35. package/lib/main/browser/plugin-ext-frontend-module.js +3 -0
  36. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  37. package/lib/main/browser/quick-open-main.d.ts +1 -0
  38. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  39. package/lib/main/browser/terminal-main.d.ts +1 -0
  40. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  41. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  42. package/lib/main/browser/view/plugin-view-registry.js +3 -0
  43. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  44. package/lib/main/browser/view/tree-view-decorator-service.d.ts +1 -0
  45. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  46. package/lib/main/browser/view/tree-view-widget.d.ts +1 -0
  47. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  48. package/lib/main/browser/view/tree-views-main.d.ts +1 -0
  49. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  50. package/lib/main/browser/view/tree-views-main.js +1 -1
  51. package/lib/main/browser/view/tree-views-main.js.map +1 -1
  52. package/lib/main/browser/webview/webview.d.ts +1 -0
  53. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  54. package/lib/main/browser/webview-views/webview-views-main.d.ts +1 -0
  55. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
  56. package/lib/main/browser/webviews-main.d.ts +1 -0
  57. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  58. package/lib/main/browser/workspace-main.d.ts +1 -0
  59. package/lib/main/browser/workspace-main.d.ts.map +1 -1
  60. package/lib/plugin/authentication-ext.d.ts +1 -0
  61. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  62. package/lib/plugin/clipboard-ext.d.ts +1 -0
  63. package/lib/plugin/clipboard-ext.d.ts.map +1 -1
  64. package/lib/plugin/command-registry.d.ts +1 -0
  65. package/lib/plugin/command-registry.d.ts.map +1 -1
  66. package/lib/plugin/comments.d.ts +1 -0
  67. package/lib/plugin/comments.d.ts.map +1 -1
  68. package/lib/plugin/custom-editors.d.ts +1 -0
  69. package/lib/plugin/custom-editors.d.ts.map +1 -1
  70. package/lib/plugin/debug/debug-ext.d.ts +1 -0
  71. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  72. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +1 -0
  73. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -1
  74. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +1 -0
  75. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  76. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts +1 -0
  77. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -1
  78. package/lib/plugin/decorations.d.ts +1 -0
  79. package/lib/plugin/decorations.d.ts.map +1 -1
  80. package/lib/plugin/dialogs.d.ts +1 -0
  81. package/lib/plugin/dialogs.d.ts.map +1 -1
  82. package/lib/plugin/document-data.d.ts +1 -0
  83. package/lib/plugin/document-data.d.ts.map +1 -1
  84. package/lib/plugin/documents.d.ts +1 -0
  85. package/lib/plugin/documents.d.ts.map +1 -1
  86. package/lib/plugin/env.d.ts +1 -0
  87. package/lib/plugin/env.d.ts.map +1 -1
  88. package/lib/plugin/file-system-event-service-ext-impl.d.ts +1 -0
  89. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  90. package/lib/plugin/file-system-ext-impl.d.ts +1 -0
  91. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  92. package/lib/plugin/label-service.d.ts +1 -0
  93. package/lib/plugin/label-service.d.ts.map +1 -1
  94. package/lib/plugin/languages/call-hierarchy.d.ts +1 -0
  95. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  96. package/lib/plugin/languages/code-action.d.ts +1 -0
  97. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  98. package/lib/plugin/languages/color.d.ts +1 -0
  99. package/lib/plugin/languages/color.d.ts.map +1 -1
  100. package/lib/plugin/languages/completion.d.ts +1 -0
  101. package/lib/plugin/languages/completion.d.ts.map +1 -1
  102. package/lib/plugin/languages/declaration.d.ts +1 -0
  103. package/lib/plugin/languages/declaration.d.ts.map +1 -1
  104. package/lib/plugin/languages/definition.d.ts +1 -0
  105. package/lib/plugin/languages/definition.d.ts.map +1 -1
  106. package/lib/plugin/languages/diagnostics.d.ts +1 -0
  107. package/lib/plugin/languages/diagnostics.d.ts.map +1 -1
  108. package/lib/plugin/languages/document-drop-edit.d.ts +1 -0
  109. package/lib/plugin/languages/document-drop-edit.d.ts.map +1 -1
  110. package/lib/plugin/languages/document-formatting.d.ts +1 -0
  111. package/lib/plugin/languages/document-formatting.d.ts.map +1 -1
  112. package/lib/plugin/languages/document-highlight.d.ts +1 -0
  113. package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
  114. package/lib/plugin/languages/evaluatable-expression.d.ts +1 -0
  115. package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -1
  116. package/lib/plugin/languages/folding.d.ts +1 -0
  117. package/lib/plugin/languages/folding.d.ts.map +1 -1
  118. package/lib/plugin/languages/hover.d.ts +1 -0
  119. package/lib/plugin/languages/hover.d.ts.map +1 -1
  120. package/lib/plugin/languages/implementation.d.ts +1 -0
  121. package/lib/plugin/languages/implementation.d.ts.map +1 -1
  122. package/lib/plugin/languages/inlay-hints.d.ts +1 -0
  123. package/lib/plugin/languages/inlay-hints.d.ts.map +1 -1
  124. package/lib/plugin/languages/inline-completion.d.ts +1 -0
  125. package/lib/plugin/languages/inline-completion.d.ts.map +1 -1
  126. package/lib/plugin/languages/inline-values.d.ts +1 -0
  127. package/lib/plugin/languages/inline-values.d.ts.map +1 -1
  128. package/lib/plugin/languages/lens.d.ts +1 -0
  129. package/lib/plugin/languages/lens.d.ts.map +1 -1
  130. package/lib/plugin/languages/link-provider.d.ts +1 -0
  131. package/lib/plugin/languages/link-provider.d.ts.map +1 -1
  132. package/lib/plugin/languages/linked-editing-range.d.ts +1 -0
  133. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -1
  134. package/lib/plugin/languages/on-type-formatting.d.ts +1 -0
  135. package/lib/plugin/languages/on-type-formatting.d.ts.map +1 -1
  136. package/lib/plugin/languages/outline.d.ts +1 -0
  137. package/lib/plugin/languages/outline.d.ts.map +1 -1
  138. package/lib/plugin/languages/range-formatting.d.ts +1 -0
  139. package/lib/plugin/languages/range-formatting.d.ts.map +1 -1
  140. package/lib/plugin/languages/reference.d.ts +1 -0
  141. package/lib/plugin/languages/reference.d.ts.map +1 -1
  142. package/lib/plugin/languages/rename.d.ts +1 -0
  143. package/lib/plugin/languages/rename.d.ts.map +1 -1
  144. package/lib/plugin/languages/selection-range.d.ts +1 -0
  145. package/lib/plugin/languages/selection-range.d.ts.map +1 -1
  146. package/lib/plugin/languages/semantic-highlighting.d.ts +1 -0
  147. package/lib/plugin/languages/semantic-highlighting.d.ts.map +1 -1
  148. package/lib/plugin/languages/signature.d.ts +1 -0
  149. package/lib/plugin/languages/signature.d.ts.map +1 -1
  150. package/lib/plugin/languages/type-definition.d.ts +1 -0
  151. package/lib/plugin/languages/type-definition.d.ts.map +1 -1
  152. package/lib/plugin/languages/type-hierarchy.d.ts +1 -0
  153. package/lib/plugin/languages/type-hierarchy.d.ts.map +1 -1
  154. package/lib/plugin/languages/util.d.ts +1 -0
  155. package/lib/plugin/languages/util.d.ts.map +1 -1
  156. package/lib/plugin/languages/workspace-symbol.d.ts +1 -0
  157. package/lib/plugin/languages/workspace-symbol.d.ts.map +1 -1
  158. package/lib/plugin/languages-utils.d.ts +1 -0
  159. package/lib/plugin/languages-utils.d.ts.map +1 -1
  160. package/lib/plugin/languages.d.ts +1 -0
  161. package/lib/plugin/languages.d.ts.map +1 -1
  162. package/lib/plugin/lm-ext.d.ts +1 -0
  163. package/lib/plugin/lm-ext.d.ts.map +1 -1
  164. package/lib/plugin/markdown-string.d.ts +1 -0
  165. package/lib/plugin/markdown-string.d.ts.map +1 -1
  166. package/lib/plugin/message-registry.d.ts +1 -0
  167. package/lib/plugin/message-registry.d.ts.map +1 -1
  168. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +1 -0
  169. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -1
  170. package/lib/plugin/notebook/notebook-document.d.ts +1 -0
  171. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -1
  172. package/lib/plugin/notebook/notebook-documents.d.ts +1 -0
  173. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -1
  174. package/lib/plugin/notebook/notebook-editor.d.ts +1 -0
  175. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -1
  176. package/lib/plugin/notebook/notebook-editors.d.ts +1 -0
  177. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -1
  178. package/lib/plugin/notebook/notebook-kernels.d.ts +1 -0
  179. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  180. package/lib/plugin/notebook/notebook-renderers.d.ts +1 -0
  181. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -1
  182. package/lib/plugin/notebook/notebooks.d.ts +1 -0
  183. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  184. package/lib/plugin/notification.d.ts +1 -0
  185. package/lib/plugin/notification.d.ts.map +1 -1
  186. package/lib/plugin/output-channel/log-output-channel.d.ts +1 -0
  187. package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -1
  188. package/lib/plugin/output-channel/output-channel-item.d.ts +1 -0
  189. package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
  190. package/lib/plugin/output-channel-registry.d.ts +1 -0
  191. package/lib/plugin/output-channel-registry.d.ts.map +1 -1
  192. package/lib/plugin/plugin-context.d.ts +1 -0
  193. package/lib/plugin/plugin-context.d.ts.map +1 -1
  194. package/lib/plugin/plugin-context.js +3 -2
  195. package/lib/plugin/plugin-context.js.map +1 -1
  196. package/lib/plugin/plugin-manager.d.ts +1 -0
  197. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  198. package/lib/plugin/plugin-storage.d.ts +1 -0
  199. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  200. package/lib/plugin/preference-registry.d.ts +1 -0
  201. package/lib/plugin/preference-registry.d.ts.map +1 -1
  202. package/lib/plugin/quick-open.d.ts +1 -0
  203. package/lib/plugin/quick-open.d.ts.map +1 -1
  204. package/lib/plugin/scm.d.ts +1 -0
  205. package/lib/plugin/scm.d.ts.map +1 -1
  206. package/lib/plugin/secrets-ext.d.ts +1 -0
  207. package/lib/plugin/secrets-ext.d.ts.map +1 -1
  208. package/lib/plugin/status-bar/status-bar-item.d.ts +4 -1
  209. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  210. package/lib/plugin/status-bar/status-bar-item.js +46 -1
  211. package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
  212. package/lib/plugin/status-bar-message-registry.d.ts +4 -1
  213. package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
  214. package/lib/plugin/status-bar-message-registry.js +3 -2
  215. package/lib/plugin/status-bar-message-registry.js.map +1 -1
  216. package/lib/plugin/tabs.d.ts +1 -0
  217. package/lib/plugin/tabs.d.ts.map +1 -1
  218. package/lib/plugin/tasks/task-provider.d.ts +1 -0
  219. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  220. package/lib/plugin/tasks/tasks.d.ts +1 -0
  221. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  222. package/lib/plugin/terminal-ext.d.ts +1 -0
  223. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  224. package/lib/plugin/test-item.d.ts +1 -0
  225. package/lib/plugin/test-item.d.ts.map +1 -1
  226. package/lib/plugin/tests.d.ts +1 -0
  227. package/lib/plugin/tests.d.ts.map +1 -1
  228. package/lib/plugin/text-editor.d.ts +1 -0
  229. package/lib/plugin/text-editor.d.ts.map +1 -1
  230. package/lib/plugin/text-editors.d.ts +1 -0
  231. package/lib/plugin/text-editors.d.ts.map +1 -1
  232. package/lib/plugin/timeline.d.ts +1 -0
  233. package/lib/plugin/timeline.d.ts.map +1 -1
  234. package/lib/plugin/tree/tree-views.d.ts +1 -0
  235. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  236. package/lib/plugin/type-converters.d.ts +1 -0
  237. package/lib/plugin/type-converters.d.ts.map +1 -1
  238. package/lib/plugin/types-impl.d.ts +1 -0
  239. package/lib/plugin/types-impl.d.ts.map +1 -1
  240. package/lib/plugin/uri-ext.d.ts +1 -0
  241. package/lib/plugin/uri-ext.d.ts.map +1 -1
  242. package/lib/plugin/webview-views.d.ts +1 -0
  243. package/lib/plugin/webview-views.d.ts.map +1 -1
  244. package/lib/plugin/webviews.d.ts +1 -0
  245. package/lib/plugin/webviews.d.ts.map +1 -1
  246. package/lib/plugin/window-state.d.ts +1 -0
  247. package/lib/plugin/window-state.d.ts.map +1 -1
  248. package/lib/plugin/workspace.d.ts +1 -0
  249. package/lib/plugin/workspace.d.ts.map +1 -1
  250. package/package.json +29 -29
  251. package/src/main/browser/menus/menus-contribution-handler.ts +2 -2
  252. package/src/main/browser/menus/vscode-theia-menu-mappings.ts +2 -1
  253. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +8 -0
  254. package/src/main/browser/plugin-ext-argument-processor.ts +39 -0
  255. package/src/main/browser/plugin-ext-frontend-module.ts +4 -0
  256. package/src/main/browser/view/plugin-view-registry.ts +3 -0
  257. package/src/main/browser/view/tree-views-main.ts +1 -1
  258. package/src/main/browser/webview/pre/main.js +13 -10
  259. package/src/plugin/plugin-context.ts +5 -3
  260. package/src/plugin/status-bar/status-bar-item.ts +54 -0
  261. package/src/plugin/status-bar-message-registry.ts +3 -2
@@ -250,9 +250,11 @@ delete window.frameElement;
250
250
  }
251
251
 
252
252
  let baseElement = event.view.document.getElementsByTagName('base')[0];
253
- /** @type {any} */
254
- let node = event.target;
255
- while (node) {
253
+
254
+ // Use composedPath to get the event path through shadow DOM
255
+ const path = event.composedPath ? event.composedPath() : [event.target];
256
+
257
+ for (const node of path) {
256
258
  if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
257
259
  if (node.getAttribute('href') === '#') {
258
260
  event.view.scrollTo(0, 0);
@@ -267,7 +269,6 @@ delete window.frameElement;
267
269
  event.preventDefault();
268
270
  break;
269
271
  }
270
- node = node.parentNode;
271
272
  }
272
273
  };
273
274
 
@@ -282,13 +283,14 @@ delete window.frameElement;
282
283
  }
283
284
 
284
285
  if (event.button === 1) {
285
- let node = /** @type {any} */ (event.target);
286
- while (node) {
286
+ // Use composedPath to get the event path through shadow DOM
287
+ const path = event.composedPath ? event.composedPath() : [event.target];
288
+
289
+ for (const node of path) {
287
290
  if (node.tagName && node.tagName.toLowerCase() === 'a' && node.href) {
288
291
  event.preventDefault();
289
292
  break;
290
293
  }
291
- node = node.parentNode;
292
294
  }
293
295
  }
294
296
  };
@@ -354,16 +356,17 @@ delete window.frameElement;
354
356
  host.postMessage('did-context-menu', {
355
357
  clientX: e.clientX,
356
358
  clientY: e.clientY,
357
- context: findVscodeContext(e.target)
359
+ context: findVscodeContext(e.composedPath(), 0)
358
360
  });
359
361
  };
360
362
 
361
- function findVscodeContext(node) {
363
+ function findVscodeContext(nodes, index) {
364
+ const node = nodes[index];
362
365
  if (node) {
363
366
  if (node.dataset?.vscodeContext) {
364
367
  return JSON.parse(node.dataset.vscodeContext);
365
368
  }
366
- return findVscodeContext(node.parentElement);
369
+ return findVscodeContext(nodes, ++index);
367
370
  }
368
371
  return {};
369
372
  }
@@ -240,7 +240,8 @@ import {
240
240
  TerminalCompletionItemKind,
241
241
  TerminalCompletionList,
242
242
  McpHttpServerDefinition,
243
- McpStdioServerDefinition
243
+ McpStdioServerDefinition,
244
+ InteractiveWindowInput
244
245
  } from './types-impl';
245
246
  import { AuthenticationExtImpl } from './authentication-ext';
246
247
  import { SymbolKind } from '../common/plugin-api-rpc-model';
@@ -333,7 +334,7 @@ export function createAPIFactory(
333
334
  const notebookRenderers = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_RENDERERS_EXT, new NotebookRenderersExtImpl(rpc, notebooksExt));
334
335
  const notebookKernels = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_KERNELS_EXT, new NotebookKernelsExtImpl(rpc, notebooksExt, commandRegistry, webviewExt, workspaceExt));
335
336
  const notebookDocuments = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_EXT, new NotebookDocumentsExtImpl(notebooksExt));
336
- const statusBarMessageRegistryExt = new StatusBarMessageRegistryExt(rpc);
337
+ const statusBarMessageRegistryExt = new StatusBarMessageRegistryExt(rpc, commandRegistry);
337
338
  const terminalExt = rpc.set(MAIN_RPC_CONTEXT.TERMINAL_EXT, new TerminalServiceExtImpl(rpc));
338
339
  const outputChannelRegistryExt = rpc.set(MAIN_RPC_CONTEXT.OUTPUT_CHANNEL_REGISTRY_EXT, new OutputChannelRegistryExtImpl(rpc));
339
340
  const treeViewsExt = rpc.set(MAIN_RPC_CONTEXT.TREE_VIEWS_EXT, new TreeViewsExtImpl(rpc, commandRegistry));
@@ -1614,7 +1615,8 @@ export function createAPIFactory(
1614
1615
  TerminalCompletionItemKind,
1615
1616
  TerminalCompletionList,
1616
1617
  McpHttpServerDefinition,
1617
- McpStdioServerDefinition
1618
+ McpStdioServerDefinition,
1619
+ TabInputInteractiveWindow: InteractiveWindowInput,
1618
1620
  };
1619
1621
  };
1620
1622
  }
@@ -17,6 +17,9 @@ import * as theia from '@theia/plugin';
17
17
  import { ThemeColor, StatusBarAlignment } from '../types-impl';
18
18
  import { StatusBarMessageRegistryMain } from '../../common/plugin-api-rpc';
19
19
  import { UUID } from '@theia/core/shared/@lumino/coreutils';
20
+ import { CommandRegistryImpl } from '../command-registry';
21
+ import { MarkdownString } from '../markdown-string';
22
+ import { DisposableCollection } from '@theia/core/lib/common/disposable';
20
23
 
21
24
  export class StatusBarItemImpl implements theia.StatusBarItem {
22
25
 
@@ -45,6 +48,7 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
45
48
  _proxy: StatusBarMessageRegistryMain;
46
49
 
47
50
  constructor(_proxy: StatusBarMessageRegistryMain,
51
+ private readonly commandRegistry: CommandRegistryImpl,
48
52
  alignment: StatusBarAlignment = StatusBarAlignment.Left,
49
53
  priority: number = 0,
50
54
  id = StatusBarItemImpl.nextId()) {
@@ -105,6 +109,56 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
105
109
  }
106
110
 
107
111
  public set tooltip(tooltip: string | theia.MarkdownString | undefined) {
112
+ if (tooltip && MarkdownString.isMarkdownString(tooltip)) {
113
+ const markdownTooltip = tooltip;
114
+ const content = markdownTooltip.value;
115
+ // Find all command links in the markdown content
116
+ const regex = /\[([^\]]+)\]\(command:([^?\s\)]+)(?:\?([^\s\)]+))?([^\)]*)\)/g;
117
+ let match;
118
+ let updatedContent = content;
119
+
120
+ while ((match = regex.exec(content)) !== null) {
121
+ const linkText = match[1];
122
+ const commandId = match[2];
123
+ const argsEncoded = match[3]; // This captures the encoded arguments
124
+ const tooltipPart = match[4] || ''; // This captures any tooltip or additional content after the command and args
125
+
126
+ let args: unknown[] = [];
127
+ if (argsEncoded) {
128
+ try {
129
+ const decoded = decodeURIComponent(argsEncoded);
130
+ args = JSON.parse(decoded);
131
+ } catch (e) {
132
+ console.error('Failed to parse command arguments:', e);
133
+ }
134
+ }
135
+
136
+ const safeCommand = this.commandRegistry.converter.toSafeCommand(
137
+ {
138
+ command: commandId,
139
+ title: linkText,
140
+ arguments: Array.isArray(args) ? args : [args]
141
+ },
142
+ new DisposableCollection()
143
+ );
144
+
145
+ if (safeCommand?.id) {
146
+ let newArgsPart = '';
147
+ if (safeCommand.arguments && safeCommand.arguments.length > 0) {
148
+ newArgsPart = `?${encodeURIComponent(JSON.stringify(safeCommand.arguments))}`;
149
+ }
150
+
151
+ const argsPart = argsEncoded ? `?${argsEncoded}` : '';
152
+ const originalLink = `[${linkText}](command:${commandId}${argsPart}${tooltipPart})`;
153
+ const safeLink = `[${linkText}](command:${safeCommand.id}${newArgsPart}${tooltipPart})`;
154
+ updatedContent = updatedContent.replace(originalLink, safeLink);
155
+ }
156
+ }
157
+
158
+ if (updatedContent !== content) {
159
+ markdownTooltip.value = updatedContent;
160
+ }
161
+ }
108
162
  this._tooltip = tooltip;
109
163
  this.update();
110
164
  }
@@ -20,6 +20,7 @@ import {
20
20
  } from '../common/plugin-api-rpc';
21
21
  import { RPCProtocol } from '../common/rpc-protocol';
22
22
  import { StatusBarItemImpl } from './status-bar/status-bar-item';
23
+ import { CommandRegistryImpl } from './command-registry';
23
24
 
24
25
  /*---------------------------------------------------------------------------------------------
25
26
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -32,7 +33,7 @@ export class StatusBarMessageRegistryExt {
32
33
 
33
34
  protected readonly statusMessage: StatusBarMessage;
34
35
 
35
- constructor(rpc: RPCProtocol) {
36
+ constructor(rpc: RPCProtocol, readonly commandRegistry: CommandRegistryImpl) {
36
37
  this.proxy = rpc.getProxy(Ext.STATUS_BAR_MESSAGE_REGISTRY_MAIN);
37
38
  this.statusMessage = new StatusBarMessage(this);
38
39
  }
@@ -58,7 +59,7 @@ export class StatusBarMessageRegistryExt {
58
59
  }
59
60
 
60
61
  createStatusBarItem(alignment?: StatusBarAlignment, priority?: number, id?: string): StatusBarItem {
61
- return new StatusBarItemImpl(this.proxy, alignment, priority, id);
62
+ return new StatusBarItemImpl(this.proxy, this.commandRegistry, alignment, priority, id);
62
63
  }
63
64
 
64
65
  }