@theia/plugin-ext 1.53.2 → 1.55.0-next.14

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 (310) hide show
  1. package/lib/common/plugin-api-rpc-model.d.ts +10 -1
  2. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  4. package/lib/common/plugin-api-rpc.d.ts +7 -6
  5. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  6. package/lib/common/plugin-api-rpc.js.map +1 -1
  7. package/lib/common/test-types.d.ts +11 -1
  8. package/lib/common/test-types.d.ts.map +1 -1
  9. package/lib/common/test-types.js +9 -1
  10. package/lib/common/test-types.js.map +1 -1
  11. package/lib/main/browser/authentication-main.d.ts +6 -6
  12. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  13. package/lib/main/browser/authentication-main.js +15 -9
  14. package/lib/main/browser/authentication-main.js.map +1 -1
  15. package/lib/main/browser/command-registry-main.d.ts +0 -1
  16. package/lib/main/browser/command-registry-main.d.ts.map +1 -1
  17. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +5 -3
  18. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  19. package/lib/main/browser/custom-editors/custom-editor-opener.js +16 -3
  20. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  21. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +0 -1
  22. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  23. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +2 -1
  24. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
  25. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +6 -2
  26. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  27. package/lib/main/browser/debug/plugin-debug-service.d.ts +0 -1
  28. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  29. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  30. package/lib/main/browser/editors-and-documents-main.js +17 -2
  31. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  32. package/lib/main/browser/languages-main.d.ts +0 -1
  33. package/lib/main/browser/languages-main.d.ts.map +1 -1
  34. package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts.map +1 -1
  35. package/lib/main/browser/menus/plugin-menu-command-adapter.js +2 -2
  36. package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
  37. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -1
  38. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +10 -7
  39. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
  40. package/lib/main/browser/notebooks/notebooks-main.d.ts +0 -1
  41. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
  42. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +22 -12
  43. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
  44. package/lib/main/browser/notebooks/renderers/cell-output-webview.js +145 -74
  45. package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
  46. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
  47. package/lib/main/browser/notebooks/renderers/output-webview-internal.js +198 -69
  48. package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
  49. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +56 -6
  50. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -1
  51. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  52. package/lib/main/browser/plugin-ext-frontend-module.js +2 -1
  53. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  54. package/lib/main/browser/quick-open-main.d.ts +0 -1
  55. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  56. package/lib/main/browser/tabs/tabs-main.d.ts +1 -1
  57. package/lib/main/browser/tabs/tabs-main.d.ts.map +1 -1
  58. package/lib/main/browser/tabs/tabs-main.js +1 -1
  59. package/lib/main/browser/tabs/tabs-main.js.map +1 -1
  60. package/lib/main/browser/terminal-main.d.ts +0 -1
  61. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  62. package/lib/main/browser/test-main.d.ts.map +1 -1
  63. package/lib/main/browser/test-main.js.map +1 -1
  64. package/lib/main/browser/text-editor-main.d.ts +6 -3
  65. package/lib/main/browser/text-editor-main.d.ts.map +1 -1
  66. package/lib/main/browser/text-editor-main.js +39 -5
  67. package/lib/main/browser/text-editor-main.js.map +1 -1
  68. package/lib/main/browser/view/tree-view-decorator-service.d.ts +0 -1
  69. package/lib/main/browser/view/tree-view-decorator-service.d.ts.map +1 -1
  70. package/lib/main/browser/view/tree-view-widget.d.ts +0 -1
  71. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  72. package/lib/main/browser/view/tree-views-main.d.ts +0 -1
  73. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  74. package/lib/main/browser/webview/webview.d.ts +0 -1
  75. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  76. package/lib/main/browser/webview-views/webview-views-main.d.ts +0 -1
  77. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
  78. package/lib/main/browser/webviews-main.d.ts +0 -1
  79. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  80. package/lib/main/browser/workspace-main.d.ts +0 -1
  81. package/lib/main/browser/workspace-main.d.ts.map +1 -1
  82. package/lib/plugin/authentication-ext.d.ts +3 -3
  83. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  84. package/lib/plugin/authentication-ext.js +8 -5
  85. package/lib/plugin/authentication-ext.js.map +1 -1
  86. package/lib/plugin/clipboard-ext.d.ts +0 -1
  87. package/lib/plugin/clipboard-ext.d.ts.map +1 -1
  88. package/lib/plugin/command-registry.d.ts +0 -1
  89. package/lib/plugin/command-registry.d.ts.map +1 -1
  90. package/lib/plugin/comments.d.ts +0 -1
  91. package/lib/plugin/comments.d.ts.map +1 -1
  92. package/lib/plugin/custom-editors.d.ts +0 -1
  93. package/lib/plugin/custom-editors.d.ts.map +1 -1
  94. package/lib/plugin/debug/debug-ext.d.ts +0 -1
  95. package/lib/plugin/debug/debug-ext.d.ts.map +1 -1
  96. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +0 -1
  97. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -1
  98. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts +0 -1
  99. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  100. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts +0 -1
  101. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -1
  102. package/lib/plugin/decorations.d.ts +0 -1
  103. package/lib/plugin/decorations.d.ts.map +1 -1
  104. package/lib/plugin/dialogs.d.ts +0 -1
  105. package/lib/plugin/dialogs.d.ts.map +1 -1
  106. package/lib/plugin/document-data.d.ts +0 -1
  107. package/lib/plugin/document-data.d.ts.map +1 -1
  108. package/lib/plugin/documents.d.ts +0 -1
  109. package/lib/plugin/documents.d.ts.map +1 -1
  110. package/lib/plugin/env.d.ts +0 -1
  111. package/lib/plugin/env.d.ts.map +1 -1
  112. package/lib/plugin/file-system-event-service-ext-impl.d.ts +0 -1
  113. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  114. package/lib/plugin/file-system-ext-impl.d.ts +27 -4
  115. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  116. package/lib/plugin/file-system-ext-impl.js +4 -2
  117. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  118. package/lib/plugin/label-service.d.ts +0 -1
  119. package/lib/plugin/label-service.d.ts.map +1 -1
  120. package/lib/plugin/languages/call-hierarchy.d.ts +0 -1
  121. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  122. package/lib/plugin/languages/code-action.d.ts +0 -1
  123. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  124. package/lib/plugin/languages/color.d.ts +0 -1
  125. package/lib/plugin/languages/color.d.ts.map +1 -1
  126. package/lib/plugin/languages/completion.d.ts +0 -1
  127. package/lib/plugin/languages/completion.d.ts.map +1 -1
  128. package/lib/plugin/languages/declaration.d.ts +0 -1
  129. package/lib/plugin/languages/declaration.d.ts.map +1 -1
  130. package/lib/plugin/languages/definition.d.ts +0 -1
  131. package/lib/plugin/languages/definition.d.ts.map +1 -1
  132. package/lib/plugin/languages/diagnostics.d.ts +0 -1
  133. package/lib/plugin/languages/diagnostics.d.ts.map +1 -1
  134. package/lib/plugin/languages/document-drop-edit.d.ts +0 -1
  135. package/lib/plugin/languages/document-drop-edit.d.ts.map +1 -1
  136. package/lib/plugin/languages/document-formatting.d.ts +0 -1
  137. package/lib/plugin/languages/document-formatting.d.ts.map +1 -1
  138. package/lib/plugin/languages/document-highlight.d.ts +0 -1
  139. package/lib/plugin/languages/document-highlight.d.ts.map +1 -1
  140. package/lib/plugin/languages/evaluatable-expression.d.ts +0 -1
  141. package/lib/plugin/languages/evaluatable-expression.d.ts.map +1 -1
  142. package/lib/plugin/languages/folding.d.ts +0 -1
  143. package/lib/plugin/languages/folding.d.ts.map +1 -1
  144. package/lib/plugin/languages/hover.d.ts +0 -1
  145. package/lib/plugin/languages/hover.d.ts.map +1 -1
  146. package/lib/plugin/languages/implementation.d.ts +0 -1
  147. package/lib/plugin/languages/implementation.d.ts.map +1 -1
  148. package/lib/plugin/languages/inlay-hints.d.ts +0 -1
  149. package/lib/plugin/languages/inlay-hints.d.ts.map +1 -1
  150. package/lib/plugin/languages/inline-completion.d.ts +0 -1
  151. package/lib/plugin/languages/inline-completion.d.ts.map +1 -1
  152. package/lib/plugin/languages/inline-values.d.ts +0 -1
  153. package/lib/plugin/languages/inline-values.d.ts.map +1 -1
  154. package/lib/plugin/languages/lens.d.ts +0 -1
  155. package/lib/plugin/languages/lens.d.ts.map +1 -1
  156. package/lib/plugin/languages/link-provider.d.ts +0 -1
  157. package/lib/plugin/languages/link-provider.d.ts.map +1 -1
  158. package/lib/plugin/languages/linked-editing-range.d.ts +0 -1
  159. package/lib/plugin/languages/linked-editing-range.d.ts.map +1 -1
  160. package/lib/plugin/languages/on-type-formatting.d.ts +0 -1
  161. package/lib/plugin/languages/on-type-formatting.d.ts.map +1 -1
  162. package/lib/plugin/languages/outline.d.ts +0 -1
  163. package/lib/plugin/languages/outline.d.ts.map +1 -1
  164. package/lib/plugin/languages/range-formatting.d.ts +0 -1
  165. package/lib/plugin/languages/range-formatting.d.ts.map +1 -1
  166. package/lib/plugin/languages/reference.d.ts +0 -1
  167. package/lib/plugin/languages/reference.d.ts.map +1 -1
  168. package/lib/plugin/languages/rename.d.ts +0 -1
  169. package/lib/plugin/languages/rename.d.ts.map +1 -1
  170. package/lib/plugin/languages/selection-range.d.ts +0 -1
  171. package/lib/plugin/languages/selection-range.d.ts.map +1 -1
  172. package/lib/plugin/languages/semantic-highlighting.d.ts +0 -1
  173. package/lib/plugin/languages/semantic-highlighting.d.ts.map +1 -1
  174. package/lib/plugin/languages/signature.d.ts +0 -1
  175. package/lib/plugin/languages/signature.d.ts.map +1 -1
  176. package/lib/plugin/languages/type-definition.d.ts +0 -1
  177. package/lib/plugin/languages/type-definition.d.ts.map +1 -1
  178. package/lib/plugin/languages/type-hierarchy.d.ts +0 -1
  179. package/lib/plugin/languages/type-hierarchy.d.ts.map +1 -1
  180. package/lib/plugin/languages/util.d.ts +0 -1
  181. package/lib/plugin/languages/util.d.ts.map +1 -1
  182. package/lib/plugin/languages/workspace-symbol.d.ts +0 -1
  183. package/lib/plugin/languages/workspace-symbol.d.ts.map +1 -1
  184. package/lib/plugin/languages-utils.d.ts +0 -1
  185. package/lib/plugin/languages-utils.d.ts.map +1 -1
  186. package/lib/plugin/languages.d.ts +0 -1
  187. package/lib/plugin/languages.d.ts.map +1 -1
  188. package/lib/plugin/markdown-string.d.ts +0 -1
  189. package/lib/plugin/markdown-string.d.ts.map +1 -1
  190. package/lib/plugin/message-registry.d.ts +0 -1
  191. package/lib/plugin/message-registry.d.ts.map +1 -1
  192. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +0 -1
  193. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -1
  194. package/lib/plugin/notebook/notebook-document.d.ts +0 -1
  195. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -1
  196. package/lib/plugin/notebook/notebook-documents.d.ts +0 -1
  197. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -1
  198. package/lib/plugin/notebook/notebook-editor.d.ts +0 -1
  199. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -1
  200. package/lib/plugin/notebook/notebook-editors.d.ts +0 -1
  201. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -1
  202. package/lib/plugin/notebook/notebook-kernels.d.ts +0 -1
  203. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
  204. package/lib/plugin/notebook/notebook-renderers.d.ts +0 -1
  205. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -1
  206. package/lib/plugin/notebook/notebooks.d.ts +1 -1
  207. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  208. package/lib/plugin/notebook/notebooks.js +23 -3
  209. package/lib/plugin/notebook/notebooks.js.map +1 -1
  210. package/lib/plugin/notification.d.ts +0 -1
  211. package/lib/plugin/notification.d.ts.map +1 -1
  212. package/lib/plugin/output-channel/log-output-channel.d.ts +0 -1
  213. package/lib/plugin/output-channel/log-output-channel.d.ts.map +1 -1
  214. package/lib/plugin/output-channel/output-channel-item.d.ts +0 -1
  215. package/lib/plugin/output-channel/output-channel-item.d.ts.map +1 -1
  216. package/lib/plugin/output-channel-registry.d.ts +0 -1
  217. package/lib/plugin/output-channel-registry.d.ts.map +1 -1
  218. package/lib/plugin/plugin-context.d.ts +1 -1
  219. package/lib/plugin/plugin-context.d.ts.map +1 -1
  220. package/lib/plugin/plugin-context.js +37 -15
  221. package/lib/plugin/plugin-context.js.map +1 -1
  222. package/lib/plugin/plugin-manager.d.ts +0 -1
  223. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  224. package/lib/plugin/plugin-storage.d.ts +0 -1
  225. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  226. package/lib/plugin/preference-registry.d.ts +0 -1
  227. package/lib/plugin/preference-registry.d.ts.map +1 -1
  228. package/lib/plugin/quick-open.d.ts +0 -1
  229. package/lib/plugin/quick-open.d.ts.map +1 -1
  230. package/lib/plugin/scm.d.ts +1 -1
  231. package/lib/plugin/scm.d.ts.map +1 -1
  232. package/lib/plugin/scm.js +3 -3
  233. package/lib/plugin/scm.js.map +1 -1
  234. package/lib/plugin/secrets-ext.d.ts +0 -1
  235. package/lib/plugin/secrets-ext.d.ts.map +1 -1
  236. package/lib/plugin/status-bar/status-bar-item.d.ts +0 -1
  237. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  238. package/lib/plugin/status-bar-message-registry.d.ts +0 -1
  239. package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
  240. package/lib/plugin/tabs.d.ts +0 -1
  241. package/lib/plugin/tabs.d.ts.map +1 -1
  242. package/lib/plugin/tasks/task-provider.d.ts +0 -1
  243. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  244. package/lib/plugin/tasks/tasks.d.ts +0 -1
  245. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  246. package/lib/plugin/terminal-ext.d.ts +1 -1
  247. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  248. package/lib/plugin/terminal-ext.js +1 -0
  249. package/lib/plugin/terminal-ext.js.map +1 -1
  250. package/lib/plugin/test-item.d.ts +0 -1
  251. package/lib/plugin/test-item.d.ts.map +1 -1
  252. package/lib/plugin/tests.d.ts +8 -2
  253. package/lib/plugin/tests.d.ts.map +1 -1
  254. package/lib/plugin/tests.js +24 -1
  255. package/lib/plugin/tests.js.map +1 -1
  256. package/lib/plugin/text-editor.d.ts +1 -2
  257. package/lib/plugin/text-editor.d.ts.map +1 -1
  258. package/lib/plugin/text-editor.js.map +1 -1
  259. package/lib/plugin/text-editors.d.ts +0 -1
  260. package/lib/plugin/text-editors.d.ts.map +1 -1
  261. package/lib/plugin/timeline.d.ts +0 -1
  262. package/lib/plugin/timeline.d.ts.map +1 -1
  263. package/lib/plugin/tree/tree-views.d.ts +0 -1
  264. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  265. package/lib/plugin/type-converters.d.ts +13 -2
  266. package/lib/plugin/type-converters.d.ts.map +1 -1
  267. package/lib/plugin/type-converters.js +55 -5
  268. package/lib/plugin/type-converters.js.map +1 -1
  269. package/lib/plugin/types-impl.d.ts +7 -1
  270. package/lib/plugin/types-impl.d.ts.map +1 -1
  271. package/lib/plugin/types-impl.js +9 -1
  272. package/lib/plugin/types-impl.js.map +1 -1
  273. package/lib/plugin/uri-ext.d.ts +0 -1
  274. package/lib/plugin/uri-ext.d.ts.map +1 -1
  275. package/lib/plugin/webview-views.d.ts +0 -1
  276. package/lib/plugin/webview-views.d.ts.map +1 -1
  277. package/lib/plugin/webviews.d.ts +0 -1
  278. package/lib/plugin/webviews.d.ts.map +1 -1
  279. package/lib/plugin/window-state.d.ts +0 -1
  280. package/lib/plugin/window-state.d.ts.map +1 -1
  281. package/lib/plugin/workspace.d.ts +0 -1
  282. package/lib/plugin/workspace.d.ts.map +1 -1
  283. package/package.json +29 -29
  284. package/src/common/plugin-api-rpc-model.ts +11 -0
  285. package/src/common/plugin-api-rpc.ts +7 -5
  286. package/src/common/test-types.ts +15 -1
  287. package/src/main/browser/authentication-main.ts +24 -11
  288. package/src/main/browser/custom-editors/custom-editor-opener.tsx +19 -4
  289. package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +7 -3
  290. package/src/main/browser/editors-and-documents-main.ts +27 -2
  291. package/src/main/browser/menus/plugin-menu-command-adapter.ts +2 -2
  292. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +13 -9
  293. package/src/main/browser/notebooks/notebook-kernels-main.ts +2 -2
  294. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +170 -74
  295. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +237 -73
  296. package/src/main/browser/notebooks/renderers/webview-communication.ts +78 -7
  297. package/src/main/browser/plugin-ext-frontend-module.ts +6 -5
  298. package/src/main/browser/tabs/tabs-main.ts +6 -2
  299. package/src/main/browser/test-main.ts +4 -1
  300. package/src/main/browser/text-editor-main.ts +55 -14
  301. package/src/plugin/authentication-ext.ts +9 -5
  302. package/src/plugin/file-system-ext-impl.ts +7 -3
  303. package/src/plugin/notebook/notebooks.ts +22 -1
  304. package/src/plugin/plugin-context.ts +40 -15
  305. package/src/plugin/scm.ts +5 -4
  306. package/src/plugin/terminal-ext.ts +1 -0
  307. package/src/plugin/tests.ts +34 -3
  308. package/src/plugin/text-editor.ts +1 -1
  309. package/src/plugin/type-converters.ts +58 -6
  310. package/src/plugin/types-impl.ts +10 -1
