@theia/plugin-ext 1.40.1 → 1.41.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 (292) 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-github-resolver.d.ts.map +1 -1
  153. package/lib/main/node/plugin-github-resolver.js +14 -6
  154. package/lib/main/node/plugin-github-resolver.js.map +1 -1
  155. package/lib/main/node/plugin-http-resolver.d.ts.map +1 -1
  156. package/lib/main/node/plugin-http-resolver.js +14 -6
  157. package/lib/main/node/plugin-http-resolver.js.map +1 -1
  158. package/lib/main/node/temp-dir-util.d.ts +1 -0
  159. package/lib/main/node/temp-dir-util.d.ts.map +1 -1
  160. package/lib/main/node/temp-dir-util.js +12 -3
  161. package/lib/main/node/temp-dir-util.js.map +1 -1
  162. package/lib/plugin/editors-and-documents.d.ts +1 -1
  163. package/lib/plugin/editors-and-documents.d.ts.map +1 -1
  164. package/lib/plugin/editors-and-documents.js +1 -1
  165. package/lib/plugin/editors-and-documents.js.map +1 -1
  166. package/lib/plugin/notebook/notebook-document.d.ts +62 -0
  167. package/lib/plugin/notebook/notebook-document.d.ts.map +1 -0
  168. package/lib/plugin/notebook/notebook-document.js +373 -0
  169. package/lib/plugin/notebook/notebook-document.js.map +1 -0
  170. package/lib/plugin/notebook/notebook-documents.d.ts +17 -0
  171. package/lib/plugin/notebook/notebook-documents.d.ts.map +1 -0
  172. package/lib/plugin/notebook/notebook-documents.js +48 -0
  173. package/lib/plugin/notebook/notebook-documents.js.map +1 -0
  174. package/lib/plugin/notebook/notebook-editor.d.ts +21 -0
  175. package/lib/plugin/notebook/notebook-editor.d.ts.map +1 -0
  176. package/lib/plugin/notebook/notebook-editor.js +99 -0
  177. package/lib/plugin/notebook/notebook-editor.js.map +1 -0
  178. package/lib/plugin/notebook/notebook-editors.d.ts +14 -0
  179. package/lib/plugin/notebook/notebook-editors.d.ts.map +1 -0
  180. package/lib/plugin/notebook/notebook-editors.js +65 -0
  181. package/lib/plugin/notebook/notebook-editors.js.map +1 -0
  182. package/lib/plugin/notebook/notebook-kernels.d.ts +37 -0
  183. package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -0
  184. package/lib/plugin/notebook/notebook-kernels.js +516 -0
  185. package/lib/plugin/notebook/notebook-kernels.js.map +1 -0
  186. package/lib/plugin/notebook/notebook-renderers.d.ts +14 -0
  187. package/lib/plugin/notebook/notebook-renderers.d.ts.map +1 -0
  188. package/lib/plugin/notebook/notebook-renderers.js +63 -0
  189. package/lib/plugin/notebook/notebook-renderers.js.map +1 -0
  190. package/lib/plugin/notebook/notebooks.d.ts +57 -0
  191. package/lib/plugin/notebook/notebooks.d.ts.map +1 -0
  192. package/lib/plugin/notebook/notebooks.js +295 -0
  193. package/lib/plugin/notebook/notebooks.js.map +1 -0
  194. package/lib/plugin/plugin-context.d.ts +2 -2
  195. package/lib/plugin/plugin-context.d.ts.map +1 -1
  196. package/lib/plugin/plugin-context.js +79 -59
  197. package/lib/plugin/plugin-context.js.map +1 -1
  198. package/lib/plugin/plugin-manager.d.ts +2 -0
  199. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  200. package/lib/plugin/plugin-manager.js +9 -1
  201. package/lib/plugin/plugin-manager.js.map +1 -1
  202. package/lib/plugin/tasks/task-provider.d.ts +2 -2
  203. package/lib/plugin/tasks/task-provider.d.ts.map +1 -1
  204. package/lib/plugin/tasks/task-provider.js +7 -10
  205. package/lib/plugin/tasks/task-provider.js.map +1 -1
  206. package/lib/plugin/tasks/tasks.d.ts +3 -2
  207. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  208. package/lib/plugin/tasks/tasks.js +18 -13
  209. package/lib/plugin/tasks/tasks.js.map +1 -1
  210. package/lib/plugin/terminal-ext.d.ts +3 -0
  211. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  212. package/lib/plugin/terminal-ext.js +11 -1
  213. package/lib/plugin/terminal-ext.js.map +1 -1
  214. package/lib/plugin/tree/tree-views.d.ts +15 -5
  215. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  216. package/lib/plugin/tree/tree-views.js +52 -3
  217. package/lib/plugin/tree/tree-views.js.map +1 -1
  218. package/lib/plugin/type-converters.d.ts +60 -0
  219. package/lib/plugin/type-converters.d.ts.map +1 -1
  220. package/lib/plugin/type-converters.js +372 -13
  221. package/lib/plugin/type-converters.js.map +1 -1
  222. package/lib/plugin/types-impl.d.ts +68 -29
  223. package/lib/plugin/types-impl.d.ts.map +1 -1
  224. package/lib/plugin/types-impl.js +123 -44
  225. package/lib/plugin/types-impl.js.map +1 -1
  226. package/package.json +31 -29
  227. package/src/common/collections.ts +17 -0
  228. package/src/common/errors.ts +26 -0
  229. package/src/common/plugin-api-rpc.ts +340 -5
  230. package/src/common/plugin-protocol.ts +23 -5
  231. package/src/hosted/browser/hosted-plugin.ts +21 -14
  232. package/src/hosted/node/hosted-plugin-deployer-handler.ts +1 -1
  233. package/src/hosted/node/plugin-reader.ts +1 -1
  234. package/src/hosted/node/scanners/grammars-reader.ts +6 -5
  235. package/src/hosted/node/scanners/scanner-theia.ts +55 -41
  236. package/src/main/browser/custom-editors/custom-editor-widget.ts +1 -1
  237. package/src/main/browser/custom-editors/custom-editors-main.ts +1 -1
  238. package/src/main/browser/editors-and-documents-main.ts +1 -0
  239. package/src/main/browser/languages-main.ts +7 -4
  240. package/src/main/browser/main-context.ts +19 -0
  241. package/src/main/browser/menus/menus-contribution-handler.ts +7 -4
  242. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +238 -0
  243. package/src/main/browser/notebooks/notebook-documents-main.ts +166 -0
  244. package/src/main/browser/notebooks/notebook-dto.ts +141 -0
  245. package/src/main/browser/notebooks/notebook-editors-main.ts +70 -0
  246. package/src/main/browser/notebooks/notebook-kernels-main.ts +291 -0
  247. package/src/main/browser/notebooks/notebook-renderers-main.ts +47 -0
  248. package/src/main/browser/notebooks/notebooks-main.ts +124 -0
  249. package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +198 -0
  250. package/src/main/browser/notebooks/renderers/output-webview-internal.ts +476 -0
  251. package/src/main/browser/notebooks/renderers/webview-communication.ts +79 -0
  252. package/src/main/browser/plugin-contribution-handler.ts +36 -3
  253. package/src/main/browser/plugin-ext-frontend-module.ts +7 -3
  254. package/src/main/browser/plugin-icon-theme-service.ts +6 -0
  255. package/src/main/browser/plugin-shared-style.ts +2 -1
  256. package/src/main/browser/tasks-main.ts +4 -4
  257. package/src/main/browser/terminal-main.ts +5 -5
  258. package/src/main/browser/view/tree-view-widget.tsx +36 -2
  259. package/src/main/browser/view/tree-views-main.ts +8 -0
  260. package/src/main/browser/webview/webview.ts +6 -0
  261. package/src/main/node/errors.spec.ts +37 -0
  262. package/src/main/node/handlers/plugin-theia-directory-handler.ts +18 -8
  263. package/src/main/node/handlers/plugin-theia-file-handler.ts +18 -6
  264. package/src/main/node/paths/plugin-paths-service.ts +5 -10
  265. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +8 -8
  266. package/src/main/node/plugin-deployer-entry-impl.ts +9 -7
  267. package/src/main/node/plugin-deployer-impl.ts +20 -28
  268. package/src/main/node/plugin-deployer-proxy-entry-impl.ts +2 -2
  269. package/src/main/node/plugin-github-resolver.ts +15 -8
  270. package/src/main/node/plugin-http-resolver.ts +15 -8
  271. package/src/main/node/temp-dir-util.ts +11 -2
  272. package/src/plugin/editors-and-documents.ts +1 -1
  273. package/src/plugin/notebook/notebook-document.ts +438 -0
  274. package/src/plugin/notebook/notebook-documents.ts +58 -0
  275. package/src/plugin/notebook/notebook-editor.ts +116 -0
  276. package/src/plugin/notebook/notebook-editors.ts +71 -0
  277. package/src/plugin/notebook/notebook-kernels.ts +616 -0
  278. package/src/plugin/notebook/notebook-renderers.ts +72 -0
  279. package/src/plugin/notebook/notebooks.ts +385 -0
  280. package/src/plugin/plugin-context.ts +77 -70
  281. package/src/plugin/plugin-manager.ts +9 -1
  282. package/src/plugin/tasks/task-provider.ts +9 -12
  283. package/src/plugin/tasks/tasks.ts +18 -13
  284. package/src/plugin/terminal-ext.ts +13 -1
  285. package/src/plugin/tree/tree-views.ts +57 -7
  286. package/src/plugin/type-converters.ts +370 -12
  287. package/src/plugin/types-impl.ts +162 -58
  288. package/lib/main/browser/custom-editors/undo-redo-service.d.ts +0 -24
  289. package/lib/main/browser/custom-editors/undo-redo-service.d.ts.map +0 -1
  290. package/lib/main/browser/custom-editors/undo-redo-service.js +0 -111
  291. package/lib/main/browser/custom-editors/undo-redo-service.js.map +0 -1
  292. package/src/main/browser/custom-editors/undo-redo-service.ts +0 -120
