@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
@@ -0,0 +1,373 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2023 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.NotebookDocument = exports.Cell = void 0;
23
+ const notebookCommon = require("@theia/notebook/lib/common");
24
+ const core_1 = require("@theia/core");
25
+ const typeConverters = require("../type-converters");
26
+ const types_impl_1 = require("../types-impl");
27
+ class RawContentChangeEvent {
28
+ constructor(start, deletedCount, deletedItems, items) {
29
+ this.start = start;
30
+ this.deletedCount = deletedCount;
31
+ this.deletedItems = deletedItems;
32
+ this.items = items;
33
+ }
34
+ asApiEvent() {
35
+ return {
36
+ range: new types_impl_1.NotebookRange(this.start, this.start + this.deletedCount),
37
+ addedCells: this.items.map(cell => cell.apiCell),
38
+ removedCells: this.deletedItems,
39
+ };
40
+ }
41
+ }
42
+ class Cell {
43
+ constructor(notebookDocument, editorsAndDocuments, cellData) {
44
+ var _a, _b, _c;
45
+ this.notebookDocument = notebookDocument;
46
+ this.editorsAndDocuments = editorsAndDocuments;
47
+ this.cellData = cellData;
48
+ this.handle = cellData.handle;
49
+ this.uri = core_1.URI.fromComponents(cellData.uri);
50
+ this.cellKind = cellData.cellKind;
51
+ this.outputs = cellData.outputs.map(typeConverters.NotebookCellOutputConverter.to);
52
+ this.internalMetadata = (_a = cellData.internalMetadata) !== null && _a !== void 0 ? _a : {};
53
+ this.metadata = Object.freeze((_b = cellData.metadata) !== null && _b !== void 0 ? _b : {});
54
+ this.previousResult = Object.freeze(typeConverters.NotebookCellExecutionSummary.to((_c = cellData.internalMetadata) !== null && _c !== void 0 ? _c : {}));
55
+ }
56
+ static asModelAddData(notebook, cell) {
57
+ return {
58
+ EOL: cell.eol,
59
+ lines: cell.source,
60
+ languageId: cell.language,
61
+ uri: cell.uri,
62
+ isDirty: false,
63
+ versionId: 1,
64
+ notebook,
65
+ modeId: ''
66
+ };
67
+ }
68
+ get language() {
69
+ return this.apiCell.document.languageId;
70
+ }
71
+ get apiCell() {
72
+ if (!this.cell) {
73
+ const that = this;
74
+ const data = this.editorsAndDocuments.getDocument(this.uri.toString());
75
+ if (!data) {
76
+ throw new Error(`MISSING extHostDocument for notebook cell: ${this.uri}`);
77
+ }
78
+ const apiCell = {
79
+ get index() { return that.notebookDocument.getCellIndex(that); },
80
+ notebook: that.notebookDocument.apiNotebook,
81
+ kind: typeConverters.NotebookCellKind.to(this.cellData.cellKind),
82
+ document: data.document,
83
+ get outputs() { return that.outputs.slice(0); },
84
+ get metadata() { return that.metadata; },
85
+ get executionSummary() { return that.previousResult; }
86
+ };
87
+ this.cell = Object.freeze(apiCell);
88
+ }
89
+ return this.cell;
90
+ }
91
+ setOutputs(newOutputs) {
92
+ this.outputs = newOutputs.map(typeConverters.NotebookCellOutputConverter.to);
93
+ }
94
+ // setOutputItems(outputId: string, append: boolean, newOutputItems: NotebookOutputItemDto[]): void {
95
+ // const newItems = newOutputItems.map(typeConverters.NotebookCellOutputItem.to);
96
+ // const output = this.outputs.find(op => op.id === outputId);
97
+ // if (output) {
98
+ // if (!append) {
99
+ // output.items.length = 0;
100
+ // }
101
+ // output.items.push(...newItems);
102
+ // // if (output.items.length > 1 && output.items.every(item => notebookCommon.isTextStreamMime(item.mime))) {
103
+ // // // Look for the mimes in the items, and keep track of their order.
104
+ // // // Merge the streams into one output item, per mime type.
105
+ // // const mimeOutputs = new Map<string, Uint8Array[]>();
106
+ // // const mimeTypes: string[] = [];
107
+ // // output.items.forEach(item => {
108
+ // // let items: Uint8Array[];
109
+ // // if (mimeOutputs.has(item.mime)) {
110
+ // // items = mimeOutputs.get(item.mime)!;
111
+ // // } else {
112
+ // // items = [];
113
+ // // mimeOutputs.set(item.mime, items);
114
+ // // mimeTypes.push(item.mime);
115
+ // // }
116
+ // // items.push(item.data);
117
+ // // });
118
+ // // output.items.length = 0;
119
+ // // mimeTypes.forEach(mime => {
120
+ // // const compressed = notebookCommon.compressOutputItemStreams(mimeOutputs.get(mime)!);
121
+ // // output.items.push({
122
+ // // mime,
123
+ // // data: compressed.buffer
124
+ // // });
125
+ // // });
126
+ // // }
127
+ // }
128
+ // }
129
+ setMetadata(newMetadata) {
130
+ this.metadata = Object.freeze(newMetadata);
131
+ }
132
+ setInternalMetadata(newInternalMetadata) {
133
+ this.internalMetadata = newInternalMetadata;
134
+ this.previousResult = Object.freeze(typeConverters.NotebookCellExecutionSummary.to(newInternalMetadata));
135
+ }
136
+ }
137
+ exports.Cell = Cell;
138
+ class NotebookDocument {
139
+ constructor(proxy, editorsAndDocuments, textDocuments, uri, notebookData) {
140
+ var _a;
141
+ this.proxy = proxy;
142
+ this.editorsAndDocuments = editorsAndDocuments;
143
+ this.textDocuments = textDocuments;
144
+ this.uri = uri;
145
+ this.versionId = 0;
146
+ this.isDirty = false;
147
+ this.disposed = false;
148
+ this.notebookType = notebookData.viewType;
149
+ this.metadata = (_a = notebookData.metadata) !== null && _a !== void 0 ? _a : {};
150
+ this.versionId = notebookData.versionId;
151
+ this.cells = notebookData.cells.map(cell => new Cell(this, editorsAndDocuments, cell));
152
+ }
153
+ get apiNotebook() {
154
+ if (!this.notebook) {
155
+ const that = this;
156
+ const apiObject = {
157
+ get uri() { return that.uri; },
158
+ get version() { return that.versionId; },
159
+ get notebookType() { return that.notebookType; },
160
+ get isDirty() { return that.isDirty; },
161
+ get isUntitled() { return that.uri.scheme === 'untitled'; },
162
+ get isClosed() { return that.disposed; },
163
+ get metadata() { return that.metadata; },
164
+ get cellCount() { return that.cells.length; },
165
+ cellAt(index) {
166
+ index = that.validateIndex(index);
167
+ return that.cells[index].apiCell;
168
+ },
169
+ getCells(range) {
170
+ const cells = range ? that.getCells(range) : that.cells;
171
+ return cells.map(cell => cell.apiCell);
172
+ },
173
+ save() {
174
+ return that.save();
175
+ }
176
+ };
177
+ this.notebook = Object.freeze(apiObject);
178
+ }
179
+ return this.notebook;
180
+ }
181
+ validateIndex(index) {
182
+ index = index | 0;
183
+ if (index < 0) {
184
+ return 0;
185
+ }
186
+ else if (index >= this.cells.length) {
187
+ return this.cells.length - 1;
188
+ }
189
+ else {
190
+ return index;
191
+ }
192
+ }
193
+ validateRange(range) {
194
+ let start = range.start | 0;
195
+ let end = range.end | 0;
196
+ if (start < 0) {
197
+ start = 0;
198
+ }
199
+ if (end > this.cells.length) {
200
+ end = this.cells.length;
201
+ }
202
+ return range.with({ start, end });
203
+ }
204
+ getCells(range) {
205
+ range = this.validateRange(range);
206
+ const result = [];
207
+ for (let i = range.start; i < range.end; i++) {
208
+ result.push(this.cells[i]);
209
+ }
210
+ return result;
211
+ }
212
+ async save() {
213
+ if (this.disposed) {
214
+ return Promise.reject(new Error('Notebook has been closed'));
215
+ }
216
+ return this.proxy.$trySaveNotebook(this.uri);
217
+ }
218
+ acceptDirty(isDirty) {
219
+ this.isDirty = isDirty;
220
+ }
221
+ acceptModelChanged(event, isDirty, newMetadata) {
222
+ this.versionId = event.versionId;
223
+ this.isDirty = isDirty;
224
+ // this.acceptDocumentPropertiesChanged({ metadata: newMetadata });
225
+ const result = {
226
+ notebook: this.apiNotebook,
227
+ metadata: newMetadata,
228
+ cellChanges: [],
229
+ contentChanges: [],
230
+ };
231
+ const relaxedCellChanges = [];
232
+ // -- apply change and populate content changes
233
+ for (const rawEvent of event.rawEvents) {
234
+ if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ModelChange) {
235
+ this.spliceNotebookCells(rawEvent.changes, false, result.contentChanges);
236
+ }
237
+ else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.Move) {
238
+ this.moveCells(rawEvent.index, rawEvent.length, rawEvent.newIdx, result.contentChanges);
239
+ }
240
+ else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.Output) {
241
+ this.setCellOutputs(rawEvent.index, rawEvent.outputs);
242
+ relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, outputs: this.cells[rawEvent.index].apiCell.outputs });
243
+ // } else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.OutputItem) {
244
+ // this._setCellOutputItems(rawEvent.index, rawEvent.outputId, rawEvent.append, rawEvent.outputItems);
245
+ // relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, outputs: this.cells[rawEvent.index].apiCell.outputs });
246
+ }
247
+ else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellLanguage) {
248
+ this.changeCellLanguage(rawEvent.index, rawEvent.language);
249
+ relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, document: this.cells[rawEvent.index].apiCell.document });
250
+ }
251
+ else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellContent) {
252
+ relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, document: this.cells[rawEvent.index].apiCell.document });
253
+ // } else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellMime) {
254
+ // this._changeCellMime(rawEvent.index, rawEvent.mime);
255
+ }
256
+ else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellMetadata) {
257
+ this.changeCellMetadata(rawEvent.index, rawEvent.metadata);
258
+ relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, metadata: this.cells[rawEvent.index].apiCell.metadata });
259
+ }
260
+ else if (rawEvent.kind === notebookCommon.NotebookCellsChangeType.ChangeCellInternalMetadata) {
261
+ this.changeCellInternalMetadata(rawEvent.index, rawEvent.internalMetadata);
262
+ relaxedCellChanges.push({ cell: this.cells[rawEvent.index].apiCell, executionSummary: this.cells[rawEvent.index].apiCell.executionSummary });
263
+ }
264
+ }
265
+ // -- compact cellChanges
266
+ const map = new Map();
267
+ for (let i = 0; i < relaxedCellChanges.length; i++) {
268
+ const relaxedCellChange = relaxedCellChanges[i];
269
+ const existing = map.get(relaxedCellChange.cell);
270
+ if (existing === undefined) {
271
+ const newLen = result.cellChanges.push({
272
+ document: undefined,
273
+ executionSummary: undefined,
274
+ metadata: undefined,
275
+ outputs: undefined,
276
+ ...relaxedCellChange,
277
+ });
278
+ map.set(relaxedCellChange.cell, newLen - 1);
279
+ }
280
+ else {
281
+ result.cellChanges[existing] = {
282
+ ...result.cellChanges[existing],
283
+ ...relaxedCellChange
284
+ };
285
+ }
286
+ }
287
+ // Freeze event properties so handlers cannot accidentally modify them
288
+ Object.freeze(result);
289
+ Object.freeze(result.cellChanges);
290
+ Object.freeze(result.contentChanges);
291
+ return result;
292
+ }
293
+ spliceNotebookCells(splices, initialization, bucket) {
294
+ if (this.disposed) {
295
+ return;
296
+ }
297
+ const contentChangeEvents = [];
298
+ const addedCellDocuments = [];
299
+ const removedCellDocuments = [];
300
+ splices.reverse().forEach(splice => {
301
+ const cellDtos = splice[2];
302
+ const newCells = cellDtos.map((cell) => {
303
+ const extCell = new Cell(this, this.editorsAndDocuments, cell);
304
+ if (!initialization) {
305
+ addedCellDocuments.push(Cell.asModelAddData(this.apiNotebook, cell));
306
+ }
307
+ return extCell;
308
+ });
309
+ const changeEvent = new RawContentChangeEvent(splice[0], splice[1], [], newCells);
310
+ const deletedItems = this.cells.splice(splice[0], splice[1], ...newCells);
311
+ for (const cell of deletedItems) {
312
+ removedCellDocuments.push(cell.uri.toComponents());
313
+ changeEvent.deletedItems.push(cell.apiCell);
314
+ }
315
+ contentChangeEvents.push(changeEvent);
316
+ });
317
+ if (bucket) {
318
+ for (const changeEvent of contentChangeEvents) {
319
+ bucket.push(changeEvent.asApiEvent());
320
+ }
321
+ }
322
+ }
323
+ moveCells(index, length, newIdx, bucket) {
324
+ const cells = this.cells.splice(index, length);
325
+ this.cells.splice(newIdx, 0, ...cells);
326
+ const changes = [
327
+ new RawContentChangeEvent(index, length, cells.map(c => c.apiCell), []),
328
+ new RawContentChangeEvent(newIdx, 0, [], cells)
329
+ ];
330
+ for (const change of changes) {
331
+ bucket.push(change.asApiEvent());
332
+ }
333
+ }
334
+ setCellOutputs(index, outputs) {
335
+ const cell = this.cells[index];
336
+ cell.setOutputs(outputs);
337
+ }
338
+ // private _setCellOutputItems(index: number, outputId: string, append: boolean, outputItems: NotebookOutputItemDto[]): void {
339
+ // const cell = this.cells[index];
340
+ // cell.setOutputItems(outputId, append, outputItems);
341
+ // }
342
+ changeCellLanguage(index, newLanguageId) {
343
+ const cell = this.cells[index];
344
+ if (cell.apiCell.document.languageId !== newLanguageId) {
345
+ this.textDocuments.$acceptModelModeChanged(cell.uri.toComponents(), cell.language, newLanguageId);
346
+ }
347
+ }
348
+ changeCellMetadata(index, newMetadata) {
349
+ const cell = this.cells[index];
350
+ cell.setMetadata(newMetadata);
351
+ }
352
+ changeCellInternalMetadata(index, newInternalMetadata) {
353
+ const cell = this.cells[index];
354
+ cell.setInternalMetadata(newInternalMetadata);
355
+ }
356
+ getCellFromApiCell(apiCell) {
357
+ return this.cells.find(cell => cell.apiCell === apiCell);
358
+ }
359
+ getCell(cellHandle) {
360
+ return this.cells.find(cell => cell.handle === cellHandle);
361
+ }
362
+ getCellFromIndex(index) {
363
+ return this.cells[index];
364
+ }
365
+ getCellIndex(cell) {
366
+ return this.cells.indexOf(cell);
367
+ }
368
+ dispose() {
369
+ this.disposed = true;
370
+ }
371
+ }
372
+ exports.NotebookDocument = NotebookDocument;
373
+ //# sourceMappingURL=notebook-document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-document.js","sourceRoot":"","sources":["../../../src/plugin/notebook/notebook-document.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF;;;gGAGgG;;;AAKhG,6DAA6D;AAC7D,sCAA8C;AAC9C,qDAAqD;AAErD,8CAA8C;AAI9C,MAAM,qBAAqB;IAEvB,YACa,KAAa,EACb,YAAoB,EACpB,YAAkC,EAClC,KAAa;QAHb,UAAK,GAAL,KAAK,CAAQ;QACb,iBAAY,GAAZ,YAAY,CAAQ;QACpB,iBAAY,GAAZ,YAAY,CAAsB;QAClC,UAAK,GAAL,KAAK,CAAQ;IACtB,CAAC;IAEL,UAAU;QACN,OAAO;YACH,KAAK,EAAE,IAAI,0BAAa,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,YAAY,CAAC;YACpE,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;YAChD,YAAY,EAAE,IAAI,CAAC,YAAY;SAClC,CAAC;IACN,CAAC;CACJ;AAED,MAAa,IAAI;IA+Bb,YACoB,gBAAkC,EACjC,mBAA+C,EAC/C,QAA6B;;QAF9B,qBAA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C;IAED,OAAO,CAAC,UAAkB;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,MAAM,KAAK,UAAU,CAAC,CAAC;IAC/D,CAAC;IAED,gBAAgB,CAAC,KAAa;QAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC;IAED,YAAY,CAAC,IAAU;QACnB,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,CAAC;IAED,OAAO;QACH,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC;IACzB,CAAC;CACJ;AA9QD,4CA8QC"}
@@ -0,0 +1,17 @@
1
+ import * as theia from '@theia/plugin';
2
+ import { UriComponents } from '../../common/uri-components';
3
+ import { NotebookCellsChangedEventDto, NotebookDocumentsExt } from '../../common';
4
+ import { NotebooksExtImpl } from './notebooks';
5
+ export declare type NotebookDocumentMetadata = Record<string, unknown>;
6
+ export declare class NotebookDocumentsExtImpl implements NotebookDocumentsExt {
7
+ private readonly notebooksAndEditors;
8
+ private readonly didSaveNotebookDocumentEmitter;
9
+ readonly onDidSaveNotebookDocument: import("@theia/core").Event<theia.NotebookDocument>;
10
+ private readonly didChangeNotebookDocumentEmitter;
11
+ readonly onDidChangeNotebookDocument: import("@theia/core").Event<theia.NotebookDocumentChangeEvent>;
12
+ constructor(notebooksAndEditors: NotebooksExtImpl);
13
+ $acceptModelChanged(uri: UriComponents, event: NotebookCellsChangedEventDto, isDirty: boolean, newMetadata?: NotebookDocumentMetadata): void;
14
+ $acceptDirtyStateChanged(uri: UriComponents, isDirty: boolean): void;
15
+ $acceptModelSaved(uri: UriComponents): void;
16
+ }
17
+ //# sourceMappingURL=notebook-documents.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-documents.d.ts","sourceRoot":"","sources":["../../../src/plugin/notebook/notebook-documents.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,4BAA4B,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAClF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG/C,oBAAY,wBAAwB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE/D,qBAAa,wBAAyB,YAAW,oBAAoB;IAS7D,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAPxC,OAAO,CAAC,QAAQ,CAAC,8BAA8B,CAAyC;IACxF,QAAQ,CAAC,yBAAyB,sDAA6C;IAE/E,OAAO,CAAC,QAAQ,CAAC,gCAAgC,CAAoD;IACrG,QAAQ,CAAC,2BAA2B,iEAA+C;gBAG9D,mBAAmB,EAAE,gBAAgB;IAG1D,mBAAmB,CAAC,GAAG,EAAE,aAAa,EAAE,KAAK,EAAE,4BAA4B,EACvE,OAAO,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,wBAAwB,GAAG,IAAI;IAMnE,wBAAwB,CAAC,GAAG,EAAE,aAAa,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI;IAKpE,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,IAAI;CAI9C"}
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2023 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.NotebookDocumentsExtImpl = void 0;
23
+ const core_1 = require("@theia/core");
24
+ const types_impl_1 = require("../types-impl");
25
+ class NotebookDocumentsExtImpl {
26
+ constructor(notebooksAndEditors) {
27
+ this.notebooksAndEditors = notebooksAndEditors;
28
+ this.didSaveNotebookDocumentEmitter = new core_1.Emitter();
29
+ this.onDidSaveNotebookDocument = this.didSaveNotebookDocumentEmitter.event;
30
+ this.didChangeNotebookDocumentEmitter = new core_1.Emitter();
31
+ this.onDidChangeNotebookDocument = this.didChangeNotebookDocumentEmitter.event;
32
+ }
33
+ $acceptModelChanged(uri, event, isDirty, newMetadata) {
34
+ const document = this.notebooksAndEditors.getNotebookDocument(types_impl_1.URI.from(uri));
35
+ const e = document.acceptModelChanged(event, isDirty, newMetadata);
36
+ this.didChangeNotebookDocumentEmitter.fire(e);
37
+ }
38
+ $acceptDirtyStateChanged(uri, isDirty) {
39
+ const document = this.notebooksAndEditors.getNotebookDocument(types_impl_1.URI.from(uri));
40
+ document.acceptDirty(isDirty);
41
+ }
42
+ $acceptModelSaved(uri) {
43
+ const document = this.notebooksAndEditors.getNotebookDocument(types_impl_1.URI.from(uri));
44
+ this.didSaveNotebookDocumentEmitter.fire(document.apiNotebook);
45
+ }
46
+ }
47
+ exports.NotebookDocumentsExtImpl = NotebookDocumentsExtImpl;
48
+ //# sourceMappingURL=notebook-documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-documents.js","sourceRoot":"","sources":["../../../src/plugin/notebook/notebook-documents.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EA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,QAAQ,CAAC,WAAW,CAAC,CAAC;IACnE,CAAC;CACJ;AA5BD,4DA4BC"}
@@ -0,0 +1,21 @@
1
+ import * as theia from '@theia/plugin';
2
+ import { NotebookDocument } from './notebook-document';
3
+ export declare class NotebookEditor {
4
+ readonly id: string;
5
+ readonly notebookData: NotebookDocument;
6
+ static readonly apiEditorsToExtHost: WeakMap<theia.NotebookEditor, NotebookEditor>;
7
+ private selections;
8
+ private visibleRanges;
9
+ private viewColumn?;
10
+ private internalVisible;
11
+ private editor?;
12
+ constructor(id: string, notebookData: NotebookDocument, visibleRanges: theia.NotebookRange[], selections: theia.NotebookRange[], viewColumn: theia.ViewColumn | undefined);
13
+ get apiEditor(): theia.NotebookEditor;
14
+ get visible(): boolean;
15
+ acceptVisibility(value: boolean): void;
16
+ acceptVisibleRanges(value: theia.NotebookRange[]): void;
17
+ acceptSelections(selections: theia.NotebookRange[]): void;
18
+ private trySetSelections;
19
+ acceptViewColumn(value: theia.ViewColumn | undefined): void;
20
+ }
21
+ //# sourceMappingURL=notebook-editor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-editor.d.ts","sourceRoot":"","sources":["../../../src/plugin/notebook/notebook-editor.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,qBAAa,cAAc;IAanB,QAAQ,CAAC,EAAE,EAAE,MAAM;IAEnB,QAAQ,CAAC,YAAY,EAAE,gBAAgB;IAb3C,gBAAuB,mBAAmB,gDAAuD;IAEjG,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,UAAU,CAAC,CAAmB;IAEtC,OAAO,CAAC,eAAe,CAAkB;IAEzC,OAAO,CAAC,MAAM,CAAC,CAAuB;gBAGzB,EAAE,EAAE,MAAM,EAEV,YAAY,EAAE,gBAAgB,EACvC,aAAa,EAAE,KAAK,CAAC,aAAa,EAAE,EACpC,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,EACjC,UAAU,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS;IAO5C,IAAI,SAAS,IAAI,KAAK,CAAC,cAAc,CAyCpC;IAED,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI;IAItC,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,EAAE,GAAG,IAAI;IAIvD,gBAAgB,CAAC,UAAU,EAAE,KAAK,CAAC,aAAa,EAAE,GAAG,IAAI;IAIzD,OAAO,CAAC,gBAAgB;IAKxB,gBAAgB,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,GAAG,SAAS,GAAG,IAAI;CAG9D"}
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2023 TypeFox and others.
4
+ //
5
+ // This program and the accompanying materials are made available under the
6
+ // terms of the Eclipse Public License v. 2.0 which is available at
7
+ // http://www.eclipse.org/legal/epl-2.0.
8
+ //
9
+ // This Source Code may also be made available under the following Secondary
10
+ // Licenses when the conditions for such availability set forth in the Eclipse
11
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
12
+ // with the GNU Classpath Exception which is available at
13
+ // https://www.gnu.org/software/classpath/license.html.
14
+ //
15
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Microsoft Corporation. All rights reserved.
19
+ * Licensed under the MIT License. See License.txt in the project root for license information.
20
+ *--------------------------------------------------------------------------------------------*/
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.NotebookEditor = void 0;
23
+ class NotebookEditor {
24
+ constructor(id,
25
+ // private readonly _proxy: MainThreadNotebookEditorsShape,
26
+ notebookData, visibleRanges, selections, viewColumn) {
27
+ this.id = id;
28
+ this.notebookData = notebookData;
29
+ this.selections = [];
30
+ this.visibleRanges = [];
31
+ this.internalVisible = false;
32
+ this.selections = selections;
33
+ this.visibleRanges = visibleRanges;
34
+ this.viewColumn = viewColumn;
35
+ }
36
+ get apiEditor() {
37
+ if (!this.editor) {
38
+ const that = this;
39
+ this.editor = {
40
+ get notebook() {
41
+ return that.notebookData.apiNotebook;
42
+ },
43
+ get selection() {
44
+ return that.selections[0];
45
+ },
46
+ set selection(selection) {
47
+ this.selections = [selection];
48
+ },
49
+ get selections() {
50
+ return that.selections;
51
+ },
52
+ set selections(value) {
53
+ // if (!Array.isArray(value) || !value.every(extHostTypes.NotebookRange.isNotebookRange)) {
54
+ // throw illegalArgument('selections');
55
+ // }
56
+ that.selections = value;
57
+ that.trySetSelections(value);
58
+ },
59
+ get visibleRanges() {
60
+ return that.visibleRanges;
61
+ },
62
+ revealRange(range, revealType) {
63
+ // that._proxy.$tryRevealRange(
64
+ // that.id,
65
+ // extHostConverter.NotebookRange.from(range),
66
+ // revealType ?? extHostTypes.NotebookEditorRevealType.Default
67
+ // );
68
+ },
69
+ get viewColumn() {
70
+ return that.viewColumn;
71
+ },
72
+ };
73
+ NotebookEditor.apiEditorsToExtHost.set(this.editor, this);
74
+ }
75
+ return this.editor;
76
+ }
77
+ get visible() {
78
+ return this.internalVisible;
79
+ }
80
+ acceptVisibility(value) {
81
+ this.internalVisible = value;
82
+ }
83
+ acceptVisibleRanges(value) {
84
+ this.visibleRanges = value;
85
+ }
86
+ acceptSelections(selections) {
87
+ this.selections = selections;
88
+ }
89
+ trySetSelections(value) {
90
+ // NB Unimplemented: implement "selections"
91
+ // this._proxy.$trySetSelections(this.id, value.map(extHostConverter.NotebookRange.from));
92
+ }
93
+ acceptViewColumn(value) {
94
+ this.viewColumn = value;
95
+ }
96
+ }
97
+ exports.NotebookEditor = NotebookEditor;
98
+ NotebookEditor.apiEditorsToExtHost = new WeakMap();
99
+ //# sourceMappingURL=notebook-editor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-editor.js","sourceRoot":"","sources":["../../../src/plugin/notebook/notebook-editor.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF;;;gGAGgG;;;AAKhG,MAAa,cAAc;IAYvB,YACa,EAAU;IACnB,2DAA2D;IAClD,YAA8B,EACvC,aAAoC,EACpC,UAAiC,EACjC,UAAwC;QAL/B,OAAE,GAAF,EAAE,CAAQ;QAEV,iBAAY,GAAZ,YAAY,CAAkB;QAXnC,eAAU,GAA0B,EAAE,CAAC;QACvC,kBAAa,GAA0B,EAAE,CAAC;QAG1C,oBAAe,GAAY,KAAK,CAAC;QAYrC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,aAAa,GAAG,aAAa,CAAC;QACnC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAED,IAAI,SAAS;QACT,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE;YACd,MAAM,IAAI,GAAG,IAAI,CAAC;YAClB,IAAI,CAAC,MAAM,GAAG;gBACV,IAAI,QAAQ;oBACR,OAAO,IAAI,CAAC,YAAY,CAAC,WAAW,CAAC;gBACzC,CAAC;gBACD,IAAI,SAAS;oBACT,OAAO,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;gBAC9B,CAAC;gBACD,IAAI,SAAS,CAAC,SAA8B;oBACxC,IAAI,CAAC,UAAU,GAAG,CAAC,SAAS,CAAC,CAAC;gBAClC,CAAC;gBACD,IAAI,UAAU;oBACV,OAAO,IAAI,CAAC,UAAU,CAAC;gBAC3B,CAAC;gBACD,IAAI,UAAU,CAAC,KAA4B;oBACvC,2FAA2F;oBAC3F,2CAA2C;oBAC3C,IAAI;oBACJ,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;oBACxB,IAAI,CAAC,gBAAgB,CAAC,KAAK,CAAC,CAAC;gBACjC,CAAC;gBACD,IAAI,aAAa;oBACb,OAAO,IAAI,CAAC,aAAa,CAAC;gBAC9B,CAAC;gBACD,WAAW,CAAC,KAAK,EAAE,UAAU;oBACzB,+BAA+B;oBAC/B,eAAe;oBACf,kDAAkD;oBAClD,kEAAkE;oBAClE,KAAK;gBACT,CAAC;gBACD,IAAI,UAAU;oBACV,OAAO,IAAI,CAAC,UAAU,CAAC;gBAC3B,CAAC;aACJ,CAAC;YAEF,cAAc,CAAC,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;SAC7D;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,eAAe,CAAC;IAChC,CAAC;IAED,gBAAgB,CAAC,KAAc;QAC3B,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC;IACjC,CAAC;IAED,mBAAmB,CAAC,KAA4B;QAC5C,IAAI,CAAC,aAAa,GAAG,KAAK,CAAC;IAC/B,CAAC;IAED,gBAAgB,CAAC,UAAiC;QAC9C,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;IACjC,CAAC;IAEO,gBAAgB,CAAC,KAA4B;QACjD,2CAA2C;QAC3C,0FAA0F;IAC9F,CAAC;IAED,gBAAgB,CAAC,KAAmC;QAChD,IAAI,CAAC,UAAU,GAAG,KAAK,CAAC;IAC5B,CAAC;;AA3FL,wCA4FC;AA1F0B,kCAAmB,GAAG,IAAI,OAAO,EAAwC,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { NotebookEditorPropertiesChangeData, NotebookEditorsExt, NotebookEditorViewColumnInfo } from '../../common';
2
+ import * as theia from '@theia/plugin';
3
+ import { NotebooksExtImpl } from './notebooks';
4
+ export declare class NotebookEditorsExtImpl implements NotebookEditorsExt {
5
+ private readonly notebooksAndEditors;
6
+ private readonly DidChangeNotebookEditorSelectionEmitter;
7
+ private readonly DidChangeNotebookEditorVisibleRangesEmitter;
8
+ readonly onDidChangeNotebookEditorSelection: import("@theia/core").Event<theia.NotebookEditorSelectionChangeEvent>;
9
+ readonly onDidChangeNotebookEditorVisibleRanges: import("@theia/core").Event<theia.NotebookEditorVisibleRangesChangeEvent>;
10
+ constructor(notebooksAndEditors: NotebooksExtImpl);
11
+ $acceptEditorPropertiesChanged(id: string, data: NotebookEditorPropertiesChangeData): void;
12
+ $acceptEditorViewColumns(data: NotebookEditorViewColumnInfo): void;
13
+ }
14
+ //# sourceMappingURL=notebook-editors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notebook-editors.d.ts","sourceRoot":"","sources":["../../../src/plugin/notebook/notebook-editors.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,kCAAkC,EAAE,kBAAkB,EAAE,4BAA4B,EAAE,MAAM,cAAc,CAAC;AAEpH,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,qBAAa,sBAAuB,YAAW,kBAAkB;IASzD,OAAO,CAAC,QAAQ,CAAC,mBAAmB;IAPxC,OAAO,CAAC,QAAQ,CAAC,uCAAuC,CAA2D;IACnH,OAAO,CAAC,QAAQ,CAAC,2CAA2C,CAA+D;IAE3H,QAAQ,CAAC,kCAAkC,wEAAsD;IACjG,QAAQ,CAAC,sCAAsC,4EAA0D;gBAGpF,mBAAmB,EAAE,gBAAgB;IAG1D,8BAA8B,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,kCAAkC,GAAG,IAAI;IAyB1F,wBAAwB,CAAC,IAAI,EAAE,4BAA4B,GAAG,IAAI;CAOrE"}