@@ -19,34 +19,33 @@
19
19
  *--------------------------------------------------------------------------------------------*/
20
20
 
21
21
  import * as React from '@theia/core/shared/react';
22
- import { inject, injectable, interfaces, postConstruct } from '@theia/core/shared/inversify';
22
+ import { inject, injectable, interfaces } from '@theia/core/shared/inversify';
23
23
  import { generateUuid } from '@theia/core/lib/common/uuid';
24
24
  import {
25
25
  NotebookRendererMessagingService, CellOutputWebview, NotebookRendererRegistry,
26
- NotebookEditorWidgetService, NotebookCellOutputsSplice, NOTEBOOK_EDITOR_ID_PREFIX, NotebookKernelService, NotebookEditorWidget
26
+ NotebookEditorWidgetService, NotebookKernelService, NotebookEditorWidget,
27
+ OutputRenderEvent,
28
+ NotebookCellOutputsSplice,
29
+ NotebookContentChangedEvent
27
30
  } from '@theia/notebook/lib/browser';
28
- import { NotebookCellModel } from '@theia/notebook/lib/browser/view-model/notebook-cell-model';
29
31
  import { WebviewWidget } from '../../webview/webview';
30
32
  import { Message, WidgetManager } from '@theia/core/lib/browser';
31
33
  import { outputWebviewPreload, PreloadContext } from './output-webview-internal';