@@ -98,6 +98,7 @@ import {
98
98
  DataTransfer,
99
99
  TreeItem,
100
100
  TreeItemCollapsibleState,
101
+ TreeItemCheckboxState,
101
102
  DocumentSymbol,
102
103
  SymbolTag,
103
104
  WorkspaceEdit,
@@ -165,8 +166,8 @@ import {
165
166
  InlayHintKind,
166
167
  InlayHintLabelPart,
167
168
  TelemetryTrustedValue,
168
- NotebookCell,
169
169
  NotebookCellKind,
170
+ NotebookCellExecutionState,
170
171
  NotebookCellStatusBarAlignment,
171
172
  NotebookEditorRevealType,
172
173
  NotebookControllerAffinity,
@@ -174,10 +175,11 @@ import {
174
175
  NotebookCellOutput,
175
176
  NotebookCellOutputItem,
176
177
  NotebookData,
177
- NotebookDocument,
178
178
  NotebookRange,
179
179
  NotebookCellStatusBarItem,
180
180
  NotebookEdit,
181
+ NotebookKernelSourceAction,
182
+ NotebookRendererScript,
181
183
  TestRunProfileKind,
182
184
  TestTag,
183
185
  TestRunRequest,
@@ -242,7 +244,13 @@ import { Endpoint } from '@theia/core/lib/browser/endpoint';
242
244
  import { FilePermission } from '@theia/filesystem/lib/common/files';
243
245
  import { TabsExtImpl } from './tabs';
244
246
  import { LocalizationExtImpl } from './localization-ext';
247
+ import { NotebooksExtImpl } from './notebook/notebooks';
245
248
  import { TelemetryExtImpl } from './telemetry-ext';
249
+ import { NotebookDocument } from './notebook/notebook-document';
250
+ import { NotebookRenderersExtImpl } from './notebook/notebook-renderers';
251
+ import { NotebookKernelsExtImpl } from './notebook/notebook-kernels';
252
+ import { NotebookDocumentsExtImpl } from './notebook/notebook-documents';
253
+ import { NotebookEditorsExtImpl } from './notebook/notebook-editors';
246
254
 
247
255
  export function createAPIFactory(
248
256
  rpc: RPCProtocol,
@@ -266,6 +274,11 @@ export function createAPIFactory(
266
274
  const notificationExt = rpc.set(MAIN_RPC_CONTEXT.NOTIFICATION_EXT, new NotificationExtImpl(rpc));
267
275
  const editors = rpc.set(MAIN_RPC_CONTEXT.TEXT_EDITORS_EXT, new TextEditorsExtImpl(rpc, editorsAndDocumentsExt));
268
276
  const documents = rpc.set(MAIN_RPC_CONTEXT.DOCUMENTS_EXT, new DocumentsExtImpl(rpc, editorsAndDocumentsExt));
277
+ const notebooksExt = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOKS_EXT, new NotebooksExtImpl(rpc, commandRegistry, editorsAndDocumentsExt, documents));
278
+ const notebookEditors = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_EDITORS_EXT, new NotebookEditorsExtImpl(notebooksExt));
279
+ const notebookRenderers = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_RENDERERS_EXT, new NotebookRenderersExtImpl(rpc, notebooksExt));
280
+ const notebookKernels = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_KERNELS_EXT, new NotebookKernelsExtImpl(rpc, notebooksExt, commandRegistry));
281
+ const notebookDocuments = rpc.set(MAIN_RPC_CONTEXT.NOTEBOOK_DOCUMENTS_EXT, new NotebookDocumentsExtImpl(notebooksExt));
269
282
  const statusBarMessageRegistryExt = new StatusBarMessageRegistryExt(rpc);
270
283
  const terminalExt = rpc.set(MAIN_RPC_CONTEXT.TERMINAL_EXT, new TerminalServiceExtImpl(rpc));
271
284
  const outputChannelRegistryExt = rpc.set(MAIN_RPC_CONTEXT.OUTPUT_CHANNEL_REGISTRY_EXT, new OutputChannelRegistryExtImpl(rpc));
@@ -427,24 +440,24 @@ export function createAPIFactory(
427
440
  }
428
441
  },
