@theia/plugin-ext 1.40.1 → 1.42.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 (311) hide show
  1. package/lib/common/collections.d.ts +4 -0
  2. package/lib/common/collections.d.ts.map +1 -1
  3. package/lib/common/collections.js +17 -1
  4. package/lib/common/collections.js.map +1 -1
  5. package/lib/common/errors.d.ts +14 -0
  6. package/lib/common/errors.d.ts.map +1 -1
  7. package/lib/common/errors.js +17 -1
  8. package/lib/common/errors.js.map +1 -1
  9. package/lib/common/plugin-api-rpc.d.ts +286 -6
  10. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  11. package/lib/common/plugin-api-rpc.js +20 -1
  12. package/lib/common/plugin-api-rpc.js.map +1 -1
  13. package/lib/common/plugin-protocol.d.ts +27 -5
  14. package/lib/common/plugin-protocol.d.ts.map +1 -1
  15. package/lib/common/plugin-protocol.js.map +1 -1
  16. package/lib/hosted/browser/hosted-plugin.d.ts +5 -2
  17. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  18. package/lib/hosted/browser/hosted-plugin.js +21 -12
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/node/hosted-plugin-deployer-handler.js +1 -1
  21. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  22. package/lib/hosted/node/plugin-reader.d.ts +1 -1
  23. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  24. package/lib/hosted/node/plugin-reader.js +1 -1
  25. package/lib/hosted/node/plugin-reader.js.map +1 -1
  26. package/lib/hosted/node/scanners/grammars-reader.d.ts +1 -1
  27. package/lib/hosted/node/scanners/grammars-reader.d.ts.map +1 -1
  28. package/lib/hosted/node/scanners/grammars-reader.js +5 -5
  29. package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
  30. package/lib/hosted/node/scanners/scanner-theia.d.ts +6 -6
  31. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  32. package/lib/hosted/node/scanners/scanner-theia.js +54 -41
  33. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  34. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts +1 -1
  35. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts.map +1 -1
  36. package/lib/main/browser/custom-editors/custom-editor-widget.js +1 -1
  37. package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
  38. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +1 -1
  39. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  40. package/lib/main/browser/custom-editors/custom-editors-main.js +1 -1
  41. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  42. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  43. package/lib/main/browser/editors-and-documents-main.js +1 -0
  44. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  45. package/lib/main/browser/languages-main.d.ts.map +1 -1
  46. package/lib/main/browser/languages-main.js +6 -4
  47. package/lib/main/browser/languages-main.js.map +1 -1
  48. package/lib/main/browser/main-context.d.ts.map +1 -1
  49. package/lib/main/browser/main-context.js +18 -0
  50. package/lib/main/browser/main-context.js.map +1 -1
  51. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  52. package/lib/main/browser/menus/menus-contribution-handler.js +6 -3
  53. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  54. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts +50 -0
  55. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -0
  56. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +189 -0
  57. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -0
  58. package/lib/main/browser/notebooks/notebook-documents-main.d.ts +22 -0
  59. package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -0
  60. package/lib/main/browser/notebooks/notebook-documents-main.js +133 -0
  61. package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -0
  62. package/lib/main/browser/notebooks/notebook-dto.d.ts +15 -0
  63. package/lib/main/browser/notebooks/notebook-dto.d.ts.map +1 -0
  64. package/lib/main/browser/notebooks/notebook-dto.js +138 -0
  65. package/lib/main/browser/notebooks/notebook-dto.js.map +1 -0
  66. package/lib/main/browser/notebooks/notebook-editors-main.d.ts +20 -0
  67. package/lib/main/browser/notebooks/notebook-editors-main.d.ts.map +1 -0
  68. package/lib/main/browser/notebooks/notebook-editors-main.js +58 -0
  69. package/lib/main/browser/notebooks/notebook-editors-main.js.map +1 -0
  70. package/lib/main/browser/notebooks/notebook-kernels-main.d.ts +42 -0
  71. package/lib/main/browser/notebooks/notebook-kernels-main.d.ts.map +1 -0
  72. package/lib/main/browser/notebooks/notebook-kernels-main.js +230 -0
  73. package/lib/main/browser/notebooks/notebook-kernels-main.js.map +1 -0
  74. package/lib/main/browser/notebooks/notebook-renderers-main.d.ts +12 -0
  75. package/lib/main/browser/notebooks/notebook-renderers-main.d.ts.map +1 -0
  76. package/lib/main/browser/notebooks/notebook-renderers-main.js +39 -0
  77. package/lib/main/browser/notebooks/notebook-renderers-main.js.map +1 -0
  78. package/lib/main/browser/notebooks/notebooks-main.d.ts +20 -0
  79. package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -0
  80. package/lib/main/browser/notebooks/notebooks-main.js +103 -0
  81. package/lib/main/browser/notebooks/notebooks-main.js.map +1 -0
  82. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts +35 -0
  83. package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -0
  84. package/lib/main/browser/notebooks/renderers/cell-output-webview.js +204 -0
  85. package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -0
  86. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts +13 -0
  87. package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -0
  88. package/lib/main/browser/notebooks/renderers/output-webview-internal.js +375 -0
  89. package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -0
  90. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts +52 -0
  91. package/lib/main/browser/notebooks/renderers/webview-communication.d.ts.map +1 -0
  92. package/{src/typings/index.d.ts → lib/main/browser/notebooks/renderers/webview-communication.js} +8 -11
  93. package/lib/main/browser/notebooks/renderers/webview-communication.js.map +1 -0
  94. package/lib/main/browser/plugin-contribution-handler.d.ts +3 -0
  95. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  96. package/lib/main/browser/plugin-contribution-handler.js +31 -3
  97. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  98. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  99. package/lib/main/browser/plugin-ext-frontend-module.js +3 -2
  100. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  101. package/lib/main/browser/plugin-icon-theme-service.d.ts.map +1 -1
  102. package/lib/main/browser/plugin-icon-theme-service.js +6 -0
  103. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  104. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  105. package/lib/main/browser/plugin-shared-style.js +2 -1
  106. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  107. package/lib/main/browser/tasks-main.js +2 -2
  108. package/lib/main/browser/tasks-main.js.map +1 -1
  109. package/lib/main/browser/terminal-main.d.ts +2 -2
  110. package/lib/main/browser/terminal-main.d.ts.map +1 -1
  111. package/lib/main/browser/terminal-main.js +4 -4
  112. package/lib/main/browser/terminal-main.js.map +1 -1
  113. package/lib/main/browser/view/tree-view-widget.d.ts +3 -1
  114. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  115. package/lib/main/browser/view/tree-view-widget.js +32 -1
  116. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  117. package/lib/main/browser/view/tree-views-main.d.ts +2 -1
  118. package/lib/main/browser/view/tree-views-main.d.ts.map +1 -1
  119. package/lib/main/browser/view/tree-views-main.js +10 -0
  120. package/lib/main/browser/view/tree-views-main.js.map +1 -1
  121. package/lib/main/browser/webview/webview.d.ts +1 -0
  122. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  123. package/lib/main/browser/webview/webview.js +5 -0
  124. package/lib/main/browser/webview/webview.js.map +1 -1
  125. package/lib/main/node/errors.spec.d.ts +2 -0
  126. package/lib/main/node/errors.spec.d.ts.map +1 -0
  127. package/lib/main/node/errors.spec.js +36 -0
  128. package/lib/main/node/errors.spec.js.map +1 -0
  129. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +5 -2
  130. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  131. package/lib/main/node/handlers/plugin-theia-directory-handler.js +14 -8
  132. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  133. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +2 -1
  134. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  135. package/lib/main/node/handlers/plugin-theia-file-handler.js +13 -5
  136. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  137. package/lib/main/node/paths/plugin-paths-service.d.ts.map +1 -1
  138. package/lib/main/node/paths/plugin-paths-service.js +4 -9
  139. package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
  140. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +8 -8
  141. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
  142. package/lib/main/node/plugin-deployer-entry-impl.d.ts +2 -2
  143. package/lib/main/node/plugin-deployer-entry-impl.d.ts.map +1 -1
  144. package/lib/main/node/plugin-deployer-entry-impl.js +9 -7
  145. package/lib/main/node/plugin-deployer-entry-impl.js.map +1 -1
  146. package/lib/main/node/plugin-deployer-impl.d.ts +2 -2
  147. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  148. package/lib/main/node/plugin-deployer-impl.js +16 -24
  149. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  150. package/lib/main/node/plugin-deployer-proxy-entry-impl.d.ts +2 -2
  151. package/lib/main/node/plugin-deployer-proxy-entry-impl.d.ts.map +1 -1
  152. package/lib/main/node/plugin-ext-backend-module.js +3 -3
  153. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  154. package/lib/main/node/plugin-github-resolver.d.ts.map +1 -1
  155. package/lib/main/node/plugin-github-resolver.js +14 -6
  156. package/lib/main/node/plugin-github-resolver.js.map +1 -1
  157. package/lib/main/node/plugin-http-resolver.d.ts.map +1 -1
  158. package/lib/main/node/plugin-http-resolver.js +14 -6
  159. package/lib/main/node/plugin-http-resolver.js.map +1 -1
  160. package/lib/main/node/{plugin-localization-backend-contribution.d.ts → plugin-localization-server.d.ts} +3 -3
  161. package/lib/main/node/plugin-localization-server.d.ts.map +1 -0
  162. package/lib/main/node/{plugin-localization-backend-contribution.js → plugin-localization-server.js} +8 -8
  163. package/lib/main/node/plugin-localization-server.js.map +1 -0
  164. package/lib/main/node/temp-dir-util.d.ts +1 -0
  165. package/lib/main/node/temp-dir-util.d.ts.map +1 -1
  166. package/lib/main/node/temp-dir-util.js +12 -3
  167. package/lib/main/node/temp-dir-util.js.map +1 -1
  168. package/lib/plugin/editors-and-documents.d.ts +1 -1
  169. package/lib/plugin/editors-and-documents.d.ts.map +1 -1
  170. package/lib/plugin/editors-and-documents.js +1 -1
  171. package/lib/plugin/editors-and-documents.js.map +1 -1
  172. package/lib/plugin/notebook/notebook-document.d.ts +62 -0
  173. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -0
  174. package/lib/plugin/notebook/notebook-document.js +373 -0
  175. package/lib/plugin/notebook/notebook-document.js.map +1 -0
  176. package/lib/plugin/notebook/notebook-documents.d.ts +17 -0
  177. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -0
  178. package/lib/plugin/notebook/notebook-documents.js +48 -0
  179. package/lib/plugin/notebook/notebook-documents.js.map +1 -0
  180. package/lib/plugin/notebook/notebook-editor.d.ts +21 -0
  181. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -0
  182. package/lib/plugin/notebook/notebook-editor.js +99 -0
  183. package/lib/plugin/notebook/notebook-editor.js.map +1 -0
  184. package/lib/plugin/notebook/notebook-editors.d.ts +14 -0
  185. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -0
  186. package/lib/plugin/notebook/notebook-editors.js +65 -0
  187. package/lib/plugin/notebook/notebook-editors.js.map +1 -0
  188. package/lib/plugin/notebook/notebook-kernels.d.ts +37 -0
  189. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -0
  190. package/lib/plugin/notebook/notebook-kernels.js +516 -0
  191. package/lib/plugin/notebook/notebook-kernels.js.map +1 -0
  192. package/lib/plugin/notebook/notebook-renderers.d.ts +14 -0
  193. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -0
  194. package/lib/plugin/notebook/notebook-renderers.js +63 -0
  195. package/lib/plugin/notebook/notebook-renderers.js.map +1 -0
  196. package/lib/plugin/notebook/notebooks.d.ts +57 -0
  197. package/lib/plugin/notebook/notebooks.d.ts.map +1 -0
  198. package/lib/plugin/notebook/notebooks.js +295 -0
  199. package/lib/plugin/notebook/notebooks.js.map +1 -0
  200. package/lib/plugin/plugin-context.d.ts +2 -2
  201. package/lib/plugin/plugin-context.d.ts.map +1 -1
  202. package/lib/plugin/plugin-context.js +80 -59
  203. package/lib/plugin/plugin-context.js.map +1 -1
  204. package/lib/plugin/plugin-manager.d.ts +2 -0
  205. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  206. package/lib/plugin/plugin-manager.js +9 -1
  207. package/lib/plugin/plugin-manager.js.map +1 -1
  208. package/lib/plugin/quick-open.d.ts.map +1 -1
  209. package/lib/plugin/quick-open.js +1 -0
  210. package/lib/plugin/quick-open.js.map +1 -1
  211. package/lib/plugin/stubs/tests-api.d.ts +1 -0
  212. package/lib/plugin/stubs/tests-api.d.ts.map +1 -1
  213. package/lib/plugin/stubs/tests-api.js +3 -1
  214. package/lib/plugin/stubs/tests-api.js.map +1 -1
  215. package/lib/plugin/tasks/task-provider.d.ts +2 -2
  216. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  217. package/lib/plugin/tasks/task-provider.js +7 -10
  218. package/lib/plugin/tasks/task-provider.js.map +1 -1
  219. package/lib/plugin/tasks/tasks.d.ts +3 -2
  220. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  221. package/lib/plugin/tasks/tasks.js +18 -13
  222. package/lib/plugin/tasks/tasks.js.map +1 -1
  223. package/lib/plugin/terminal-ext.d.ts +3 -0
  224. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  225. package/lib/plugin/terminal-ext.js +11 -1
  226. package/lib/plugin/terminal-ext.js.map +1 -1
  227. package/lib/plugin/tree/tree-views.d.ts +15 -5
  228. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  229. package/lib/plugin/tree/tree-views.js +52 -3
  230. package/lib/plugin/tree/tree-views.js.map +1 -1
  231. package/lib/plugin/type-converters.d.ts +60 -0
  232. package/lib/plugin/type-converters.d.ts.map +1 -1
  233. package/lib/plugin/type-converters.js +374 -14
  234. package/lib/plugin/type-converters.js.map +1 -1
  235. package/lib/plugin/types-impl.d.ts +68 -29
  236. package/lib/plugin/types-impl.d.ts.map +1 -1
  237. package/lib/plugin/types-impl.js +123 -44
  238. package/lib/plugin/types-impl.js.map +1 -1
  239. package/package.json +31 -29
  240. package/src/common/collections.ts +17 -0
  241. package/src/common/errors.ts +26 -0
  242. package/src/common/plugin-api-rpc.ts +340 -5
  243. package/src/common/plugin-protocol.ts +23 -5
  244. package/src/hosted/browser/hosted-plugin.ts +21 -14
  245. package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -1
  246. package/src/hosted/node/plugin-reader.ts +1 -1
  247. package/src/hosted/node/scanners/grammars-reader.ts +6 -5
  248. package/src/hosted/node/scanners/scanner-theia.ts +55 -41
  249. package/src/main/browser/custom-editors/custom-editor-widget.ts +1 -1
  250. package/src/main/browser/custom-editors/custom-editors-main.ts +1 -1
  251. package/src/main/browser/editors-and-documents-main.ts +1 -0
  252. package/src/main/browser/languages-main.ts +7 -4
  253. package/src/main/browser/main-context.ts +19 -0
  254. package/src/main/browser/menus/menus-contribution-handler.ts +7 -4
  255. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +238 -0
  256. package/src/main/browser/notebooks/notebook-documents-main.ts +166 -0
  257. package/src/main/browser/notebooks/notebook-dto.ts +141 -0
  258. package/src/main/browser/notebooks/notebook-editors-main.ts +70 -0
  259. package/src/main/browser/notebooks/notebook-kernels-main.ts +291 -0
  260. package/src/main/browser/notebooks/notebook-renderers-main.ts +47 -0
  261. package/src/main/browser/notebooks/notebooks-main.ts +124 -0
  262. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +198 -0
  263. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +476 -0
  264. package/src/main/browser/notebooks/renderers/webview-communication.ts +79 -0
  265. package/src/main/browser/plugin-contribution-handler.ts +36 -3
  266. package/src/main/browser/plugin-ext-frontend-module.ts +7 -3
  267. package/src/main/browser/plugin-icon-theme-service.ts +6 -0
  268. package/src/main/browser/plugin-shared-style.ts +2 -1
  269. package/src/main/browser/tasks-main.ts +4 -4
  270. package/src/main/browser/terminal-main.ts +5 -5
  271. package/src/main/browser/view/tree-view-widget.tsx +36 -2
  272. package/src/main/browser/view/tree-views-main.ts +8 -0
  273. package/src/main/browser/webview/webview.ts +6 -0
  274. package/src/main/node/errors.spec.ts +37 -0
  275. package/src/main/node/handlers/plugin-theia-directory-handler.ts +18 -8
  276. package/src/main/node/handlers/plugin-theia-file-handler.ts +18 -6
  277. package/src/main/node/paths/plugin-paths-service.ts +5 -10
  278. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +8 -8
  279. package/src/main/node/plugin-deployer-entry-impl.ts +9 -7
  280. package/src/main/node/plugin-deployer-impl.ts +20 -28
  281. package/src/main/node/plugin-deployer-proxy-entry-impl.ts +2 -2
  282. package/src/main/node/plugin-ext-backend-module.ts +3 -3
  283. package/src/main/node/plugin-github-resolver.ts +15 -8
  284. package/src/main/node/plugin-http-resolver.ts +15 -8
  285. package/src/main/node/{plugin-localization-backend-contribution.ts → plugin-localization-server.ts} +2 -2
  286. package/src/main/node/temp-dir-util.ts +11 -2
  287. package/src/plugin/editors-and-documents.ts +1 -1
  288. package/src/plugin/notebook/notebook-document.ts +438 -0
  289. package/src/plugin/notebook/notebook-documents.ts +58 -0
  290. package/src/plugin/notebook/notebook-editor.ts +116 -0
  291. package/src/plugin/notebook/notebook-editors.ts +71 -0
  292. package/src/plugin/notebook/notebook-kernels.ts +616 -0
  293. package/src/plugin/notebook/notebook-renderers.ts +72 -0
  294. package/src/plugin/notebook/notebooks.ts +385 -0
  295. package/src/plugin/plugin-context.ts +80 -71
  296. package/src/plugin/plugin-manager.ts +9 -1
  297. package/src/plugin/quick-open.ts +1 -0
  298. package/src/plugin/stubs/tests-api.ts +4 -0
  299. package/src/plugin/tasks/task-provider.ts +9 -12
  300. package/src/plugin/tasks/tasks.ts +18 -13
  301. package/src/plugin/terminal-ext.ts +13 -1
  302. package/src/plugin/tree/tree-views.ts +57 -7
  303. package/src/plugin/type-converters.ts +372 -13
  304. package/src/plugin/types-impl.ts +162 -58
  305. package/lib/main/browser/custom-editors/undo-redo-service.d.ts +0 -24
  306. package/lib/main/browser/custom-editors/undo-redo-service.d.ts.map +0 -1
  307. package/lib/main/browser/custom-editors/undo-redo-service.js +0 -111
  308. package/lib/main/browser/custom-editors/undo-redo-service.js.map +0 -1
  309. package/lib/main/node/plugin-localization-backend-contribution.d.ts.map +0 -1
  310. package/lib/main/node/plugin-localization-backend-contribution.js.map +0 -1
  311. package/src/main/browser/custom-editors/undo-redo-service.ts +0 -120