32
34
  import { WorkspaceTrustService } from '@theia/workspace/lib/browser';
33
- import { ChangePreferredMimetypeMessage, FromWebviewMessage, OutputChangedMessage } from './webview-communication';
34
- import { CellUri } from '@theia/notebook/lib/common';
35
- import { Disposable, DisposableCollection, nls, QuickPickService } from '@theia/core';
36
- import { NotebookCellOutputModel } from '@theia/notebook/lib/browser/view-model/notebook-cell-output-model';
35
+ import { CellsChangedMessage, CellsMoved, CellsSpliced, ChangePreferredMimetypeMessage, FromWebviewMessage, OutputChangedMessage } from './webview-communication';
36
+ import { Disposable, DisposableCollection, Emitter, QuickPickService, nls } from '@theia/core';
37
37
  import { NotebookModel } from '@theia/notebook/lib/browser/view-model/notebook-model';
38
38
  import { NotebookOptionsService, NotebookOutputOptions } from '@theia/notebook/lib/browser/service/notebook-options';
39
+ import { NotebookCellModel } from '@theia/notebook/lib/browser/view-model/notebook-cell-model';
40
+ import { NotebookCellsChangeType } from '@theia/notebook/lib/common';
41
+ import { NotebookCellOutputModel } from '@theia/notebook/lib/browser/view-model/notebook-cell-output-model';
39
42
 
