@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
@@ -390,6 +390,12 @@ export class PluginIconTheme extends PluginIconThemeDefinition implements IconTh
390
390
  ): void {
391
391
  if (associations.folder) {
392
392
  accept(associations.folder, this.folderIcon);
393
+ if (associations.folderExpanded === undefined) {
394
+ // Use the same icon for expanded state (issue #12727). Check for
395
+ // undefined folderExpanded property to allow for
396
+ // "folderExpanded": null in case a developer really wants that
397
+ accept(associations.folder, this.folderExpandedIcon);
398
+ }
393
399
  this.hasFolderIcons = true;
394
400
  }
395
401
  if (associations.folderExpanded) {
@@ -110,7 +110,8 @@ export class PluginSharedStyle {
110
110
  const lightIconUrl = PluginSharedStyle.toExternalIconUrl(`${typeof iconUrl === 'object' ? iconUrl.light : iconUrl}`);
111
111
  const iconClass = 'plugin-icon-' + this.iconSequence++;
112
112
  const toDispose = new DisposableCollection();
113
- toDispose.push(this.insertRule('.' + iconClass, theme => `
113
+ toDispose.push(this.insertRule('.' + iconClass + '::before', theme => `
114
+ content: "";
114
115
  background-position: 2px;
115
116
  width: ${size}px;
116
117
  height: ${size}px;
@@ -184,8 +184,8 @@ export class TasksMainImpl implements TasksMain, Disposable {
184
184
  protected createTaskProvider(handle: number): TaskProvider {
185
185
  return {
186
186
  provideTasks: () =>
187
- this.proxy.$provideTasks(handle).then(v =>
188
- v!.map(taskDto =>
187
+ this.proxy.$provideTasks(handle).then(tasks =>
188
+ tasks.map(taskDto =>
189
189
  this.toTaskConfiguration(taskDto)
190
190
  )
191
191
  )
@@ -195,8 +195,8 @@ export class TasksMainImpl implements TasksMain, Disposable {
195
195
  protected createTaskResolver(handle: number): TaskResolver {
196
196
  return {
197
197
  resolveTask: taskConfig =>
198
- this.proxy.$resolveTask(handle, this.fromTaskConfiguration(taskConfig)).then(v =>
199
- this.toTaskConfiguration(v!)
198
+ this.proxy.$resolveTask(handle, this.fromTaskConfiguration(taskConfig)).then(task =>
199
+ this.toTaskConfiguration(task)
200
200
  )
201
201
  };
202
202
  }
@@ -22,7 +22,7 @@ import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-servi
22
22
  import { TerminalServiceMain, TerminalServiceExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc';
23
23
  import { RPCProtocol } from '../../common/rpc-protocol';
24
24
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
25
- import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
25
+ import { SerializableEnvironmentVariableCollection, SerializableExtensionEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
26
26
  import { ShellTerminalServerProxy } from '@theia/terminal/lib/common/shell-terminal-protocol';
27
27
  import { TerminalLink, TerminalLinkProvider } from '@theia/terminal/lib/browser/terminal-link-provider';
28
28
  import { URI } from '@theia/core/lib/common/uri';
@@ -75,11 +75,11 @@ export class TerminalServiceMainImpl implements TerminalServiceMain, TerminalLin
75
75
  return this.extProxy.$startProfile(id, CancellationToken.None);
76
76
  }
77
77
 
78
- $setEnvironmentVariableCollection(extensionIdentifier: string, persistent: boolean, collection: SerializableEnvironmentVariableCollection | undefined): void {
79
- if (collection) {
80
- this.shellTerminalServer.setCollection(extensionIdentifier, persistent, collection);
78
+ $setEnvironmentVariableCollection(persistent: boolean, collection: SerializableExtensionEnvironmentVariableCollection): void {
79
+ if (collection.collection) {
80
+ this.shellTerminalServer.setCollection(collection.extensionIdentifier, persistent, collection.collection, collection.description);
81
81
  } else {
82
- this.shellTerminalServer.deleteCollection(extensionIdentifier);
82
+ this.shellTerminalServer.deleteCollection(collection.extensionIdentifier);
83
83
  }
84
84
  }
85
85
 
@@ -50,7 +50,7 @@ import { AccessibilityInformation } from '@theia/plugin';
50
50
  import { ColorRegistry } from '@theia/core/lib/browser/color-registry';
51
51
  import { DecoratedTreeNode } from '@theia/core/lib/browser/tree/tree-decorator';
52
52
  import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration';
53
- import { CancellationTokenSource, CancellationToken } from '@theia/core/lib/common';
53
+ import { CancellationTokenSource, CancellationToken, Mutable } from '@theia/core/lib/common';
54
54
  import { mixin } from '../../../common/types';
55
55
  import { Deferred } from '@theia/core/lib/common/promise-util';
56
56
  import { DnDFileContentStore } from './dnd-file-content-store';
@@ -165,6 +165,7 @@ export namespace CompositeTreeViewNode {
165
165
  @injectable()
166
166
  export class TreeViewWidgetOptions {
167
167
  id: string;
168
+ manageCheckboxStateManually: boolean | undefined;
168
169
  showCollapseAll: boolean | undefined;
169
170
  multiSelect: boolean | undefined;
170
171
  dragMimeTypes: string[] | undefined;
@@ -272,6 +273,37 @@ export class PluginTree extends TreeImpl {
272
273
  }, update);
273
274
  }
274
275
 
276
+ override markAsChecked(node: Mutable<TreeNode>, checked: boolean): void {
277
+ function findParentsToChange(child: TreeNode, nodes: TreeNode[]): void {
278
+ if ((child.parent?.checkboxInfo !== undefined && child.parent.checkboxInfo.checked !== checked) &&
279
+ (!checked || !child.parent.children.some(candidate => candidate !== child && candidate.checkboxInfo?.checked === false))) {
280
+ nodes.push(child.parent);
281
+ findParentsToChange(child.parent, nodes);
282
+ }
283
+ }
284
+
285
+ function findChildrenToChange(parent: TreeNode, nodes: TreeNode[]): void {
286
+ if (CompositeTreeNode.is(parent)) {
287
+ parent.children.forEach(child => {
288
+ if (child.checkboxInfo !== undefined && child.checkboxInfo.checked !== checked) {
289
+ nodes.push(child);
290
+ }
291
+ findChildrenToChange(child, nodes);
292
+ });
293
+ }
294
+ }
295
+
296
+ const nodesToChange = [node];
297
+ if (!this.options.manageCheckboxStateManually) {
298
+ findParentsToChange(node, nodesToChange);
299
+ findChildrenToChange(node, nodesToChange);
300
+
301
+ }
302
+ nodesToChange.forEach(n => n.checkboxInfo!.checked = checked);
303
+ this.onDidUpdateEmitter.fire(nodesToChange);
304
+ this.proxy?.$checkStateChanged(this.options.id, [{ id: node.id, checked: checked }]);
305
+ }
306
+
275
307
  /** Creates a resolvable tree node. If a node already exists, reset it because the underlying TreeViewItem might have been disposed in the backend. */
276
308
  protected createResolvableTreeNode(item: TreeViewItem, parent: CompositeTreeNode): TreeNode {
277
309
  const update: Partial<TreeViewNode> = this.createTreeNodeUpdate(item);
@@ -328,6 +360,7 @@ export class PluginTree extends TreeImpl {
328
360
  tooltip: item.tooltip,
329
361
  contextValue: item.contextValue,
330
362
  command: item.command,
363
+ checkboxInfo: item.checkboxInfo,
331
364
  accessibilityInformation: item.accessibilityInformation,
332
365
  };
333
366
  }
@@ -496,6 +529,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
496
529
  ...attrs,
497
530
  onMouseLeave: () => source?.cancel(),
498
531
  onMouseEnter: async event => {
532
+ const target = event.currentTarget; // event.currentTarget will be null after awaiting node resolve()
499
533
  if (configuredTip) {
500
534
  if (MarkdownString.is(node.tooltip)) {
501
535
  this.hoverService.requestHover({
@@ -524,7 +558,7 @@ export class TreeViewWidget extends TreeViewWelcomeWidget {
524
558
  const title = node.tooltip ||
525
559
  (node.resourceUri && this.labelProvider.getLongName(new URI(node.resourceUri)))
526
560
  || this.toNodeName(node);
527
- event.currentTarget.title = title;
561
+ target.title = title;
528
562
  }
529
563
  configuredTip = true;
530
564
  }
@@ -63,6 +63,7 @@ export class TreeViewsMainImpl implements TreeViewsMain, Disposable {
63
63
  this.treeViewProviders.set(treeViewId, this.viewRegistry.registerViewDataProvider(treeViewId, async ({ state, viewInfo }) => {
64
64
  const options: TreeViewWidgetOptions = {
65
65
  id: treeViewId,
66
+ manageCheckboxStateManually: $options.manageCheckboxStateManually,
66
67
  showCollapseAll: $options.showCollapseAll,
67
68
  multiSelect: $options.canSelectMany,
68
69
  dragMimeTypes: $options.dragMimeTypes,
@@ -183,6 +184,13 @@ export class TreeViewsMainImpl implements TreeViewsMain, Disposable {
183
184
  }
184
185
  }
185
186
 
187
+ async setChecked(treeViewWidget: TreeViewWidget, changedNodes: TreeViewNode[]): Promise<void> {
188
+ await this.proxy.$checkStateChanged(treeViewWidget.id, changedNodes.map(node => ({
189
+ id: node.id,
190
+ checked: !!node.checkboxInfo?.checked
191
+ })));
192
+ }
193
+
186
194
  protected handleTreeEvents(treeViewId: string, treeViewWidget: TreeViewWidget): void {
187
195
  this.toDispose.push(treeViewWidget.model.onExpansionChanged(event => {
188
196
  this.proxy.$setExpanded(treeViewId, event.id, event.expanded);
@@ -592,6 +592,12 @@ export class WebviewWidget extends BaseWidget implements StatefulWidget, Extract
592
592
  this._state = state;
593
593
  }
594
594
 
595
+ setIframeHeight(height: number): void {
596
+ if (this.element) {
597
+ this.element.style.height = `${height}px`;
598
+ }
599
+ }
600
+
595
601
  protected async doSend(channel: string, data?: any): Promise<void> {
596
602
  if (!this.element) {
597
603
  return;
@@ -0,0 +1,37 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2023 Arduino SA and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { rejects } from 'assert';
18
+ import { strictEqual } from 'assert/strict';
19
+ import { promises as fs } from 'fs';
20
+ import { v4 } from 'uuid';
21
+ import { isENOENT } from '../../common/errors';
22
+
23
+ describe('errors', () => {
24
+ describe('errno-exception', () => {
25
+ it('should be ENOENT error', async () => {
26
+ await rejects(fs.readFile(v4()), reason => isENOENT(reason));
27
+ });
28
+
29
+ it('should not be ENOENT error (no code)', () => {
30
+ strictEqual(isENOENT(new Error('I am not ENOENT')), false);
31
+ });
32
+
33
+ it('should not be ENOENT error (other code)', async () => {
34
+ await rejects(fs.readdir(__filename), reason => !isENOENT(reason));
35
+ });
36
+ });
37
+ });
@@ -17,27 +17,35 @@
17
17
  import * as path from 'path';
18
18
  import * as filenamify from 'filenamify';
19
19
  import * as fs from '@theia/core/shared/fs-extra';
20
+ import type { URI } from '@theia/core';
20
21
  import { inject, injectable } from '@theia/core/shared/inversify';
22
+ import { Deferred } from '@theia/core/lib/common/promise-util';
21
23
  import { FileUri } from '@theia/core/lib/node';
22
24
  import {
23
25
  PluginDeployerDirectoryHandler, PluginDeployerEntry, PluginPackage, PluginDeployerDirectoryHandlerContext, PluginDeployerEntryType, PluginType, PluginIdentifiers
24
26
  } from '../../../common/plugin-protocol';
25
27
  import { PluginCliContribution } from '../plugin-cli-contribution';
26
- import { getTempDir } from '../temp-dir-util';
28
+ import { getTempDirPathAsync } from '../temp-dir-util';
27
29
 
28
30
  @injectable()
29
31
  export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandler {
30
32
 
31
- protected readonly deploymentDirectory = FileUri.create(getTempDir('theia-copied'));
33
+ protected readonly deploymentDirectory: Deferred<URI>;
32
34
 
33
35
  @inject(PluginCliContribution) protected readonly pluginCli: PluginCliContribution;
34
36
 
35
- accept(resolvedPlugin: PluginDeployerEntry): boolean {
37
+ constructor() {
38
+ this.deploymentDirectory = new Deferred();
39
+ getTempDirPathAsync('theia-copied')
40
+ .then(deploymentDirectory => this.deploymentDirectory.resolve(FileUri.create(deploymentDirectory)));
41
+ }
42
+
43
+ async accept(resolvedPlugin: PluginDeployerEntry): Promise<boolean> {
36
44
 
37
45
  console.debug('PluginTheiaDirectoryHandler: accepting plugin with path', resolvedPlugin.path());
38
46
 
39
47
  // handle only directories
40
- if (resolvedPlugin.isFile()) {
48
+ if (await resolvedPlugin.isFile()) {
41
49
  return false;
42
50
  }
43
51
 
@@ -47,7 +55,7 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl
47
55
  try {
48
56
  let packageJson = resolvedPlugin.getValue<PluginPackage>('package.json');
49
57
  if (!packageJson) {
50
- packageJson = fs.readJSONSync(packageJsonPath);
58
+ packageJson = await fs.readJSON(packageJsonPath);
51
59
  packageJson.publisher ??= PluginIdentifiers.UNPUBLISHED;
52
60
  resolvedPlugin.storeValue('package.json', packageJson);
53
61
  }
@@ -81,11 +89,12 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl
81
89
  const origin = entry.originalPath();
82
90
  const targetDir = await this.getExtensionDir(context);
83
91
  try {
84
- if (fs.existsSync(targetDir) || !entry.path().startsWith(origin)) {
92
+ if (await fs.pathExists(targetDir) || !entry.path().startsWith(origin)) {
85
93
  console.log(`[${id}]: already copied.`);
86
94
  } else {
87
95
  console.log(`[${id}]: copying to "${targetDir}"`);
88
- await fs.mkdirp(FileUri.fsPath(this.deploymentDirectory));
96
+ const deploymentDirectory = await this.deploymentDirectory.promise;
97
+ await fs.mkdirp(FileUri.fsPath(deploymentDirectory));
89
98
  await context.copy(origin, targetDir);
90
99
  entry.updatePath(targetDir);
91
100
  if (!this.accept(entry)) {
@@ -100,6 +109,7 @@ export class PluginTheiaDirectoryHandler implements PluginDeployerDirectoryHandl
100
109
  }
101
110
 
102
111
  protected async getExtensionDir(context: PluginDeployerDirectoryHandlerContext): Promise<string> {
103
- return FileUri.fsPath(this.deploymentDirectory.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
112
+ const deploymentDirectory = await this.deploymentDirectory.promise;
113
+ return FileUri.fsPath(deploymentDirectory.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
104
114
  }
105
115
  }
@@ -15,8 +15,10 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { PluginDeployerFileHandler, PluginDeployerEntry, PluginDeployerFileHandlerContext, PluginType } from '../../../common/plugin-protocol';
18
- import { injectable, inject } from '@theia/core/shared/inversify';
19
- import { getTempDir } from '../temp-dir-util';
18
+ import type { URI } from '@theia/core';
19
+ import { inject, injectable } from '@theia/core/shared/inversify';
20
+ import { Deferred } from '@theia/core/lib/common/promise-util';
21
+ import { getTempDirPathAsync } from '../temp-dir-util';
20
22
  import * as fs from '@theia/core/shared/fs-extra';
21
23
  import * as filenamify from 'filenamify';
22
24
  import { FileUri } from '@theia/core/lib/node/file-uri';
@@ -25,13 +27,22 @@ import { PluginTheiaEnvironment } from '../../common/plugin-theia-environment';
25
27
  @injectable()
26
28
  export class PluginTheiaFileHandler implements PluginDeployerFileHandler {
27
29
 
28
- private readonly systemPluginsDirUri = FileUri.create(getTempDir('theia-unpacked'));
30
+ private readonly systemPluginsDirUri: Deferred<URI>;
29
31
 
30
32
  @inject(PluginTheiaEnvironment)
31
33
  protected readonly environment: PluginTheiaEnvironment;
32
34
 
33
- accept(resolvedPlugin: PluginDeployerEntry): boolean {
34
- return resolvedPlugin.isFile() && resolvedPlugin.path() !== null && resolvedPlugin.path().endsWith('.theia');
35
+ constructor() {
36
+ this.systemPluginsDirUri = new Deferred();
37
+ getTempDirPathAsync('theia-unpacked')
38
+ .then(systemPluginsDirPath => this.systemPluginsDirUri.resolve(FileUri.create(systemPluginsDirPath)));
39
+ }
40
+
41
+ async accept(resolvedPlugin: PluginDeployerEntry): Promise<boolean> {
42
+ if (resolvedPlugin.path() !== null && resolvedPlugin.path().endsWith('.theia')) {
43
+ return resolvedPlugin.isFile();
44
+ }
45
+ return false;
35
46
  }
36
47
 
37
48
  async handle(context: PluginDeployerFileHandlerContext): Promise<void> {
@@ -49,6 +60,7 @@ export class PluginTheiaFileHandler implements PluginDeployerFileHandler {
49
60
  }
50
61
 
51
62
  protected async getPluginDir(context: PluginDeployerFileHandlerContext): Promise<string> {
52
- return FileUri.fsPath(this.systemPluginsDirUri.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
63
+ const systemPluginsDirUri = await this.systemPluginsDirUri.promise;
64
+ return FileUri.fsPath(systemPluginsDirUri.resolve(filenamify(context.pluginEntry().id(), { replacement: '_' })));
53
65
  }
54
66
  }
@@ -18,7 +18,8 @@ import { injectable, inject } from '@theia/core/shared/inversify';
18
18
  import URI from '@theia/core/lib/common/uri';
19
19
  import * as path from 'path';
20
20
  import * as fs from '@theia/core/shared/fs-extra';
21
- import { readdir, remove } from '@theia/core/shared/fs-extra';
21
+ import { readdir } from 'fs/promises';
22
+ import { remove } from '@theia/core/shared/fs-extra';
22
23
  import * as crypto from 'crypto';
23
24
  import { ILogger } from '@theia/core';
24
25
  import { FileUri } from '@theia/core/lib/node';
@@ -139,15 +140,9 @@ export class PluginPathsServiceImpl implements PluginPathsService {
139
140
  }
140
141
 
141
142
  private async cleanupOldLogs(parentLogsDir: string): Promise<void> {
142
- // @ts-ignore - fs-extra types (Even latest version) is not updated with the `withFileTypes` option.
143
- const dirEntries = await readdir(parentLogsDir, { withFileTypes: true }) as string[];
144
- // `Dirent` type is defined in @types/node since 10.10.0
145
- // However, upgrading the @types/node in theia to 10.11 (as defined in engine field)
146
- // Causes other packages to break in compilation, so we are using the infamous `any` type...
147
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
148
- const subDirEntries = dirEntries.filter((dirent: any) => dirent.isDirectory());
149
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
150
- const subDirNames = subDirEntries.map((dirent: any) => dirent.name);
143
+ const dirEntries = await readdir(parentLogsDir, { withFileTypes: true });
144
+ const subDirEntries = dirEntries.filter(dirent => dirent.isDirectory());
145
+ const subDirNames = subDirEntries.map(dirent => dirent.name);
151
146
  // We never clean a folder that is not a Theia logs session folder.
152
147
  // Even if it does appears under the `parentLogsDir`...
153
148
  const sessionSubDirNames = subDirNames.filter((dirName: string) => SESSION_TIMESTAMP_PATTERN.test(dirName));
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import * as path from 'path';
18
- import * as fs from '@theia/core/shared/fs-extra';
18
+ import { promises as fs } from 'fs';
19
19
  import { PluginDeployerEntry, PluginDeployerDirectoryHandlerContext } from '../../common/plugin-protocol';
20
20
 
21
21
  export class PluginDeployerDirectoryHandlerContextImpl implements PluginDeployerDirectoryHandlerContext {
@@ -23,17 +23,17 @@ export class PluginDeployerDirectoryHandlerContextImpl implements PluginDeployer
23
23
  constructor(private readonly pluginDeployerEntry: PluginDeployerEntry) { }
24
24
 
25
25
  async copy(origin: string, target: string): Promise<void> {
26
- const contents = await fs.readdir(origin);
27
- await fs.mkdirp(target);
28
- await Promise.all(contents.map(async item => {
26
+ const entries = await fs.readdir(origin, { withFileTypes: true });
27
+ await fs.mkdir(target, { recursive: true });
28
+ await Promise.all(entries.map(async entry => {
29
+ const item = entry.name;
29
30
  const itemPath = path.resolve(origin, item);
30
31
  const targetPath = path.resolve(target, item);
31
- const stat = await fs.stat(itemPath);
32
- if (stat.isDirectory()) {
32
+ if (entry.isDirectory()) {
33
33
  return this.copy(itemPath, targetPath);
34
34
  }
35
- if (stat.isFile()) {
36
- return new Promise<void>((resolve, reject) => fs.copyFile(itemPath, targetPath, e => e === null ? resolve() : reject(e)));
35
+ if (entry.isFile()) {
36
+ return fs.copyFile(itemPath, targetPath);
37
37
  }
38
38
  }));
39
39
  }
@@ -15,7 +15,7 @@
15
15
  // *****************************************************************************
16
16
 
17
17
  import { PluginDeployerEntry, PluginDeployerEntryType, PluginType } from '../../common/plugin-protocol';
18
- import * as fs from 'fs';
18
+ import { promises as fs } from 'fs';
19
19
 
20
20
  export class PluginDeployerEntryImpl implements PluginDeployerEntry {
21
21
 
@@ -73,17 +73,19 @@ export class PluginDeployerEntryImpl implements PluginDeployerEntry {
73
73
  getChanges(): string[] {
74
74
  return this.changes;
75
75
  }
76
- isFile(): boolean {
76
+ async isFile(): Promise<boolean> {
77
77
  try {
78
- return fs.statSync(this.currentPath).isFile();
79
- } catch (e) {
78
+ const stat = await fs.stat(this.currentPath);
79
+ return stat.isFile();
80
+ } catch {
80
81
  return false;
81
82
  }
82
83
  }
83
- isDirectory(): boolean {
84
+ async isDirectory(): Promise<boolean> {
84
85
  try {
85
- return fs.statSync(this.currentPath).isDirectory();
86
- } catch (e) {
86
+ const stat = await fs.stat(this.currentPath);
87
+ return stat.isDirectory();
88
+ } catch {
87
89
  return false;
88
90
  }
89
91
  }
@@ -21,8 +21,8 @@ import * as semver from 'semver';
21
21
  import {
22
22
  PluginDeployerResolver, PluginDeployerFileHandler, PluginDeployerDirectoryHandler,
23
23
  PluginDeployerEntry, PluginDeployer, PluginDeployerParticipant, PluginDeployerStartContext,
24
- PluginDeployerResolverInit, PluginDeployerFileHandlerContext,
25
- PluginDeployerDirectoryHandlerContext, PluginDeployerEntryType, PluginDeployerHandler, PluginType, UnresolvedPluginEntry, PluginIdentifiers, PluginDeployOptions
24
+ PluginDeployerResolverInit,
25
+ PluginDeployerEntryType, PluginDeployerHandler, PluginType, UnresolvedPluginEntry, PluginIdentifiers, PluginDeployOptions
26
26
  } from '../../common/plugin-protocol';
27
27
  import { PluginDeployerEntryImpl } from './plugin-deployer-entry-impl';
28
28
  import {
@@ -295,41 +295,33 @@ export class PluginDeployerImpl implements PluginDeployer {
295
295
  /**
296
296
  * If there are some single files, try to see if we can work on these files (like unpacking it, etc)
297
297
  */
298
- public async applyFileHandlers(pluginDeployerEntries: PluginDeployerEntry[]): Promise<any> {
299
- const waitPromises: Array<Promise<any>> = [];
300
-
301
- pluginDeployerEntries.filter(pluginDeployerEntry => pluginDeployerEntry.isResolved()).map(pluginDeployerEntry => {
302
- this.pluginDeployerFileHandlers.map(pluginFileHandler => {
298
+ public async applyFileHandlers(pluginDeployerEntries: PluginDeployerEntry[]): Promise<void> {
299
+ const waitPromises = pluginDeployerEntries.filter(pluginDeployerEntry => pluginDeployerEntry.isResolved()).flatMap(pluginDeployerEntry =>
300
+ this.pluginDeployerFileHandlers.map(async pluginFileHandler => {
303
301
  const proxyPluginDeployerEntry = new ProxyPluginDeployerEntry(pluginFileHandler, (pluginDeployerEntry) as PluginDeployerEntryImpl);
304
- if (pluginFileHandler.accept(proxyPluginDeployerEntry)) {
305
- const pluginDeployerFileHandlerContext: PluginDeployerFileHandlerContext = new PluginDeployerFileHandlerContextImpl(proxyPluginDeployerEntry);
306
- const promise: Promise<void> = pluginFileHandler.handle(pluginDeployerFileHandlerContext);
307
- waitPromises.push(promise);
302
+ if (await pluginFileHandler.accept(proxyPluginDeployerEntry)) {
303
+ const pluginDeployerFileHandlerContext = new PluginDeployerFileHandlerContextImpl(proxyPluginDeployerEntry);
304
+ await pluginFileHandler.handle(pluginDeployerFileHandlerContext);
308
305
  }
309
- });
310
-
311
- });
312
- return Promise.all(waitPromises);
306
+ })
307
+ );
308
+ await Promise.all(waitPromises);
313
309
  }
314
310
 
315
311
  /**
316
312
  * Check for all registered directories to see if there are some plugins that can be accepted to be deployed.
317
313
  */
318
- public async applyDirectoryFileHandlers(pluginDeployerEntries: PluginDeployerEntry[]): Promise<any> {
319
- const waitPromises: Array<Promise<any>> = [];
320
-
321
- pluginDeployerEntries.filter(pluginDeployerEntry => pluginDeployerEntry.isResolved()).map(pluginDeployerEntry => {
322
- this.pluginDeployerDirectoryHandlers.map(pluginDirectoryHandler => {
314
+ public async applyDirectoryFileHandlers(pluginDeployerEntries: PluginDeployerEntry[]): Promise<void> {
315
+ const waitPromises = pluginDeployerEntries.filter(pluginDeployerEntry => pluginDeployerEntry.isResolved()).flatMap(pluginDeployerEntry =>
316
+ this.pluginDeployerDirectoryHandlers.map(async pluginDirectoryHandler => {
323
317
  const proxyPluginDeployerEntry = new ProxyPluginDeployerEntry(pluginDirectoryHandler, (pluginDeployerEntry) as PluginDeployerEntryImpl);
324
- if (pluginDirectoryHandler.accept(proxyPluginDeployerEntry)) {
325
- const pluginDeployerDirectoryHandlerContext: PluginDeployerDirectoryHandlerContext = new PluginDeployerDirectoryHandlerContextImpl(proxyPluginDeployerEntry);
326
- const promise: Promise<void> = pluginDirectoryHandler.handle(pluginDeployerDirectoryHandlerContext);
327
- waitPromises.push(promise);
318
+ if (await pluginDirectoryHandler.accept(proxyPluginDeployerEntry)) {
319
+ const pluginDeployerDirectoryHandlerContext = new PluginDeployerDirectoryHandlerContextImpl(proxyPluginDeployerEntry);
320
+ await pluginDirectoryHandler.handle(pluginDeployerDirectoryHandlerContext);
328
321
  }
329
- });
330
-
331
- });
332
- return Promise.all(waitPromises);
322
+ })
323
+ );
324
+ await Promise.all(waitPromises);
333
325
  }
334
326
 
335
327
  /**
@@ -54,11 +54,11 @@ export class ProxyPluginDeployerEntry<T> implements PluginDeployerEntry {
54
54
  return this.delegate.getChanges();
55
55
  }
56
56
 
57
- isFile(): boolean {
57
+ isFile(): Promise<boolean> {
58
58
  return this.delegate.isFile();
59
59
  }
60
60
 
61
- isDirectory(): boolean {
61
+ isDirectory(): Promise<boolean> {
62
62
  return this.delegate.isDirectory();
63
63
  }
64
64
  isResolved(): boolean {
@@ -16,10 +16,11 @@
16
16
 
17
17
  import { RequestContext, RequestService } from '@theia/core/shared/@theia/request';
18
18
  import { inject, injectable } from '@theia/core/shared/inversify';
19
- import { promises as fs, existsSync, mkdirSync } from 'fs';
20
- import * as os from 'os';
19
+ import { Deferred } from '@theia/core/lib/common/promise-util';
20
+ import { promises as fs } from 'fs';
21
21
  import * as path from 'path';
22
22
  import { PluginDeployerResolver, PluginDeployerResolverContext } from '../../common';
23
+ import { getTempDirPathAsync } from './temp-dir-util';
23
24
 
24
25
  /**
25
26
  * Resolver that handle the github: protocol
@@ -33,16 +34,21 @@ export class GithubPluginDeployerResolver implements PluginDeployerResolver {
33
34
 
34
35
  private static GITHUB_ENDPOINT = 'https://github.com/';
35
36
 
36
- private unpackedFolder: string;
37
+ private unpackedFolder: Deferred<string>;
37
38
 
38
39
  @inject(RequestService)
39
40
  protected readonly request: RequestService;
40
41
 
41
42
  constructor() {
42
- this.unpackedFolder = path.resolve(os.tmpdir(), 'github-remote');
43
- if (!existsSync(this.unpackedFolder)) {
44
- mkdirSync(this.unpackedFolder);
45
- }
43
+ this.unpackedFolder = new Deferred();
44
+ getTempDirPathAsync('github-remote').then(async unpackedFolder => {
45
+ try {
46
+ await fs.mkdir(unpackedFolder, { recursive: true });
47
+ this.unpackedFolder.resolve(unpackedFolder);
48
+ } catch (err) {
49
+ this.unpackedFolder.reject(err);
50
+ }
51
+ });
46
52
  }
47
53
 
48
54
  /**
@@ -106,7 +112,8 @@ export class GithubPluginDeployerResolver implements PluginDeployerResolver {
106
112
  * Grab the github file specified by the plugin's ID
107
113
  */
108
114
  protected async grabGithubFile(pluginResolverContext: PluginDeployerResolverContext, orgName: string, repoName: string, filename: string, version: string): Promise<void> {
109
- const unpackedPath = path.resolve(this.unpackedFolder, path.basename(version + filename));
115
+ const unpackedFolder = await this.unpackedFolder.promise;
116
+ const unpackedPath = path.resolve(unpackedFolder, path.basename(version + filename));
110
117
  try {
111
118
  await fs.access(unpackedPath);
112
119
  // use of cache. If file is already there use it directly
@@ -16,11 +16,12 @@
16
16
 
17
17
  import { RequestContext, RequestService } from '@theia/core/shared/@theia/request';
18
18
  import { inject, injectable } from '@theia/core/shared/inversify';
19
- import { promises as fs, existsSync, mkdirSync } from 'fs';
20
- import * as os from 'os';
19
+ import { Deferred } from '@theia/core/lib/common/promise-util';
20
+ import { promises as fs } from 'fs';
21
21
  import * as path from 'path';
22
22
  import * as url from 'url';
23
23
  import { PluginDeployerResolver, PluginDeployerResolverContext } from '../../common';
24
+ import { getTempDirPathAsync } from './temp-dir-util';
24
25
 
25
26
  /**
26
27
  * Resolver that handle the http(s): protocol
@@ -30,16 +31,21 @@ import { PluginDeployerResolver, PluginDeployerResolverContext } from '../../com
30
31
  @injectable()
31
32
  export class HttpPluginDeployerResolver implements PluginDeployerResolver {
32
33
 
33
- private unpackedFolder: string;
34
+ private unpackedFolder: Deferred<string>;
34
35
 
35
36
  @inject(RequestService)
36
37
  protected readonly request: RequestService;
37
38
 
38
39
  constructor() {
39
- this.unpackedFolder = path.resolve(os.tmpdir(), 'http-remote');
40
- if (!existsSync(this.unpackedFolder)) {
41
- mkdirSync(this.unpackedFolder);
42
- }
40
+ this.unpackedFolder = new Deferred();
41
+ getTempDirPathAsync('http-remote').then(async unpackedFolder => {
42
+ try {
43
+ await fs.mkdir(unpackedFolder, { recursive: true });
44
+ this.unpackedFolder.resolve(unpackedFolder);
45
+ } catch (err) {
46
+ this.unpackedFolder.reject(err);
47
+ }
48
+ });
43
49
  }
44
50
 
45
51
  /**
@@ -58,7 +64,8 @@ export class HttpPluginDeployerResolver implements PluginDeployerResolver {
58
64
  const dirname = path.dirname(link.pathname);
59
65
  const basename = path.basename(link.pathname);
60
66
  const filename = dirname.replace(/\W/g, '_') + ('-') + basename;
61
- const unpackedPath = path.resolve(this.unpackedFolder, path.basename(filename));
67
+ const unpackedFolder = await this.unpackedFolder.promise;
68
+ const unpackedPath = path.resolve(unpackedFolder, path.basename(filename));
62
69
 
63
70
  try {
64
71
  await fs.access(unpackedPath);