429
442
  get visibleNotebookEditors(): theia.NotebookEditor[] {
430
- return [] as theia.NotebookEditor[];
443
+ return notebooksExt.visibleApiNotebookEditors;
431
444
  },
432
445
  onDidChangeVisibleNotebookEditors(listener, thisArg?, disposables?) {
433
- return Disposable.NULL;
446
+ return notebooksExt.onDidChangeVisibleNotebookEditors(listener, thisArg, disposables);
434
447
  },
435
448
  get activeNotebookEditor(): theia.NotebookEditor | undefined {
436
- return undefined;
449
+ return notebooksExt.activeApiNotebookEditor;
437
450
  }, onDidChangeActiveNotebookEditor(listener, thisArg?, disposables?) {
438
- return Disposable.NULL;
451
+ return notebooksExt.onDidChangeActiveNotebookEditor(listener, thisArg, disposables);
439
452
  },
440
453
  onDidChangeNotebookEditorSelection(listener, thisArg?, disposables?) {
441
- return Disposable.NULL;
454
+ return notebookEditors.onDidChangeNotebookEditorSelection(listener, thisArg, disposables);
442
455
  },
443
456
  onDidChangeNotebookEditorVisibleRanges(listener, thisArg?, disposables?) {
444
- return Disposable.NULL;
457
+ return notebookEditors.onDidChangeNotebookEditorVisibleRanges(listener, thisArg, disposables);
445
458
  },