40
- const CellModel = Symbol('CellModel');
41
- const Notebook = Symbol('NotebookModel');
42
43
  export const AdditionalNotebookCellOutputCss = Symbol('AdditionalNotebookCellOutputCss');
43
44
 
44
- export function createCellOutputWebviewContainer(ctx: interfaces.Container, cell: NotebookCellModel, notebook: NotebookModel): interfaces.Container {
45
+ export function createCellOutputWebviewContainer(ctx: interfaces.Container): interfaces.Container {
45
46
  const child = ctx.createChild();
46
- child.bind(CellModel).toConstantValue(cell);
47
- child.bind(Notebook).toConstantValue(notebook);
48
47
  child.bind(AdditionalNotebookCellOutputCss).toConstantValue(DEFAULT_NOTEBOOK_OUTPUT_CSS);
49
- child.bind(CellOutputWebviewImpl).toSelf().inSingletonScope();
48
+ child.bind(CellOutputWebviewImpl).toSelf();
50
49
  return child;
51
50
  }
52
51
 
@@ -191,18 +190,16 @@ tbody th {
191
190
  }
192
191
  `;
193
192
 
193
+ interface CellOutputUpdate extends NotebookCellOutputsSplice {
194
+ cellHandle: number
195
+ }
196
+
194
197
  @injectable()
195
198
  export class CellOutputWebviewImpl implements CellOutputWebview, Disposable {
196
199
 
197
200
  @inject(NotebookRendererMessagingService)
198
201
  protected readonly messagingService: NotebookRendererMessagingService;
199
202
 
200
- @inject(CellModel)
201
- protected readonly cell: NotebookCellModel;
202
-
203
- @inject(Notebook)
204
- protected readonly notebook: NotebookModel;
205
-
206
203
  @inject(WidgetManager)
207
204
  protected readonly widgetManager: WidgetManager;
208
205
 
@@ -227,36 +224,63 @@ export class CellOutputWebviewImpl implements CellOutputWebview, Disposable {
227
224
  @inject(NotebookOptionsService)
228
225
  protected readonly notebookOptionsService: NotebookOptionsService;
229
226
 
227
+ // returns the output Height
228
+ protected readonly onDidRenderOutputEmitter = new Emitter<OutputRenderEvent>();
229
+ readonly onDidRenderOutput = this.onDidRenderOutputEmitter.event;
230
+
231
+ protected notebook: NotebookModel;
232
+
230
233
  protected options: NotebookOutputOptions;
231
234
 
232
235
  readonly id = generateUuid();
233
236
 
234
237
  protected editor: NotebookEditorWidget | undefined;
235
238
 
236
- protected readonly elementRef = React.createRef<HTMLDivElement>();
237
- protected outputPresentationListeners: DisposableCollection = new DisposableCollection();
239
+ protected element?: HTMLDivElement; // React.createRef<HTMLDivElement>();
238
240
 
239
241
  protected webviewWidget: WebviewWidget;
240
242
 
241
243
  protected toDispose = new DisposableCollection();
242
244
 
243
- @postConstruct()
244
- protected async init(): Promise<void> {
245
- this.editor = this.notebookEditorWidgetService.getNotebookEditor(NOTEBOOK_EDITOR_ID_PREFIX + CellUri.parse(this.cell.uri)?.notebook);
245
+ protected isDisposed = false;
246
+
247
+ async init(notebook: NotebookModel, editor: NotebookEditorWidget): Promise<void> {
248
+ this.notebook = notebook;
249
+ this.editor = editor;
246
250
  this.options = this.notebookOptionsService.computeOutputOptions();
247
251
  this.toDispose.push(this.notebookOptionsService.onDidChangeOutputOptions(options => {
248
252
  this.options = options;
249
253
  this.updateStyles();
250
254
  }));
251
255
 
252
- this.toDispose.push(this.cell.onDidChangeOutputs(outputChange => this.updateOutput(outputChange)));
253
- this.toDispose.push(this.cell.onDidChangeOutputItems(output => {
254
- this.updateOutput({ start: this.cell.outputs.findIndex(o => o.outputId === output.outputId), deleteCount: 1, newOutputs: [output] });
255
- }));
256
+ this.webviewWidget = await this.widgetManager.getOrCreateWidget(WebviewWidget.FACTORY_ID, { id: this.id });
257
+ // this.webviewWidget.parent = this.editor ?? null;
258
+ this.webviewWidget.setContentOptions({
259
+ allowScripts: true,
260
+ // eslint-disable-next-line max-len
261
+ // list taken from https://github.com/microsoft/vscode/blob/a27099233b956dddc2536d4a0d714ab36266d897/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts#L762-L774
262
+ enableCommandUris: [
263
+ 'github-issues.authNow',
264
+ 'workbench.extensions.search',
265
+ 'workbench.action.openSettings',
266
+ '_notebook.selectKernel',
267
+ 'jupyter.viewOutput',
268
+ 'workbench.action.openLargeOutput',
269
+ 'cellOutput.enableScrolling',
270
+ ],
271
+ });
272
+ this.webviewWidget.setHTML(await this.createWebviewContent());
273
+
274
+ this.notebook.onDidAddOrRemoveCell(e => {
275
+ if (e.newCellIds) {
276
+ const newCells = e.newCellIds.map(id => this.notebook.cells.find(cell => cell.handle === id)).filter(cell => !!cell) as NotebookCellModel[];
277
+ newCells.forEach(cell => this.attachCellAndOutputListeners(cell));
278
+ }
279
+ });
280
+ this.notebook.cells.forEach(cell => this.attachCellAndOutputListeners(cell));
256
281
 
257
282
  if (this.editor) {
258
283
  this.toDispose.push(this.editor.onDidPostKernelMessage(message => {
259
- // console.log('from extension customKernelMessage ', JSON.stringify(message));
260
284
  this.webviewWidget.sendMessage({
261
285
  type: 'customKernelMessage',
262
286
  message
@@ -264,7 +288,6 @@ export class CellOutputWebviewImpl implements CellOutputWebview, Disposable {
264
288
  }));
265
289
 
266
290
  this.toDispose.push(this.editor.onPostRendererMessage(messageObj => {
267
- // console.log('from extension customRendererMessage ', JSON.stringify(messageObj));
268
291
  this.webviewWidget.sendMessage({
269
292
  type: 'customRendererMessage',
270
293
  ...messageObj
@@ -273,110 +296,184 @@ export class CellOutputWebviewImpl implements CellOutputWebview, Disposable {
273
296
 
274
297
  }
275
298
 
276
- this.webviewWidget = await this.widgetManager.getOrCreateWidget(WebviewWidget.FACTORY_ID, { id: this.id });
277
- this.webviewWidget.parent = this.editor ?? null;
278
- this.webviewWidget.setContentOptions({
279
- allowScripts: true,
280
- // eslint-disable-next-line max-len
281
- // list taken from https://github.com/microsoft/vscode/blob/a27099233b956dddc2536d4a0d714ab36266d897/src/vs/workbench/contrib/notebook/browser/view/renderers/backLayerWebView.ts#L762-L774
282
- enableCommandUris: [
283
- 'github-issues.authNow',
284
- 'workbench.extensions.search',
285
- 'workbench.action.openSettings',
286
- '_notebook.selectKernel',
287
- 'jupyter.viewOutput',
288
- 'workbench.action.openLargeOutput',
289
- 'cellOutput.enableScrolling',
290
- ],
291
- });
292
- this.webviewWidget.setHTML(await this.createWebviewContent());
293
-
294
299
  this.webviewWidget.onMessage((message: FromWebviewMessage) => {
295
300
  this.handleWebviewMessage(message);
296
301
  });
297
302
  }
298
303
 
304
+ attachCellAndOutputListeners(cell: NotebookCellModel): void {
305
+ this.toDispose.push(cell.onDidChangeOutputs(outputChange => this.updateOutputs([{
306
+ newOutputs: outputChange.newOutputs,
307
+ start: outputChange.start,
308
+ deleteCount: outputChange.deleteCount,
309
+ cellHandle: cell.handle
310
+ }])));
311
+ this.toDispose.push(cell.onDidChangeOutputItems(output => {
312
+ const oldOutputIndex = cell.outputs.findIndex(o => o.outputId === output.outputId);
313
+ this.updateOutputs([{
314
+ cellHandle: cell.handle,
315
+ newOutputs: [output],
316
+ start: oldOutputIndex,
317
+ deleteCount: 1
318
+ }]);
319
+ }));
320
+ this.toDispose.push(cell.onDidCellHeightChange(height => this.setCellHeight(cell, height)));
321
+ this.toDispose.push(cell.onDidChangeOutputVisibility(visible => {
322
+ this.webviewWidget.sendMessage({
323
+ type: 'outputVisibilityChanged',
324
+ cellHandle: cell.handle,
325
+ visible
326
+ });
327
+ }));
328
+ }
329
+
299
330
  render(): React.JSX.Element {
300
- return <div className='theia-notebook-cell-output-webview' ref={this.elementRef}></div>;
331
+ return <div className='theia-notebook-cell-output-webview' ref={element => {
332
+ if (element) {
333
+ this.element = element;
334
+ this.attachWebview();
335
+ }
336
+ }}></div>;
301
337
  }
302
338
 
303
339
  attachWebview(): void {
304
- if (this.elementRef.current) {
340
+ if (this.element) {
305
341
  this.webviewWidget.processMessage(new Message('before-attach'));
306
- this.elementRef.current.appendChild(this.webviewWidget.node);
342
+ this.element.appendChild(this.webviewWidget.node);
307
343
  this.webviewWidget.processMessage(new Message('after-attach'));
308
344
  this.webviewWidget.setIframeHeight(0);
309
345
  }
310
346
  }
311
347
 
312
348
  isAttached(): boolean {
313
- return this.elementRef.current?.contains(this.webviewWidget.node) ?? false;
349
+ return this.element?.contains(this.webviewWidget.node) ?? false;
314
350
  }
315
351
 
316
- updateOutput(update: NotebookCellOutputsSplice): void {
352
+ updateOutputs(updates: CellOutputUpdate[]): void {
317
353
  if (this.webviewWidget.isHidden) {
318
354
  this.webviewWidget.show();
319
355
  }
320
356
 
321
- this.outputPresentationListeners.dispose();
322
- this.outputPresentationListeners = new DisposableCollection();
323
- for (const output of this.cell.outputs) {
324
- this.outputPresentationListeners.push(output.onRequestOutputPresentationChange(() => this.requestOutputPresentationUpdate(output)));
325
- }
326
-
327
357
  const updateOutputMessage: OutputChangedMessage = {
328
358
  type: 'outputChanged',
329
- newOutputs: update.newOutputs.map(output => ({
330
- id: output.outputId,
331
- items: output.outputs.map(item => ({ mime: item.mime, data: item.data.buffer })),
332
- metadata: output.metadata
333
- })),
334
- deleteStart: update.start,
335
- deleteCount: update.deleteCount
359
+ changes: updates.map(update => ({
360
+ cellHandle: update.cellHandle,
361
+ newOutputs: update.newOutputs.map(output => ({
362
+ id: output.outputId,
363
+ items: output.outputs.map(item => ({ mime: item.mime, data: item.data.buffer })),
364
+ metadata: output.metadata
365
+ })),
366
+ start: update.start,
367
+ deleteCount: update.deleteCount
368
+ }))
336
369
  };
337
370
 
338
371
  this.webviewWidget.sendMessage(updateOutputMessage);
339
372
  }
340
373
 
341
- private async requestOutputPresentationUpdate(output: NotebookCellOutputModel): Promise<void> {
374
+ cellsChanged(cellEvents: NotebookContentChangedEvent[]): void {
375
+ const changes: Array<CellsMoved | CellsSpliced> = [];
376
+
377
+ for (const event of cellEvents) {
378
+ if (event.kind === NotebookCellsChangeType.Move) {
379
+ changes.push(...event.cells.map((cell, i) => ({
380
+ type: 'cellMoved',
381
+ cellHandle: event.cells[0].handle,
382
+ toIndex: event.newIdx + i,
383
+ } as CellsMoved)));
384
+ } else if (event.kind === NotebookCellsChangeType.ModelChange) {
385
+ changes.push(...event.changes.map(change => ({
386
+ type: 'cellsSpliced',
387
+ start: change.start,
388
+ deleteCount: change.deleteCount,
389
+ newCells: change.newItems.map(cell => cell.handle)
390
+ } as CellsSpliced)));
391
+ }
392
+ }
393
+
394
+ this.webviewWidget.sendMessage({
395
+ type: 'cellsChanged',
396
+ changes: changes.filter(e => e)
397
+ } as CellsChangedMessage);
398
+ }
399
+
400
+ setCellHeight(cell: NotebookCellModel, height: number): void {
401
+ if (!this.isDisposed) {
402
+ this.webviewWidget.sendMessage({
403
+ type: 'cellHeightUpdate',
404
+ cellHandle: cell.handle,
405
+ cellKind: cell.cellKind,
406
+ height
407
+ });
408
+ }
409
+ }
410
+
411
+ async requestOutputPresentationUpdate(cellHandle: number, output: NotebookCellOutputModel): Promise<void> {
342
412
  const selectedMime = await this.quickPickService.show(
343
413
  output.outputs.map(item => ({ label: item.mime })),
344
414
  { description: nls.localizeByDefault('Select mimetype to render for current output') });
345
415
  if (selectedMime) {
346
416
  this.webviewWidget.sendMessage({
347
417
  type: 'changePreferredMimetype',
418
+ cellHandle,
348
419
  outputId: output.outputId,
349
420
  mimeType: selectedMime.label
350
421
  } as ChangePreferredMimetypeMessage);
351
422
  }
352
423
  }
353
424
 
354
- private handleWebviewMessage(message: FromWebviewMessage): void {
425
+ protected handleWebviewMessage(message: FromWebviewMessage): void {
355
426
  if (!this.editor) {
356
427
  throw new Error('No editor found for cell output webview');
357
428
  }
358
429
 
359
430
  switch (message.type) {
360
431
  case 'initialized':
361
- this.updateOutput({ newOutputs: this.cell.outputs, start: 0, deleteCount: 0 });
432
+ this.updateOutputs(this.notebook.cells.map(cell => ({
433
+ cellHandle: cell.handle,
434
+ newOutputs: cell.outputs,
435
+ start: 0,
436
+ deleteCount: 0
437
+ })));
362
438
  this.updateStyles();
363
439
  break;
364
440
  case 'customRendererMessage':
365
- // console.log('from webview customRendererMessage ', message.rendererId, '', JSON.stringify(message.message));
366
441
  this.messagingService.getScoped(this.editor.id).postMessage(message.rendererId, message.message);
367
442
  break;
368
443
  case 'didRenderOutput':
369
- this.webviewWidget.setIframeHeight(message.contentHeight + 5);
444
+ this.webviewWidget.setIframeHeight(message.bodyHeight);
445
+ this.onDidRenderOutputEmitter.fire({
446
+ cellHandle: message.cellHandle,
447
+ outputId: message.outputId,
448
+ outputHeight: message.outputHeight
449
+ });
370
450
  break;
371
451
  case 'did-scroll-wheel':
372
452
  this.editor.node.getElementsByClassName('theia-notebook-viewport')[0].children[0].scrollBy(message.deltaX, message.deltaY);
373
453
  break;
374
454
  case 'customKernelMessage':
375
- // console.log('from webview customKernelMessage ', JSON.stringify(message.message));
376
455
  this.editor.recieveKernelMessage(message.message);
377
456
  break;
378
457
  case 'inputFocusChanged':
379
458
  this.editor?.outputInputFocusChanged(message.focused);
459
+ break;
460
+ case 'cellFocusChanged':
461
+ const selectedCell = this.notebook.getCellByHandle(message.cellHandle);
462
+ if (selectedCell) {
463
+ this.notebook.setSelectedCell(selectedCell);
464
+ }
465
+ break;
466
+ case 'cellHeightRequest':
467
+ const cellHeight = this.notebook.getCellByHandle(message.cellHandle)?.cellHeight ?? 0;
468
+ this.webviewWidget.sendMessage({
469
+ type: 'cellHeightUpdate',
470
+ cellHandle: message.cellHandle,
471
+ height: cellHeight
472
+ });
473
+ break;
474
+ case 'bodyHeightChange':
475
+ this.webviewWidget.setIframeHeight(message.height);
476
+ break;
380
477
  }
381
478
  }
382
479
 
@@ -445,8 +542,7 @@ export class CellOutputWebviewImpl implements CellOutputWebview, Disposable {
445
542
  }
446
543
 
447
544
  dispose(): void {
545
+ this.isDisposed = true;
448
546
  this.toDispose.dispose();
449
- this.outputPresentationListeners.dispose();
450
- this.webviewWidget.dispose();
451
547
  }
452
548
  }