@@ -18,14 +18,14 @@
18
18
 
19
19
  import {
20
20
  TreeDataProvider, TreeView, TreeViewExpansionEvent, TreeItem, TreeItemLabel,
21
- TreeViewSelectionChangeEvent, TreeViewVisibilityChangeEvent, CancellationToken, DataTransferFile, TreeViewOptions, ViewBadge
21
+ TreeViewSelectionChangeEvent, TreeViewVisibilityChangeEvent, CancellationToken, DataTransferFile, TreeViewOptions, ViewBadge, TreeCheckboxChangeEvent
22
22
  } from '@theia/plugin';
23
23
  // TODO: extract `@theia/util` for event, disposable, cancellation and common types
24
24
  // don't use @theia/core directly from plugin host
25
25
  import { Emitter } from '@theia/core/lib/common/event';
26
26
  import { basename } from '@theia/core/lib/common/paths';
27
27
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
28
- import { DataTransfer, DataTransferItem, Disposable as PluginDisposable, ThemeIcon } from '../types-impl';
28
+ import { DataTransfer, DataTransferItem, Disposable as PluginDisposable, ThemeIcon, TreeItemCheckboxState } from '../types-impl';
29
29
  import { Plugin, PLUGIN_RPC_CONTEXT, TreeViewsExt, TreeViewsMain, TreeViewItem, TreeViewRevealOptions, DataTransferFileDTO } from '../../common/plugin-api-rpc';