446
- showNotebookDocument(document: NotebookDocument, options?: theia.NotebookDocumentShowOptions) {
447
- return Promise.resolve({} as theia.NotebookEditor);
459
+ showNotebookDocument(document: theia.NotebookDocument, options?: theia.NotebookDocumentShowOptions) {
460
+ return notebooksExt.showNotebookDocument(document, options);
448
461
  },
449
462
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
450
463
  showQuickPick(items: any, options?: theia.QuickPickOptions, token?: theia.CancellationToken): any {
@@ -616,7 +629,7 @@ export function createAPIFactory(
616
629
  return workspaceExt.onDidChangeWorkspaceFolders(listener, thisArg, disposables);
617
630
  },
618
631
  get notebookDocuments(): theia.NotebookDocument[] {
619
- return [] as theia.NotebookDocument[];
632
+ return notebooksExt.getAllApiDocuments();
620
633
  },
621
634
  get textDocuments(): theia.TextDocument[] {
622
635
  return documents.getAllDocumentData().map(data => data.document);
@@ -628,19 +641,19 @@ export function createAPIFactory(
628
641
  return documents.onDidRemoveDocument(listener, thisArg, disposables);
629
642
  },
630
643
  onDidOpenNotebookDocument(listener, thisArg?, disposables?) {
631
- return Disposable.NULL;
644
+ return notebooksExt.onDidOpenNotebookDocument(listener, thisArg, disposables);
632
645
  },
633
646
  onDidCloseNotebookDocument(listener, thisArg?, disposables?) {
634
- return Disposable.NULL;
635
- },
636
- onDidChangeNotebookDocument(listener, thisArg?, disposables?) {
637
- return Disposable.NULL;
647
+ return notebooksExt.onDidCloseNotebookDocument(listener, thisArg, disposables);
638
648
  },
639
649
  onWillSaveNotebookDocument(listener, thisArg?, disposables?) {
640
650
  return Disposable.NULL;
641
651
  },
642
- onDidSaveNotebookDocument(listener, thisArg?, disposables?) {
643
- return Disposable.NULL;
652
+ onDidSaveNotebookDocument(listener, thisArg, disposables) {
653
+ return notebookDocuments.onDidSaveNotebookDocument(listener, thisArg, disposables);
654
+ },
655
+ onDidChangeNotebookDocument(listener, thisArg, disposables) {
656
+ return notebookDocuments.onDidChangeNotebookDocument(listener, thisArg, disposables);
644
657
  },
645
658
  onDidOpenTextDocument(listener, thisArg?, disposables?) {
646
659
  return documents.onDidAddDocument(listener, thisArg, disposables);
@@ -686,8 +699,18 @@ export function createAPIFactory(
686
699
  const data = await documents.openDocument(uri);
687
700
  return data && data.document;
688
701
  },
689
- openNotebookDocument(uriOrString: theia.Uri | string, content?: NotebookData): Promise<theia.NotebookDocument | undefined> {
690
- return Promise.reject(new Error('Notebook API is stubbed'));
702
+ async openNotebookDocument(uriOrType: theia.Uri | string, content?: NotebookData): Promise<theia.NotebookDocument | undefined> {
703
+ let uri: URI;
704
+ if (URI.isUri(uriOrType)) {
705
+ uri = uriOrType;
706
+ await notebooksExt.openNotebookDocument(uriOrType as URI);
707
+ } else if (typeof uriOrType === 'string') {
708
+ uri = URI.revive(await notebooksExt.createNotebookDocument({ viewType: uriOrType, content }));
709
+ } else {
710
+ throw new Error('Invalid arguments');
711
+ }
712
+ return notebooksExt.getNotebookDocument(uri).apiNotebook;
713
+
691
714
  },
692
715
  createFileSystemWatcher: (pattern, ignoreCreate, ignoreChange, ignoreDelete): theia.FileSystemWatcher =>
693
716
  extHostFileSystemEvent.createFileSystemWatcher(fromGlobPattern(pattern), ignoreCreate, ignoreChange, ignoreDelete),
@@ -729,7 +752,7 @@ export function createAPIFactory(
729
752
  return timelineExt.registerTimelineProvider(plugin, scheme, provider);
730
753
  },
731
754
  registerNotebookSerializer(notebookType: string, serializer: theia.NotebookSerializer, options?: theia.NotebookDocumentContentOptions): theia.Disposable {
732
- return Disposable.NULL;
755
+ return notebooksExt.registerNotebookSerializer(plugin, notebookType, serializer, options);
733
756
  },
734
757
  get isTrusted(): boolean {
735
758
  return workspaceExt.trusted;
@@ -1156,54 +1179,27 @@ export function createAPIFactory(
1156
1179
  label,
1157
1180
  handler?: (cells: theia.NotebookCell[],
1158
1181
  notebook: theia.NotebookDocument,
1159
- controller: theia.NotebookController) => void | Thenable<void>
1182
+ controller: theia.NotebookController) => void | Thenable<void>,
1183
+ rendererScripts?: NotebookRendererScript[]
1160
1184
  ) {
1161
- return {
1162
- id,
1163
- notebookType,
1164
- label,
1165
- handler,
1166
- createNotebookCellExecution: (cell: NotebookCell) => ({
1167
- cell,
1168
- token: CancellationToken.None,
1169
- executionOrder: undefined,
1170
- start: () => undefined,
1171
- end: () => undefined,
1172
- clearOutput: () => ({} as Thenable<void>),
1173
- replaceOutput: () => ({} as Thenable<void>),
1174
- appendOutput: () => ({} as Thenable<void>),
1175
- replaceOutputItems: () => ({} as Thenable<void>),
1176
- appendOutputItems: () => ({} as Thenable<void>)
1177
- }),
1178
- executeHandler(
1179
- cells: theia.NotebookCell[],
1180
- notebook: theia.NotebookDocument,
1181
- controller: theia.NotebookController
1182
- ): (void | Thenable<void>) { },
1183
- onDidChangeSelectedNotebooks: () => Disposable.create(() => { }),
1184
- updateNotebookAffinity: (notebook: theia.NotebookDocument, affinity: theia.NotebookControllerAffinity) => undefined,
1185
- dispose: () => undefined,
1186
- };
1187
-
1185
+ return notebookKernels.createNotebookController(plugin.model.id, id, notebookType, label, handler, rendererScripts);
1188
1186
  },
1189
- createRendererMessaging(
1190
- rendererId
1191
- ) {
1192
- return {
1193
- rendererId,
1194
- onDidReceiveMessage: () => Disposable.create(() => { }),
1195
- postMessage: () => Promise.resolve({}),
1196
- };
1187
+ createRendererMessaging(rendererId) {
1188
+ return notebookRenderers.createRendererMessaging(rendererId);
1197
1189
  },
1198
1190
  registerNotebookCellStatusBarItemProvider(
1199
1191
  notebookType,
1200
1192
  provider
1201
1193
  ) {
1202
- return {
1203
- notebookType,
1204
- provider,
1205
- dispose: () => undefined,
1206
- };
1194
+ return notebooksExt.registerNotebookCellStatusBarItemProvider(notebookType, provider);
1195
+ },
1196
+ onDidChangeNotebookCellExecutionState: notebookKernels.onDidChangeNotebookCellExecutionState,
1197
+
1198
+ createNotebookControllerDetectionTask(notebookType: string) {
1199
+ return notebookKernels.createNotebookControllerDetectionTask(notebookType);
1200
+ },
1201
+ registerKernelSourceActionProvider(notebookType: string, provider: theia.NotebookKernelSourceActionProvider) {
1202
+ return notebookKernels.registerKernelSourceActionProvider(notebookType, provider);
1207
1203
  }
1208
1204
  };
1209
1205
 
@@ -1291,6 +1287,7 @@ export function createAPIFactory(
1291
1287
  DataTransfer,
1292
1288
  TreeItem,
1293
1289
  TreeItemCollapsibleState,
1290
+ TreeItemCheckboxState,
1294
1291
  SymbolKind,
1295
1292
  SymbolTag,
1296
1293
  DocumentSymbol,
@@ -1357,6 +1354,7 @@ export function createAPIFactory(
1357
1354
  InlayHintLabelPart,
1358
1355
  TelemetryTrustedValue,
1359
1356
  NotebookCellData,
1357
+ NotebookCellExecutionState,
1360
1358
  NotebookCellKind,
1361
1359
  NotebookCellOutput,
1362
1360
  NotebookCellOutputItem,
@@ -1368,6 +1366,8 @@ export function createAPIFactory(
1368
1366
  NotebookDocument,
1369
1367
  NotebookRange,
1370
1368
  NotebookEdit,
1369
+ NotebookKernelSourceAction,
1370
+ NotebookRendererScript,
1371
1371
  TestRunProfileKind,
1372
1372
  TestTag,
1373
1373
  TestRunRequest,
@@ -1420,6 +1420,8 @@ export interface ExtensionPlugin<T> extends theia.Plugin<T> {
1420
1420
  }
1421
1421
 
1422
1422
  export class Plugin<T> implements theia.Plugin<T> {
1423
+ #pluginManager: PluginManager;
1424
+
1423
1425
  id: string;
1424
1426
  pluginPath: string;
1425
1427
  pluginUri: theia.Uri;
@@ -1427,7 +1429,9 @@ export class Plugin<T> implements theia.Plugin<T> {
1427
1429
  packageJSON: any;
1428
1430
  pluginType: theia.PluginType;
1429
1431
 
1430
- constructor(protected readonly pluginManager: PluginManager, plugin: InternalPlugin) {
1432
+ constructor(pluginManager: PluginManager, plugin: InternalPlugin) {
1433
+ this.#pluginManager = pluginManager;
1434
+
1431
1435
  this.id = plugin.model.id;
1432
1436
  this.pluginPath = plugin.pluginFolder;
1433
1437
  this.packageJSON = plugin.rawModel;
@@ -1442,26 +1446,29 @@ export class Plugin<T> implements theia.Plugin<T> {
1442
1446
  }
1443
1447
 
1444
1448
  get isActive(): boolean {
1445
- return this.pluginManager.isActive(this.id);
1449
+ return this.#pluginManager.isActive(this.id);
1446
1450
  }
1447
1451
 
1448
1452
  get exports(): T {
1449
- return <T>this.pluginManager.getPluginExport(this.id);
1453
+ return <T>this.#pluginManager.getPluginExport(this.id);
1450
1454
  }
1451
1455
 
1452
1456
  activate(): PromiseLike<T> {
1453
- return this.pluginManager.activatePlugin(this.id).then(() => this.exports);
1457
+ return this.#pluginManager.activatePlugin(this.id).then(() => this.exports);
1454
1458
  }
1455
1459
  }
1456
1460
 
1457
1461
  export class PluginExt<T> extends Plugin<T> implements ExtensionPlugin<T> {
1462
+ #pluginManager: PluginManager;
1463
+
1458
1464
  extensionPath: string;
1459
1465
  extensionUri: theia.Uri;
1460
1466
  extensionKind: ExtensionKind;
1461
1467
  isFromDifferentExtensionHost: boolean;
1462
1468
 
1463
- constructor(protected override readonly pluginManager: PluginManager, plugin: InternalPlugin, isFromDifferentExtensionHost = false) {
1469
+ constructor(pluginManager: PluginManager, plugin: InternalPlugin, isFromDifferentExtensionHost = false) {
1464
1470
  super(pluginManager, plugin);
1471
+ this.#pluginManager = pluginManager;
1465
1472
 
1466
1473
  this.extensionPath = this.pluginPath;
1467
1474
  this.extensionUri = this.pluginUri;
@@ -1470,14 +1477,14 @@ export class PluginExt<T> extends Plugin<T> implements ExtensionPlugin<T> {
1470
1477
  }
1471
1478
 
1472
1479
  override get isActive(): boolean {
1473
- return this.pluginManager.isActive(this.id);
1480
+ return this.#pluginManager.isActive(this.id);
1474
1481
  }
1475
1482
 
1476
1483
  override get exports(): T {
1477
- return <T>this.pluginManager.getPluginExport(this.id);
1484
+ return <T>this.#pluginManager.getPluginExport(this.id);
1478
1485
  }
1479
1486
 
1480
1487
  override activate(): PromiseLike<T> {
1481
- return this.pluginManager.activatePlugin(this.id).then(() => this.exports);
1488
+ return this.#pluginManager.activatePlugin(this.id).then(() => this.exports);
1482
1489
  }
1483
1490
  }
@@ -43,6 +43,7 @@ import { WebviewsExtImpl } from './webviews';
43
43
  import { URI as Uri } from './types-impl';
44
44
  import { SecretsExtImpl, SecretStorageExt } from '../plugin/secrets-ext';
45
45
  import { PluginExt } from './plugin-context';
46
+ import { Deferred } from '@theia/core/lib/common/promise-util';
46
47
 
47
48
  export interface PluginHost {
48
49
 
@@ -96,7 +97,9 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
96
97
  'onFileSystem',
97
98
  'onCustomEditor',
98
99
  'onStartupFinished',
99
- 'onAuthenticationRequest'
100
+ 'onAuthenticationRequest',
101
+ 'onNotebook',
102
+ 'onNotebookSerializer'
100
103
  ]);
101
104
 
102
105
  private configStorage: ConfigStorage | undefined;
@@ -115,6 +118,7 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
115
118
  }
116
119
 
117
120
  protected jsonValidation: PluginJsonValidationContribution[] = [];
121
+ protected ready = new Deferred();
118
122
 
119
123
  constructor(
120
124
  private readonly host: PluginHost,
@@ -230,6 +234,8 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
230
234
  this.registerPlugin(plugin);
231
235
  }
232
236
 
237
+ // ensure plugins are registered before running activation events
238
+ this.ready.resolve();
233
239
  // run eager plugins
234
240
  await this.$activateByEvent('*');
235
241
  for (const activationEvent of params.activationEvents) {
@@ -333,6 +339,8 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
333
339
  }
334
340
 
335
341
  async $activateByEvent(activationEvent: string): Promise<void> {
342
+ // Prevent the plugin manager from performing activations before plugins are registered
343
+ await this.ready.promise;
336
344
  if (activationEvent.endsWith(':*')) {
337
345
  const baseEvent = activationEvent.substring(0, activationEvent.length - 2);
338
346
  await this.activateByBaseEvent(baseEvent);
@@ -15,17 +15,17 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as theia from '@theia/plugin';
18
- import * as Converter from '../type-converters';
19
18
  import { TaskDto } from '../../common';
19
+ import * as Converter from '../type-converters';
20
20
 
21
21
  export class TaskProviderAdapter {
22
22
 
23
23
  constructor(private readonly provider: theia.TaskProvider) { }
24
24
 
25
- provideTasks(token: theia.CancellationToken): Promise<TaskDto[] | undefined> {
25
+ provideTasks(token: theia.CancellationToken): Promise<TaskDto[]> {
26
26
  return Promise.resolve(this.provider.provideTasks(token)).then(tasks => {
27
27
  if (!Array.isArray(tasks)) {
28
- return undefined;
28
+ return [];
29
29
  }
30
30
  const result: TaskDto[] = [];
31
31
  for (const task of tasks) {
@@ -40,21 +40,18 @@ export class TaskProviderAdapter {
40
40
  });
41
41
  }
42
42
 
43
- resolveTask(task: TaskDto, token: theia.CancellationToken): Promise<TaskDto | undefined> {
43
+ async resolveTask(task: TaskDto, token: theia.CancellationToken): Promise<TaskDto> {
44
44
  if (typeof this.provider.resolveTask !== 'function') {
45
- return Promise.resolve(undefined);
45
+ return task;
46
46
  }
47
47
 
48
48
  const item = Converter.toTask(task);
49
49
  if (!item) {
50
- return Promise.resolve(undefined);
50
+ return task;
51
51
  }
52
52
 
53
- return Promise.resolve(this.provider.resolveTask(item, token)).then(value => {
54
- if (value) {
55
- return Converter.fromTask(value);
56
- }
57
- return undefined;
58
- });
53
+ const resolved = await this.provider.resolveTask(item, token);
54
+ const converted = resolved ? Converter.fromTask(resolved) : Converter.fromTask(item);
55
+ return converted ?? task;
59
56
  }
60
57
  }
@@ -158,37 +158,42 @@ export class TasksExtImpl implements TasksExt {
158
158
  throw new Error('Task was not successfully transformed into a task config');
159
159
  }
160
160
 
161
- $provideTasks(handle: number): Promise<TaskDto[] | undefined> {
161
+ async $provideTasks(handle: number): Promise<TaskDto[]> {
162
162
  const adapter = this.adaptersMap.get(handle);
163
163
  if (adapter) {
164
164
  return adapter.provideTasks(CancellationToken.None).then(tasks => {
165
- if (tasks) {
166
- for (const task of tasks) {
167
- if (task.taskType === 'customExecution') {
168
- task.executionId = this.addCustomExecution(task.callback);
169
- task.callback = undefined;
170
- }
165
+ for (const task of tasks) {
166
+ if (task.taskType === 'customExecution') {
167
+ this.applyCustomExecution(task);
171
168
  }
172
169
  }
173
170
  return tasks;
174
171
  });
175
172
  } else {
176
- return Promise.reject(new Error('No adapter found to provide tasks'));
173
+ throw new Error('No adapter found to provide tasks');
177
174
  }
178
175
  }
179
176
 
180
- $resolveTask(handle: number, task: TaskDto, token: theia.CancellationToken): Promise<TaskDto | undefined> {
177
+ async $resolveTask(handle: number, task: TaskDto, token: theia.CancellationToken): Promise<TaskDto> {
181
178
  const adapter = this.adaptersMap.get(handle);
182
179
  if (adapter) {
183
180
  return adapter.resolveTask(task, token).then(resolvedTask => {
184
- if (resolvedTask && resolvedTask.taskType === 'customExecution') {
185
- resolvedTask.executionId = this.addCustomExecution(resolvedTask.callback);
186
- resolvedTask.callback = undefined;
181
+ // ensure we do not lose task type and execution id during resolution as we need it for custom execution
182
+ resolvedTask.taskType = resolvedTask.taskType ?? task.taskType;
183
+ if (resolvedTask.taskType === 'customExecution') {
184
+ this.applyCustomExecution(resolvedTask);
187
185
  }
188
186
  return resolvedTask;
189
187
  });
190
188
  } else {
191
- return Promise.reject(new Error('No adapter found to resolve task'));
189
+ throw new Error('No adapter found to resolve task');
190
+ }
191
+ }
192
+
193
+ private applyCustomExecution(task: TaskDto): void {
194
+ if (task.callback) {
195
+ task.executionId = this.addCustomExecution(task.callback);
196
+ task.callback = undefined;
192
197
  }
193
198
  }
194
199
 
@@ -20,6 +20,7 @@ import { RPCProtocol } from '../common/rpc-protocol';
20
20
  import { Event, Emitter } from '@theia/core/lib/common/event';
21
21
  import { Deferred } from '@theia/core/lib/common/promise-util';
22
22
  import * as theia from '@theia/plugin';
23
+ import * as Converter from './type-converters';
23
24
  import { Disposable, EnvironmentVariableMutatorType, TerminalExitReason, ThemeIcon } from './types-impl';
24
25
  import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
25
26
  import { ProvidedTerminalLink } from '../common/plugin-api-rpc-model';
@@ -313,7 +314,11 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
313
314
 
314
315
  private syncEnvironmentVariableCollection(extensionIdentifier: string, collection: EnvironmentVariableCollection): void {
315
316
  const serialized = [...collection.map.entries()];
316
- this.proxy.$setEnvironmentVariableCollection(extensionIdentifier, collection.persistent, serialized.length === 0 ? undefined : serialized);
317
+ this.proxy.$setEnvironmentVariableCollection(collection.persistent, {
318
+ extensionIdentifier,
319
+ collection: serialized.length === 0 ? undefined : serialized,
320
+ description: Converter.fromMarkdownOrString(collection.description)
321
+ });
317
322
  }
318
323
 
319
324
  private setEnvironmentVariableCollection(extensionIdentifier: string, collection: EnvironmentVariableCollection): void {
@@ -339,8 +344,15 @@ export class TerminalServiceExtImpl implements TerminalServiceExt {
339
344
 
340
345
  export class EnvironmentVariableCollection implements theia.EnvironmentVariableCollection {
341
346
  readonly map: Map<string, theia.EnvironmentVariableMutator> = new Map();
347
+ private _description?: string | theia.MarkdownString;
342
348
  private _persistent: boolean = true;
343
349
 
350
+ public get description(): string | theia.MarkdownString | undefined { return this._description; }
351
+ public set description(value: string | theia.MarkdownString | undefined) {
352
+ this._description = value;
353
+ this.onDidChangeCollectionEmitter.fire();
354
+ }
355
+
344
356
  public get persistent(): boolean { return this._persistent; }
345
357
  public set persistent(value: boolean) {
346
358
  this._persistent = value;
@@ -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;