30
30
  import { RPCProtocol } from '../../common/rpc-protocol';
31
31
  import { CommandRegistryImpl, CommandsConverter } from '../command-registry';
@@ -33,6 +33,7 @@ import { TreeViewItemReference } from '../../common';
33
33
  import { PluginIconPath } from '../plugin-icon-path';
34
34
  import { URI } from '@theia/core/shared/vscode-uri';
35
35
  import { UriComponents } from '@theia/core/lib/common/uri';
36
+ import { isObject } from '@theia/core';
36
37
 
37
38
  export class TreeViewsExtImpl implements TreeViewsExt {
38
39
  private proxy: TreeViewsMain;
@@ -54,6 +55,9 @@ export class TreeViewsExtImpl implements TreeViewsExt {
54
55
  }
55
56
  });
56
57
  }
58
+ $checkStateChanged(treeViewId: string, itemIds: { id: string; checked: boolean; }[]): Promise<void> {
59
+ return this.getTreeView(treeViewId).checkStateChanged(itemIds);
60
+ }
57
61
  $dragStarted(treeViewId: string, treeItemIds: string[], token: CancellationToken): Promise<UriComponents[] | undefined> {
58
62
  return this.getTreeView(treeViewId).onDragStarted(treeItemIds, token);
59
63
  }
@@ -107,6 +111,9 @@ export class TreeViewsExtImpl implements TreeViewsExt {
107
111
  get onDidChangeVisibility() {
108
112
  return treeView.onDidChangeVisibility;
109
113
  },
114
+ get onDidChangeCheckboxState() {
115
+ return treeView.onDidChangeCheckboxState;
116
+ },
110
117
  get message(): string {
111
118
  return treeView.message;
112
119
  },
@@ -211,6 +218,9 @@ class TreeViewExtImpl<T> implements Disposable {
211
218
  private readonly onDidChangeVisibilityEmitter = new Emitter<TreeViewVisibilityChangeEvent>();
212
219
  readonly onDidChangeVisibility = this.onDidChangeVisibilityEmitter.event;
213
220
 
221
+ private readonly onDidChangeCheckboxStateEmitter = new Emitter<TreeCheckboxChangeEvent<T>>();
222
+ readonly onDidChangeCheckboxState = this.onDidChangeCheckboxStateEmitter.event;
223
+
214
224
  private readonly nodes = new Map<string, TreeExtNode<T>>();
215
225
  private pendingRefresh = Promise.resolve();
216
226
 
@@ -234,7 +244,12 @@ class TreeViewExtImpl<T> implements Disposable {
234
244
  // make copies of optionally provided MIME types:
235
245
  const dragMimeTypes = options.dragAndDropController?.dragMimeTypes?.slice();
236
246
  const dropMimeTypes = options.dragAndDropController?.dropMimeTypes?.slice();
237
- proxy.$registerTreeDataProvider(treeViewId, { showCollapseAll: options.showCollapseAll, canSelectMany: options.canSelectMany, dragMimeTypes, dropMimeTypes });
247
+ proxy.$registerTreeDataProvider(treeViewId, {
248
+ manageCheckboxStateManually: options.manageCheckboxStateManually,
249
+ showCollapseAll: options.showCollapseAll,
250
+ canSelectMany: options.canSelectMany,
251
+ dragMimeTypes, dropMimeTypes
252
+ });
238
253
  this.toDispose.push(Disposable.create(() => this.proxy.$unregisterTreeDataProvider(treeViewId)));
239
254
  options.treeDataProvider.onDidChangeTreeData?.(() => {
240
255
  this.pendingRefresh = proxy.$refresh(treeViewId);
@@ -399,7 +414,7 @@ class TreeViewExtImpl<T> implements Disposable {
399
414
  const treeItem = await this.options.treeDataProvider.getTreeItem(value);
400
415
  // Convert theia.TreeItem to the TreeViewItem
401
416
 
402
- const label = this.getItemLabel(treeItem);
417
+ const label = this.getItemLabel(treeItem) || '';
403
418
  const highlights = this.getTreeItemLabelHighlights(treeItem);
404
419
 
405
420
  // Generate the ID
@@ -433,7 +448,22 @@ class TreeViewExtImpl<T> implements Disposable {
433
448
  iconUrl = PluginIconPath.toUrl(<PluginIconPath | undefined>iconPath, this.plugin);
434
449
  }
435
450
 
436
- const treeViewItem = {
451
+ let checkboxInfo;
452
+ if (treeItem.checkboxState === undefined) {
453
+ checkboxInfo = undefined;
454
+ } else if (isObject(treeItem.checkboxState)) {
455
+ checkboxInfo = {
456
+ checked: treeItem.checkboxState.state === TreeItemCheckboxState.Checked,
457
+ tooltip: treeItem.checkboxState.tooltip,
458
+ accessibilityInformation: treeItem.accessibilityInformation
459
+ };
460
+ } else {
461
+ checkboxInfo = {
462
+ checked: treeItem.checkboxState === TreeItemCheckboxState.Checked
463
+ };
464
+ }
465
+
466
+ const treeViewItem: TreeViewItem = {
437
467
  id,
438
468
  label,
439
469
  highlights,
@@ -443,11 +473,12 @@ class TreeViewExtImpl<T> implements Disposable {
443
473
  description: treeItem.description,
444
474
  resourceUri: treeItem.resourceUri,
445
475
  tooltip: treeItem.tooltip,
446
- collapsibleState: treeItem.collapsibleState,
476
+ collapsibleState: treeItem.collapsibleState?.valueOf(),
477
+ checkboxInfo: checkboxInfo,
447
478
  contextValue: treeItem.contextValue,
448
479
  command: this.commandsConverter.toSafeCommand(treeItem.command, toDisposeElement),
449
480
  accessibilityInformation: treeItem.accessibilityInformation
450
- } as TreeViewItem;
481
+ };
451
482
  node.treeViewItem = treeViewItem;
452
483
 
453
484
  return treeViewItem;
@@ -511,6 +542,25 @@ class TreeViewExtImpl<T> implements Disposable {
511
542
  }
512
543
  }
513
544
 
545
+ async checkStateChanged(items: readonly { id: string; checked: boolean; }[]): Promise<void> {
546
+ const transformed: [T, TreeItemCheckboxState][] = [];
547
+ items.forEach(item => {
548
+ const node = this.nodes.get(item.id);
549
+ if (node) {
550
+ if (node.value) {
551
+ transformed.push([node.value, item.checked ? TreeItemCheckboxState.Checked : TreeItemCheckboxState.Unchecked]);
552
+ }
553
+ if (node.treeViewItem) {
554
+ node.treeViewItem.checkboxInfo!.checked = item.checked;
555
+ }
556
+ }
557
+ });
558
+
559
+ this.onDidChangeCheckboxStateEmitter.fire({
560
+ items: transformed
561
+ });
562
+ }
563
+
514
564
  async resolveTreeItem(treeItemId: string, token: CancellationToken): Promise<TreeViewItem | undefined> {
515
565
  if (!this.options.treeDataProvider.resolveTreeItem) {
516
566
  return undefined;
@@ -28,7 +28,12 @@ import * as types from './types-impl';
28
28
  import { UriComponents } from '../common/uri-components';
29
29
  import { isReadonlyArray } from '../common/arrays';
30
30
  import { MarkdownString as MarkdownStringDTO } from '@theia/core/lib/common/markdown-rendering';
31
- import { isObject } from '@theia/core/lib/common';
31
+ import { DisposableCollection, isEmptyObject, isObject } from '@theia/core/lib/common';
32
+ import * as notebooks from '@theia/notebook/lib/common';
33
+ import { CommandsConverter } from './command-registry';
34
+ import { BinaryBuffer } from '@theia/core/lib/common/buffer';
35
+ import { CellData, CellExecutionUpdateType, CellOutput, CellOutputItem, CellRange, isTextStreamMime } from '@theia/notebook/lib/common';
36
+ import { CellExecuteUpdate, CellExecutionComplete } from '@theia/notebook/lib/browser';
32
37
 
33
38
  const SIDE_GROUP = -2;
34
39
  const ACTIVE_GROUP = -1;
@@ -201,6 +206,16 @@ export function fromMarkdown(markup: theia.MarkdownString | theia.MarkedString):
201
206
  }
202
207
  }
203
208
 
209
+ export function fromMarkdownOrString(value: string | theia.MarkdownString | undefined): string | MarkdownStringDTO | undefined {
210
+ if (value === undefined) {
211
+ return undefined;
212
+ } else if (typeof value === 'string') {
213
+ return value;
214
+ } else {
215
+ return fromMarkdown(value);
216
+ }
217
+ }
218
+
204
219
  export function toMarkdown(value: MarkdownStringDTO): PluginMarkdownStringImpl {
205
220
  const implemented = new PluginMarkdownStringImpl(value.value, value.supportThemeIcons);
206
221
  implemented.isTrusted = value.isTrusted;
@@ -571,26 +586,46 @@ export function fromWorkspaceEdit(value: theia.WorkspaceEdit, documents?: any):
571
586
  edits: []
572
587
  };
573
588
  for (const entry of (value as types.WorkspaceEdit)._allEntries()) {
574
- const [uri, uriOrEdits] = entry;
575
- if (Array.isArray(uriOrEdits)) {
589
+ if (entry?._type === types.FileEditType.Text) {
576
590
  // text edits
577
- const doc = documents ? documents.getDocument(uri.toString()) : undefined;
591
+ const doc = documents ? documents.getDocument(entry.uri.toString()) : undefined;
578
592
  const workspaceTextEditDto: WorkspaceTextEditDto = {
579
- resource: uri,
593
+ resource: entry.uri,
580
594
  modelVersionId: doc?.version,
581
- textEdit: uriOrEdits.map(edit => (edit instanceof types.TextEdit) ? fromTextEdit(edit) : fromSnippetTextEdit(edit))[0],
582
- metadata: entry[2] as types.WorkspaceEditMetadata
595
+ textEdit: (entry.edit instanceof types.TextEdit) ? fromTextEdit(entry.edit) : fromSnippetTextEdit(entry.edit),
596
+ metadata: entry.metadata
583
597
  };
584
598
  result.edits.push(workspaceTextEditDto);
585
- } else {
599
+ } else if (entry?._type === types.FileEditType.File) {
586
600
  // resource edits
587
601
  const workspaceFileEditDto: WorkspaceFileEditDto = {
588
- oldResource: uri,
589
- newResource: uriOrEdits,
590
- options: entry[2] as types.FileOperationOptions,
591
- metadata: entry[3]
602
+ oldResource: entry.from,
603
+ newResource: entry.to,
604
+ options: entry.options,
605
+ metadata: entry.metadata
592
606
  };
593
607
  result.edits.push(workspaceFileEditDto);
608
+ } else if (entry?._type === types.FileEditType.Cell) {
609
+ // cell edit
610
+ if (entry.edit) {
611
+ result.edits.push({
612
+ metadata: entry.metadata,
613
+ resource: entry.uri,
614
+ cellEdit: entry.edit,
615
+ });
616
+ }
617
+ } else if (entry?._type === types.FileEditType.CellReplace) {
618
+ // cell replace
619
+ result.edits.push({
620
+ metadata: entry.metadata,
621
+ resource: entry.uri,
622
+ cellEdit: {
623
+ editType: notebooks.CellEditType.Replace,
624
+ index: entry.index,
625
+ count: entry.count,
626
+ cells: entry.cells.map(NotebookCellData.from)
627
+ }
628
+ });
594
629
  }
595
630
  }
596
631
  return result;
@@ -1177,11 +1212,12 @@ export function convertToTransferQuickPickItems(items: rpc.Item[]): rpc.Transfer
1177
1212
  } else if (item.kind === QuickPickItemKind.Separator) {
1178
1213
  return { type: 'separator', label: item.label, handle: index };
1179
1214
  } else {
1180
- const { label, description, detail, picked, alwaysShow, buttons } = item;
1215
+ const { label, description, iconPath, detail, picked, alwaysShow, buttons } = item;
1181
1216
  return {
1182
1217
  type: 'item',
1183
1218
  label,
1184
1219
  description,
1220
+ iconPath,
1185
1221
  detail,
1186
1222
  picked,
1187
1223
  alwaysShow,
@@ -1387,3 +1423,326 @@ export namespace DataTransfer {
1387
1423
  return dataTransfer;
1388
1424
  }
1389
1425
  }
1426
+
1427
+ export namespace NotebookDocumentContentOptions {
1428
+ export function from(options: theia.NotebookDocumentContentOptions | undefined): notebooks.TransientOptions {
1429
+ return {
1430
+ transientOutputs: options?.transientOutputs ?? false,
1431
+ transientCellMetadata: options?.transientCellMetadata ?? {},
1432
+ transientDocumentMetadata: options?.transientDocumentMetadata ?? {},
1433
+ };
1434
+ }
1435
+ }
1436
+
1437
+ export namespace NotebookStatusBarItem {
1438
+ export function from(item: theia.NotebookCellStatusBarItem, commandsConverter: CommandsConverter, disposables: DisposableCollection): notebooks.NotebookCellStatusBarItem {
1439
+ const command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;
1440
+ return {
1441
+ alignment: item.alignment === types.NotebookCellStatusBarAlignment.Left ? notebooks.CellStatusbarAlignment.Left : notebooks.CellStatusbarAlignment.Right,
1442
+ command: commandsConverter.toSafeCommand(command, disposables),
1443
+ text: item.text,
1444
+ tooltip: item.tooltip,
1445
+ priority: item.priority
1446
+ };
1447
+ }
1448
+ }
1449
+
1450
+ export namespace NotebookData {
1451
+
1452
+ export function from(data: theia.NotebookData): rpc.NotebookDataDto {
1453
+ const res: rpc.NotebookDataDto = {
1454
+ metadata: data.metadata ?? Object.create(null),
1455
+ cells: [],
1456
+ };
1457
+ for (const cell of data.cells) {
1458
+ // types.NotebookCellData.validate(cell);
1459
+ res.cells.push(NotebookCellData.from(cell));
1460
+ }
1461
+ return res;
1462
+ }
1463
+
1464
+ export function to(data: rpc.NotebookDataDto): theia.NotebookData {
1465
+ const res = new types.NotebookData(
1466
+ data.cells.map(NotebookCellData.to),
1467
+ );
1468
+ if (!isEmptyObject(data.metadata)) {
1469
+ res.metadata = data.metadata;
1470
+ }
1471
+ return res;
1472
+ }
1473
+ }
1474
+
1475
+ export namespace NotebookCellData {
1476
+
1477
+ export function from(data: theia.NotebookCellData): rpc.NotebookCellDataDto {
1478
+ return {
1479
+ cellKind: NotebookCellKind.from(data.kind),
1480
+ language: data.languageId,
1481
+ source: data.value,
1482
+ // metadata: data.metadata,
1483
+ // internalMetadata: NotebookCellExecutionSummary.from(data.executionSummary ?? {}),
1484
+ outputs: data.outputs ? data.outputs.map(NotebookCellOutputConverter.from) : []
1485
+ };
1486
+ }
1487
+
1488
+ export function to(data: rpc.NotebookCellDataDto): theia.NotebookCellData {
1489
+ return new types.NotebookCellData(
1490
+ NotebookCellKind.to(data.cellKind),
1491
+ data.source,
1492
+ data.language,
1493
+ data.outputs ? data.outputs.map(NotebookCellOutput.to) : undefined,
1494
+ data.metadata,
1495
+ data.internalMetadata ? NotebookCellExecutionSummary.to(data.internalMetadata) : undefined
1496
+ );
1497
+ }
1498
+ }
1499
+
1500
+ export namespace NotebookCellKind {
1501
+ export function from(data: theia.NotebookCellKind): notebooks.CellKind {
1502
+ switch (data) {
1503
+ case types.NotebookCellKind.Markup:
1504
+ return notebooks.CellKind.Markup;
1505
+ case types.NotebookCellKind.Code:
1506
+ default:
1507
+ return notebooks.CellKind.Code;
1508
+ }
1509
+ }
1510
+
1511
+ export function to(data: notebooks.CellKind): theia.NotebookCellKind {
1512
+ switch (data) {
1513
+ case notebooks.CellKind.Markup:
1514
+ return types.NotebookCellKind.Markup;
1515
+ case notebooks.CellKind.Code:
1516
+ default:
1517
+ return types.NotebookCellKind.Code;
1518
+ }
1519
+ }
1520
+ }
1521
+
1522
+ export namespace NotebookCellOutput {
1523
+ export function from(output: theia.NotebookCellOutput & { outputId: string }): rpc.NotebookOutputDto {
1524
+ return {
1525
+ outputId: output.outputId,
1526
+ items: output.items.map(NotebookCellOutputItem.from),
1527
+ metadata: output.metadata
1528
+ };
1529
+ }
1530
+
1531
+ export function to(output: rpc.NotebookOutputDto): theia.NotebookCellOutput {
1532
+ const items = output.items.map(NotebookCellOutputItem.to);
1533
+ return new types.NotebookCellOutput(items, output.outputId, output.metadata);
1534
+ }
1535
+ }
1536
+
1537
+ export namespace NotebookCellOutputItem {
1538
+ export function from(item: types.NotebookCellOutputItem): rpc.NotebookOutputItemDto {
1539
+ return {
1540
+ mime: item.mime,
1541
+ valueBytes: BinaryBuffer.wrap(item.data),
1542
+ };
1543
+ }
1544
+
1545
+ export function to(item: rpc.NotebookOutputItemDto): types.NotebookCellOutputItem {
1546
+ return new types.NotebookCellOutputItem(item.valueBytes.buffer, item.mime);
1547
+ }
1548
+ }
1549
+
1550
+ export namespace NotebookCellOutputConverter {
1551
+ export function from(output: types.NotebookCellOutput): rpc.NotebookOutputDto {
1552
+ return {
1553
+ outputId: output.outputId,
1554
+ items: output.items.map(NotebookCellOutputItem.from),
1555
+ metadata: output.metadata
1556
+ };
1557
+ }
1558
+
1559
+ export function to(output: rpc.NotebookOutputDto): types.NotebookCellOutput {
1560
+ const items = output.items.map(NotebookCellOutputItem.to);
1561
+ return new types.NotebookCellOutput(items, output.outputId, output.metadata);
1562
+ }
1563
+
1564
+ export function ensureUniqueMimeTypes(items: types.NotebookCellOutputItem[], warn: boolean = false): types.NotebookCellOutputItem[] {
1565
+ const seen = new Set<string>();
1566
+ const removeIdx = new Set<number>();
1567
+ for (let i = 0; i < items.length; i++) {
1568
+ const item = items[i];
1569
+ // We can have multiple text stream mime types in the same output.
1570
+ if (!seen.has(item.mime) || isTextStreamMime(item.mime)) {
1571
+ seen.add(item.mime);
1572
+ continue;
1573
+ }
1574
+ // duplicated mime types... first has won
1575
+ removeIdx.add(i);
1576
+ if (warn) {
1577
+ console.warn(`DUPLICATED mime type '${item.mime}' will be dropped`);
1578
+ }
1579
+ }
1580
+ if (removeIdx.size === 0) {
1581
+ return items;
1582
+ }
1583
+ return items.filter((_, index) => !removeIdx.has(index));
1584
+ }
1585
+ }
1586
+
1587
+ export namespace NotebookCellExecutionSummary {
1588
+ export function to(data: notebooks.NotebookCellInternalMetadata): theia.NotebookCellExecutionSummary {
1589
+ return {
1590
+ timing: typeof data.runStartTime === 'number' && typeof data.runEndTime === 'number' ? { startTime: data.runStartTime, endTime: data.runEndTime } : undefined,
1591
+ executionOrder: data.executionOrder,
1592
+ success: data.lastRunSuccess
1593
+ };
1594
+ }
1595
+
1596
+ export function from(data: theia.NotebookCellExecutionSummary): Partial<notebooks.NotebookCellInternalMetadata> {
1597
+ return {
1598
+ lastRunSuccess: data.success,
1599
+ runStartTime: data.timing?.startTime,
1600
+ runEndTime: data.timing?.endTime,
1601
+ executionOrder: data.executionOrder
1602
+ };
1603
+ }
1604
+ }
1605
+
1606
+ export namespace NotebookRange {
1607
+
1608
+ export function from(range: theia.NotebookRange): CellRange {
1609
+ return { start: range.start, end: range.end };
1610
+ }
1611
+
1612
+ export function to(range: CellRange): types.NotebookRange {
1613
+ return new types.NotebookRange(range.start, range.end);
1614
+ }
1615
+ }
1616
+
1617
+ export namespace NotebookKernelSourceAction {
1618
+ export function from(item: theia.NotebookKernelSourceAction, commandsConverter: CommandsConverter, disposables: DisposableCollection): rpc.NotebookKernelSourceActionDto {
1619
+ const command = typeof item.command === 'string' ? { title: '', command: item.command } : item.command;
1620
+
1621
+ return {
1622
+ command: commandsConverter.toSafeCommand(command, disposables),
1623
+ label: item.label,
1624
+ description: item.description,
1625
+ detail: item.detail,
1626
+ documentation: item.documentation
1627
+ };
1628
+ }
1629
+ }
1630
+
1631
+ export namespace NotebookDto {
1632
+
1633
+ export function toNotebookOutputItemDto(item: CellOutputItem): rpc.NotebookOutputItemDto {
1634
+ return {
1635
+ mime: item.mime,
1636
+ valueBytes: item.data
1637
+ };
1638
+ }
1639
+
1640
+ export function toNotebookOutputDto(output: CellOutput): rpc.NotebookOutputDto {
1641
+ return {
1642
+ outputId: output.outputId,
1643
+ metadata: output.metadata,
1644
+ items: output.outputs.map(toNotebookOutputItemDto)
1645
+ };
1646
+ }
1647
+
1648
+ export function toNotebookCellDataDto(cell: CellData): rpc.NotebookCellDataDto {
1649
+ return {
1650
+ cellKind: cell.cellKind,
1651
+ language: cell.language,
1652
+ source: cell.source,
1653
+ internalMetadata: cell.internalMetadata,
1654
+ metadata: cell.metadata,
1655
+ outputs: cell.outputs.map(toNotebookOutputDto)
1656
+ };
1657
+ }
1658
+
1659
+ // export function toNotebookDataDto(data: NotebookData): rpc.NotebookDataDto {
1660
+ // return {
1661
+ // metadata: data.metadata,
1662
+ // cells: data.cells.map(toNotebookCellDataDto)
1663
+ // };
1664
+ // }
1665
+
1666
+ export function fromNotebookOutputItemDto(item: rpc.NotebookOutputItemDto): CellOutputItem {
1667
+ return {
1668
+ mime: item.mime,
1669
+ data: item.valueBytes
1670
+ };
1671
+ }
1672
+
1673
+ export function fromNotebookOutputDto(output: rpc.NotebookOutputDto): CellOutput {
1674
+ return {
1675
+ outputId: output.outputId,
1676
+ metadata: output.metadata,
1677
+ outputs: output.items.map(fromNotebookOutputItemDto)
1678
+ };
1679
+ }
1680
+
1681
+ export function fromNotebookCellDataDto(cell: rpc.NotebookCellDataDto): CellData {
1682
+ return {
1683
+ cellKind: cell.cellKind,
1684
+ language: cell.language,
1685
+ source: cell.source,
1686
+ outputs: cell.outputs.map(fromNotebookOutputDto),
1687
+ metadata: cell.metadata,
1688
+ internalMetadata: cell.internalMetadata
1689
+ };
1690
+ }
1691
+
1692
+ // export function fromNotebookDataDto(data: rpc.NotebookDataDto): NotebookData {
1693
+ // return {
1694
+ // metadata: data.metadata,
1695
+ // cells: data.cells.map(fromNotebookCellDataDto)
1696
+ // };
1697
+ // }
1698
+
1699
+ // export function toNotebookCellDto(cell: Cell): rpc.NotebookCellDto {
1700
+ // return {
1701
+ // handle: cell.handle,
1702
+ // uri: cell.uri,
1703
+ // source: cell.textBuffer.getLinesContent(),
1704
+ // eol: cell.textBuffer.getEOL(),
1705
+ // language: cell.language,
1706
+ // cellKind: cell.cellKind,
1707
+ // outputs: cell.outputs.map(toNotebookOutputDto),
1708
+ // metadata: cell.metadata,
1709
+ // internalMetadata: cell.internalMetadata,
1710
+ // };
1711
+ // }
1712
+
1713
+ export function fromCellExecuteUpdateDto(data: rpc.CellExecuteUpdateDto): CellExecuteUpdate {
1714
+ if (data.editType === CellExecutionUpdateType.Output) {
1715
+ return {
1716
+ editType: data.editType,
1717
+ cellHandle: data.cellHandle,
1718
+ append: data.append,
1719
+ outputs: data.outputs.map(fromNotebookOutputDto)
1720
+ };
1721
+ } else if (data.editType === CellExecutionUpdateType.OutputItems) {
1722
+ return {
1723
+ editType: data.editType,
1724
+ append: data.append,
1725
+ items: data.items.map(fromNotebookOutputItemDto)
1726
+ };
1727
+ } else {
1728
+ return data;
1729
+ }
1730
+ }
1731
+
1732
+ export function fromCellExecuteCompleteDto(data: rpc.CellExecutionCompleteDto): CellExecutionComplete {
1733
+ return data;
1734
+ }
1735
+
1736
+ // export function fromCellEditOperationDto(edit: rpc.CellEditOperationDto): CellEditOperation {
1737
+ // if (edit.editType === CellEditType.Replace) {
1738
+ // return {
1739
+ // editType: edit.editType,
1740
+ // index: edit.index,
1741
+ // count: edit.count,
1742
+ // cells: edit.cells.map(fromNotebookCellDataDto)
1743
+ // };
1744
+ // } else {
1745
+ // return edit;
1746
+ // }
1747
+ // }
1748
+ }