@theia/plugin-ext 1.23.0-next.3 → 1.23.0-next.35

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 (413) hide show
  1. package/lib/common/character-classifier.js +2 -2
  2. package/lib/common/character-classifier.js.map +1 -1
  3. package/lib/common/index.js +1 -1
  4. package/lib/common/objects.js +3 -3
  5. package/lib/common/objects.js.map +1 -1
  6. package/lib/common/plugin-api-rpc-model.d.ts +13 -19
  7. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  8. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  9. package/lib/common/plugin-api-rpc.d.ts +33 -13
  10. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  11. package/lib/common/plugin-api-rpc.js +64 -62
  12. package/lib/common/plugin-api-rpc.js.map +1 -1
  13. package/lib/common/plugin-protocol.d.ts +6 -0
  14. package/lib/common/plugin-protocol.d.ts.map +1 -1
  15. package/lib/common/plugin-protocol.js +6 -1
  16. package/lib/common/plugin-protocol.js.map +1 -1
  17. package/lib/hosted/browser/hosted-plugin-watcher.js +1 -1
  18. package/lib/hosted/browser/hosted-plugin-watcher.js.map +1 -1
  19. package/lib/hosted/browser/hosted-plugin.d.ts +3 -2
  20. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  21. package/lib/hosted/browser/hosted-plugin.js +53 -68
  22. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  23. package/lib/hosted/browser/plugin-worker.js +1 -1
  24. package/lib/hosted/browser/plugin-worker.js.map +1 -1
  25. package/lib/hosted/browser/worker/worker-main.js +4 -4
  26. package/lib/hosted/browser/worker/worker-main.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-cli-contribution.js +1 -1
  28. package/lib/hosted/node/hosted-plugin-cli-contribution.js.map +1 -1
  29. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +2 -0
  30. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  31. package/lib/hosted/node/hosted-plugin-deployer-handler.js +25 -7
  32. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  33. package/lib/hosted/node/hosted-plugin-localization-service.js +3 -3
  34. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  35. package/lib/hosted/node/hosted-plugin-process.js +9 -9
  36. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  37. package/lib/hosted/node/hosted-plugin.js +6 -6
  38. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  39. package/lib/hosted/node/metadata-scanner.js +2 -2
  40. package/lib/hosted/node/metadata-scanner.js.map +1 -1
  41. package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -2
  42. package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
  43. package/lib/hosted/node/plugin-host-rpc.js +6 -6
  44. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  45. package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
  46. package/lib/hosted/node/plugin-reader.js +9 -8
  47. package/lib/hosted/node/plugin-reader.js.map +1 -1
  48. package/lib/hosted/node/plugin-service.js +9 -9
  49. package/lib/hosted/node/plugin-service.js.map +1 -1
  50. package/lib/hosted/node/scanners/backend-init-theia.js +2 -1
  51. package/lib/hosted/node/scanners/backend-init-theia.js.map +1 -1
  52. package/lib/hosted/node/scanners/file-plugin-uri-factory.js +1 -1
  53. package/lib/hosted/node/scanners/file-plugin-uri-factory.js.map +1 -1
  54. package/lib/hosted/node/scanners/grammars-reader.js +1 -1
  55. package/lib/hosted/node/scanners/grammars-reader.js.map +1 -1
  56. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  57. package/lib/hosted/node/scanners/scanner-theia.js +9 -8
  58. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  59. package/lib/hosted/node-electron/plugin-ext-hosted-electron-backend-module.js +1 -1
  60. package/lib/hosted/node-electron/plugin-ext-hosted-electron-backend-module.js.map +1 -1
  61. package/lib/hosted/node-electron/scanner-theia-electron.d.ts.map +1 -1
  62. package/lib/hosted/node-electron/scanner-theia-electron.js +1 -1
  63. package/lib/hosted/node-electron/scanner-theia-electron.js.map +1 -1
  64. package/lib/main/browser/authentication-main.d.ts +18 -11
  65. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  66. package/lib/main/browser/authentication-main.js +111 -67
  67. package/lib/main/browser/authentication-main.js.map +1 -1
  68. package/lib/main/browser/commands.js +3 -3
  69. package/lib/main/browser/commands.js.map +1 -1
  70. package/lib/main/browser/comments/comment-thread-widget.d.ts.map +1 -1
  71. package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
  72. package/lib/main/browser/comments/comments-context-key-service.d.ts +1 -1
  73. package/lib/main/browser/comments/comments-context-key-service.d.ts.map +1 -1
  74. package/lib/main/browser/comments/comments-context-key-service.js +3 -3
  75. package/lib/main/browser/comments/comments-context-key-service.js.map +1 -1
  76. package/lib/main/browser/comments/comments-contribution.js +8 -8
  77. package/lib/main/browser/comments/comments-contribution.js.map +1 -1
  78. package/lib/main/browser/comments/comments-decorator.js +1 -1
  79. package/lib/main/browser/comments/comments-decorator.js.map +1 -1
  80. package/lib/main/browser/comments/comments-main.js +1 -1
  81. package/lib/main/browser/comments/comments-main.js.map +1 -1
  82. package/lib/main/browser/comments/comments-service.js +1 -1
  83. package/lib/main/browser/comments/comments-service.js.map +1 -1
  84. package/lib/main/browser/custom-editors/custom-editor-contribution.js +2 -2
  85. package/lib/main/browser/custom-editors/custom-editor-contribution.js.map +1 -1
  86. package/lib/main/browser/custom-editors/custom-editor-opener.js +3 -3
  87. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  88. package/lib/main/browser/custom-editors/custom-editor-service.js +1 -1
  89. package/lib/main/browser/custom-editors/custom-editor-service.js.map +1 -1
  90. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts.map +1 -1
  91. package/lib/main/browser/custom-editors/custom-editor-widget.js +3 -3
  92. package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
  93. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  94. package/lib/main/browser/custom-editors/paths.js +1 -1
  95. package/lib/main/browser/custom-editors/paths.js.map +1 -1
  96. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +8 -8
  97. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  98. package/lib/main/browser/custom-editors/undo-redo-service.js +1 -1
  99. package/lib/main/browser/custom-editors/undo-redo-service.js.map +1 -1
  100. package/lib/main/browser/debug/plugin-debug-service.js +4 -4
  101. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  102. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js +4 -4
  103. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js.map +1 -1
  104. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  105. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  106. package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
  107. package/lib/main/browser/dialogs/modal-notification.js +4 -4
  108. package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
  109. package/lib/main/browser/dialogs-main.js.map +1 -1
  110. package/lib/main/browser/documents-main.js +1 -1
  111. package/lib/main/browser/documents-main.js.map +1 -1
  112. package/lib/main/browser/editor/untitled-resource.js +2 -2
  113. package/lib/main/browser/editor/untitled-resource.js.map +1 -1
  114. package/lib/main/browser/keybindings/keybindings-contribution-handler.js +2 -2
  115. package/lib/main/browser/keybindings/keybindings-contribution-handler.js.map +1 -1
  116. package/lib/main/browser/languages-main.d.ts +1 -0
  117. package/lib/main/browser/languages-main.d.ts.map +1 -1
  118. package/lib/main/browser/languages-main.js +23 -15
  119. package/lib/main/browser/languages-main.js.map +1 -1
  120. package/lib/main/browser/main-context.d.ts.map +1 -1
  121. package/lib/main/browser/main-context.js +3 -0
  122. package/lib/main/browser/main-context.js.map +1 -1
  123. package/lib/main/browser/main-file-system-event-service.js.map +1 -1
  124. package/lib/main/browser/menus/menus-contribution-handler.js +14 -14
  125. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  126. package/lib/main/browser/output-channel-registry-main.js +2 -2
  127. package/lib/main/browser/output-channel-registry-main.js.map +1 -1
  128. package/lib/main/browser/plugin-authentication-service.d.ts +29 -0
  129. package/lib/main/browser/plugin-authentication-service.d.ts.map +1 -0
  130. package/lib/main/browser/plugin-authentication-service.js +81 -0
  131. package/lib/main/browser/plugin-authentication-service.js.map +1 -0
  132. package/lib/main/browser/plugin-contribution-handler.d.ts +1 -1
  133. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  134. package/lib/main/browser/plugin-contribution-handler.js +23 -23
  135. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  136. package/lib/main/browser/plugin-ext-deploy-command.js +4 -4
  137. package/lib/main/browser/plugin-ext-deploy-command.js.map +1 -1
  138. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  139. package/lib/main/browser/plugin-ext-frontend-module.js +14 -10
  140. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  141. package/lib/main/browser/plugin-ext-widget.d.ts.map +1 -1
  142. package/lib/main/browser/plugin-ext-widget.js +6 -6
  143. package/lib/main/browser/plugin-ext-widget.js.map +1 -1
  144. package/lib/main/browser/plugin-frontend-contribution.js +3 -3
  145. package/lib/main/browser/plugin-frontend-contribution.js.map +1 -1
  146. package/lib/main/browser/plugin-frontend-view-contribution.js +1 -1
  147. package/lib/main/browser/plugin-frontend-view-contribution.js.map +1 -1
  148. package/lib/main/browser/plugin-icon-theme-service.js +11 -11
  149. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  150. package/lib/main/browser/plugin-shared-style.js +1 -1
  151. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  152. package/lib/main/browser/plugin-storage.js.map +1 -1
  153. package/lib/main/browser/quick-open-main.js +1 -1
  154. package/lib/main/browser/quick-open-main.js.map +1 -1
  155. package/lib/main/browser/scm-main.js.map +1 -1
  156. package/lib/main/browser/selection-provider-command.js +3 -3
  157. package/lib/main/browser/selection-provider-command.js.map +1 -1
  158. package/lib/main/browser/text-editor-main.js +1 -1
  159. package/lib/main/browser/text-editor-main.js.map +1 -1
  160. package/lib/main/browser/text-editor-model-service.js +3 -3
  161. package/lib/main/browser/text-editor-model-service.js.map +1 -1
  162. package/lib/main/browser/text-editors-main.js +9 -9
  163. package/lib/main/browser/text-editors-main.js.map +1 -1
  164. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +3 -3
  165. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  166. package/lib/main/browser/view/plugin-view-registry.d.ts +8 -4
  167. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  168. package/lib/main/browser/view/plugin-view-registry.js +74 -18
  169. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  170. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  171. package/lib/main/browser/view/plugin-view-widget.js +7 -7
  172. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  173. package/lib/main/browser/view/tree-view-widget.d.ts +0 -2
  174. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  175. package/lib/main/browser/view/tree-view-widget.js +16 -18
  176. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  177. package/lib/main/browser/view/view-context-key-service.js +3 -3
  178. package/lib/main/browser/view/view-context-key-service.js.map +1 -1
  179. package/lib/main/browser/view-column-service.js +4 -4
  180. package/lib/main/browser/view-column-service.js.map +1 -1
  181. package/lib/main/browser/webview/webview-environment.js +3 -3
  182. package/lib/main/browser/webview/webview-environment.js.map +1 -1
  183. package/lib/main/browser/webview/webview-frontend-security-warnings.js +4 -4
  184. package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
  185. package/lib/main/browser/webview/webview-preferences.js +1 -1
  186. package/lib/main/browser/webview/webview-preferences.js.map +1 -1
  187. package/lib/main/browser/webview/webview-resource-cache.js +1 -1
  188. package/lib/main/browser/webview/webview-resource-cache.js.map +1 -1
  189. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +2 -2
  190. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  191. package/lib/main/browser/webview/webview-theme-data-provider.js +5 -5
  192. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  193. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  194. package/lib/main/browser/webview/webview.js +17 -17
  195. package/lib/main/browser/webview/webview.js.map +1 -1
  196. package/lib/main/browser/webview-views/webview-views-main.d.ts +46 -0
  197. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -0
  198. package/lib/main/browser/webview-views/webview-views-main.js +127 -0
  199. package/lib/main/browser/webview-views/webview-views-main.js.map +1 -0
  200. package/lib/main/browser/webview-views/webview-views.d.ts +30 -0
  201. package/lib/main/browser/webview-views/webview-views.d.ts.map +1 -0
  202. package/lib/main/browser/webview-views/webview-views.js +23 -0
  203. package/lib/main/browser/webview-views/webview-views.js.map +1 -0
  204. package/lib/main/browser/webviews-main.js.map +1 -1
  205. package/lib/main/browser/window-state-main.js +1 -1
  206. package/lib/main/browser/window-state-main.js.map +1 -1
  207. package/lib/main/browser/workspace-main.d.ts +2 -0
  208. package/lib/main/browser/workspace-main.d.ts.map +1 -1
  209. package/lib/main/browser/workspace-main.js +6 -1
  210. package/lib/main/browser/workspace-main.js.map +1 -1
  211. package/lib/main/common/plugin-theia-environment.js +2 -2
  212. package/lib/main/common/plugin-theia-environment.js.map +1 -1
  213. package/lib/main/electron-browser/webview/electron-webview-widget-factory.d.ts.map +1 -1
  214. package/lib/main/electron-browser/webview/electron-webview-widget-factory.js.map +1 -1
  215. package/lib/main/node/handlers/plugin-theia-directory-handler.js +1 -1
  216. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  217. package/lib/main/node/handlers/plugin-theia-file-handler.js +3 -3
  218. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  219. package/lib/main/node/paths/plugin-paths-service.js +7 -7
  220. package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
  221. package/lib/main/node/plugin-cli-contribution.js +1 -1
  222. package/lib/main/node/plugin-cli-contribution.js.map +1 -1
  223. package/lib/main/node/plugin-deployer-contribution.js +3 -3
  224. package/lib/main/node/plugin-deployer-contribution.js.map +1 -1
  225. package/lib/main/node/plugin-deployer-impl.d.ts +3 -1
  226. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  227. package/lib/main/node/plugin-deployer-impl.js +24 -19
  228. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  229. package/lib/main/node/plugin-deployer-proxy-entry-impl.js +1 -1
  230. package/lib/main/node/plugin-deployer-proxy-entry-impl.js.map +1 -1
  231. package/lib/main/node/plugin-ext-backend-module.js +1 -1
  232. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  233. package/lib/main/node/plugin-github-resolver.js +1 -1
  234. package/lib/main/node/plugin-github-resolver.js.map +1 -1
  235. package/lib/main/node/plugin-http-resolver.js +1 -1
  236. package/lib/main/node/plugin-http-resolver.js.map +1 -1
  237. package/lib/main/node/plugin-server-handler.js +3 -3
  238. package/lib/main/node/plugin-server-handler.js.map +1 -1
  239. package/lib/main/node/plugin-service.js +2 -2
  240. package/lib/main/node/plugin-service.js.map +1 -1
  241. package/lib/main/node/plugin-theia-deployer-participant.js +2 -2
  242. package/lib/main/node/plugin-theia-deployer-participant.js.map +1 -1
  243. package/lib/main/node/plugins-key-value-storage.js +4 -4
  244. package/lib/main/node/plugins-key-value-storage.js.map +1 -1
  245. package/lib/main/node/resolvers/local-directory-plugin-deployer-resolver.js +1 -1
  246. package/lib/main/node/resolvers/local-directory-plugin-deployer-resolver.js.map +1 -1
  247. package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.js +1 -1
  248. package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.js.map +1 -1
  249. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js +1 -1
  250. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js.map +1 -1
  251. package/lib/main/node/webview-backend-security-warnings.js +1 -1
  252. package/lib/main/node/webview-backend-security-warnings.js.map +1 -1
  253. package/lib/plugin/authentication-ext.d.ts +23 -8
  254. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  255. package/lib/plugin/authentication-ext.js +28 -24
  256. package/lib/plugin/authentication-ext.js.map +1 -1
  257. package/lib/plugin/comments.js +6 -6
  258. package/lib/plugin/comments.js.map +1 -1
  259. package/lib/plugin/decorations.js +1 -1
  260. package/lib/plugin/decorations.js.map +1 -1
  261. package/lib/plugin/document-data.js +4 -4
  262. package/lib/plugin/document-data.js.map +1 -1
  263. package/lib/plugin/documents.js +1 -1
  264. package/lib/plugin/documents.js.map +1 -1
  265. package/lib/plugin/editors-and-documents.js +6 -6
  266. package/lib/plugin/editors-and-documents.js.map +1 -1
  267. package/lib/plugin/env.js +2 -2
  268. package/lib/plugin/env.js.map +1 -1
  269. package/lib/plugin/file-system-event-service-ext-impl.js +2 -2
  270. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  271. package/lib/plugin/file-system-ext-impl.js +1 -1
  272. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  273. package/lib/plugin/known-commands.js +17 -16
  274. package/lib/plugin/known-commands.js.map +1 -1
  275. package/lib/plugin/known-commands.spec.js +1 -1
  276. package/lib/plugin/known-commands.spec.js.map +1 -1
  277. package/lib/plugin/languages/code-action.d.ts +7 -1
  278. package/lib/plugin/languages/code-action.d.ts.map +1 -1
  279. package/lib/plugin/languages/code-action.js +36 -2
  280. package/lib/plugin/languages/code-action.js.map +1 -1
  281. package/lib/plugin/languages/completion.js.map +1 -1
  282. package/lib/plugin/languages/declaration.js +2 -2
  283. package/lib/plugin/languages/declaration.js.map +1 -1
  284. package/lib/plugin/languages/definition.js +2 -2
  285. package/lib/plugin/languages/definition.js.map +1 -1
  286. package/lib/plugin/languages/diagnostics.js +3 -3
  287. package/lib/plugin/languages/diagnostics.js.map +1 -1
  288. package/lib/plugin/languages/implementation.js +2 -2
  289. package/lib/plugin/languages/implementation.js.map +1 -1
  290. package/lib/plugin/languages/reference.js +1 -1
  291. package/lib/plugin/languages/reference.js.map +1 -1
  292. package/lib/plugin/languages/rename.js +1 -1
  293. package/lib/plugin/languages/rename.js.map +1 -1
  294. package/lib/plugin/languages/semantic-highlighting.js +4 -4
  295. package/lib/plugin/languages/semantic-highlighting.js.map +1 -1
  296. package/lib/plugin/languages/type-definition.js +2 -2
  297. package/lib/plugin/languages/type-definition.js.map +1 -1
  298. package/lib/plugin/languages.d.ts +2 -0
  299. package/lib/plugin/languages.d.ts.map +1 -1
  300. package/lib/plugin/languages.js +8 -1
  301. package/lib/plugin/languages.js.map +1 -1
  302. package/lib/plugin/node/debug/debug.js +7 -7
  303. package/lib/plugin/node/debug/debug.js.map +1 -1
  304. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  305. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  306. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +1 -1
  307. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  308. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +4 -4
  309. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  310. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts +34 -0
  311. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts.map +1 -0
  312. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js +45 -0
  313. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js.map +1 -0
  314. package/lib/plugin/node/env-node-ext.d.ts.map +1 -1
  315. package/lib/plugin/node/env-node-ext.js +2 -2
  316. package/lib/plugin/node/env-node-ext.js.map +1 -1
  317. package/lib/plugin/path.spec.js +3 -3
  318. package/lib/plugin/path.spec.js.map +1 -1
  319. package/lib/plugin/plugin-context.d.ts.map +1 -1
  320. package/lib/plugin/plugin-context.js +76 -32
  321. package/lib/plugin/plugin-context.js.map +1 -1
  322. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  323. package/lib/plugin/plugin-manager.js +7 -6
  324. package/lib/plugin/plugin-manager.js.map +1 -1
  325. package/lib/plugin/preference-registry.js +3 -3
  326. package/lib/plugin/preference-registry.js.map +1 -1
  327. package/lib/plugin/preferences/configuration.js +1 -1
  328. package/lib/plugin/preferences/configuration.js.map +1 -1
  329. package/lib/plugin/quick-open.d.ts.map +1 -1
  330. package/lib/plugin/quick-open.js +1 -1
  331. package/lib/plugin/quick-open.js.map +1 -1
  332. package/lib/plugin/scm.js +1 -3
  333. package/lib/plugin/scm.js.map +1 -1
  334. package/lib/plugin/status-bar/status-bar-item.d.ts +3 -2
  335. package/lib/plugin/status-bar/status-bar-item.d.ts.map +1 -1
  336. package/lib/plugin/status-bar/status-bar-item.js +5 -2
  337. package/lib/plugin/status-bar/status-bar-item.js.map +1 -1
  338. package/lib/plugin/status-bar-message-registry.d.ts +1 -1
  339. package/lib/plugin/status-bar-message-registry.d.ts.map +1 -1
  340. package/lib/plugin/status-bar-message-registry.js +2 -2
  341. package/lib/plugin/status-bar-message-registry.js.map +1 -1
  342. package/lib/plugin/text-editor.js +10 -10
  343. package/lib/plugin/text-editor.js.map +1 -1
  344. package/lib/plugin/timeline.js.map +1 -1
  345. package/lib/plugin/type-converters.js +6 -5
  346. package/lib/plugin/type-converters.js.map +1 -1
  347. package/lib/plugin/type-converters.spec.js +5 -5
  348. package/lib/plugin/type-converters.spec.js.map +1 -1
  349. package/lib/plugin/types-impl.d.ts.map +1 -1
  350. package/lib/plugin/types-impl.js +34 -32
  351. package/lib/plugin/types-impl.js.map +1 -1
  352. package/lib/plugin/webview-views.d.ts +68 -0
  353. package/lib/plugin/webview-views.d.ts.map +1 -0
  354. package/lib/plugin/webview-views.js +145 -0
  355. package/lib/plugin/webview-views.js.map +1 -0
  356. package/lib/plugin/webviews.d.ts +6 -0
  357. package/lib/plugin/webviews.d.ts.map +1 -1
  358. package/lib/plugin/webviews.js +29 -6
  359. package/lib/plugin/webviews.js.map +1 -1
  360. package/lib/plugin/workspace.d.ts +6 -0
  361. package/lib/plugin/workspace.d.ts.map +1 -1
  362. package/lib/plugin/workspace.js +21 -3
  363. package/lib/plugin/workspace.js.map +1 -1
  364. package/lib/plugin-ext-backend-electron-module.js +2 -2
  365. package/lib/plugin-ext-backend-electron-module.js.map +1 -1
  366. package/lib/plugin-ext-backend-module.js +2 -2
  367. package/lib/plugin-ext-backend-module.js.map +1 -1
  368. package/package.json +23 -23
  369. package/src/common/plugin-api-rpc-model.ts +13 -17
  370. package/src/common/plugin-api-rpc.ts +46 -14
  371. package/src/common/plugin-protocol.ts +7 -0
  372. package/src/hosted/browser/hosted-plugin.ts +20 -40
  373. package/src/hosted/node/hosted-plugin-deployer-handler.ts +23 -3
  374. package/src/hosted/node/plugin-reader.ts +2 -1
  375. package/src/hosted/node/scanners/scanner-theia.ts +2 -1
  376. package/src/hosted/node-electron/scanner-theia-electron.ts +1 -1
  377. package/src/main/browser/authentication-main.ts +137 -81
  378. package/src/main/browser/comments/comment-thread-widget.tsx +12 -12
  379. package/src/main/browser/custom-editors/custom-editor-widget.ts +5 -5
  380. package/src/main/browser/debug/plugin-debug-session-factory.ts +22 -22
  381. package/src/main/browser/dialogs/modal-notification.ts +1 -1
  382. package/src/main/browser/languages-main.ts +13 -3
  383. package/src/main/browser/main-context.ts +4 -0
  384. package/src/main/browser/plugin-authentication-service.ts +71 -0
  385. package/src/main/browser/plugin-ext-frontend-module.ts +13 -8
  386. package/src/main/browser/plugin-ext-widget.tsx +1 -1
  387. package/src/main/browser/view/plugin-view-registry.ts +73 -5
  388. package/src/main/browser/view/plugin-view-widget.ts +4 -4
  389. package/src/main/browser/view/tree-view-widget.tsx +14 -17
  390. package/src/main/browser/view-column-service.ts +1 -1
  391. package/src/main/browser/webview/webview.ts +5 -5
  392. package/src/main/browser/webview-views/webview-views-main.ts +142 -0
  393. package/src/main/browser/webview-views/webview-views.ts +38 -0
  394. package/src/main/browser/workspace-main.ts +9 -1
  395. package/src/main/electron-browser/webview/electron-webview-widget-factory.ts +4 -4
  396. package/src/main/node/paths/plugin-paths-service.ts +1 -1
  397. package/src/main/node/plugin-deployer-impl.ts +11 -7
  398. package/src/plugin/authentication-ext.ts +42 -32
  399. package/src/plugin/languages/code-action.ts +46 -3
  400. package/src/plugin/languages.ts +9 -0
  401. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +7 -7
  402. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +1 -1
  403. package/src/plugin/node/debug/plugin-inline-debug-adapter.ts +47 -0
  404. package/src/plugin/node/env-node-ext.ts +1 -1
  405. package/src/plugin/plugin-context.ts +64 -9
  406. package/src/plugin/plugin-manager.ts +2 -1
  407. package/src/plugin/quick-open.ts +13 -11
  408. package/src/plugin/status-bar/status-bar-item.ts +8 -2
  409. package/src/plugin/status-bar-message-registry.ts +3 -2
  410. package/src/plugin/types-impl.ts +8 -8
  411. package/src/plugin/webview-views.ts +213 -0
  412. package/src/plugin/webviews.ts +30 -0
  413. package/src/plugin/workspace.ts +23 -0
@@ -173,6 +173,7 @@ import { TimelineExtImpl } from './timeline';
173
173
  import { ThemingExtImpl } from './theming';
174
174
  import { CommentsExtImpl } from './comments';
175
175
  import { CustomEditorsExtImpl } from './custom-editors';
176
+ import { WebviewViewsExtImpl } from './webview-views';
176
177
 
177
178
  export function createAPIFactory(
178
179
  rpc: RPCProtocol,
@@ -211,18 +212,36 @@ export function createAPIFactory(
211
212
  const themingExt = rpc.set(MAIN_RPC_CONTEXT.THEMING_EXT, new ThemingExtImpl(rpc));
212
213
  const commentsExt = rpc.set(MAIN_RPC_CONTEXT.COMMENTS_EXT, new CommentsExtImpl(rpc, commandRegistry, documents));
213
214
  const customEditorExt = rpc.set(MAIN_RPC_CONTEXT.CUSTOM_EDITORS_EXT, new CustomEditorsExtImpl(rpc, documents, webviewExt, workspaceExt));
215
+ const webviewViewsExt = rpc.set(MAIN_RPC_CONTEXT.WEBVIEW_VIEWS_EXT, new WebviewViewsExtImpl(rpc, webviewExt));
214
216
  rpc.set(MAIN_RPC_CONTEXT.DEBUG_EXT, debugExt);
215
217
 
216
218
  return function (plugin: InternalPlugin): typeof theia {
217
219
  const authentication: typeof theia.authentication = {
218
- registerAuthenticationProvider(provider: theia.AuthenticationProvider): theia.Disposable {
219
- return authenticationExt.registerAuthenticationProvider(provider);
220
+ // support older (< 1.53.0) and newer version of authentication provider registration
221
+ registerAuthenticationProvider(
222
+ id: string | theia.AuthenticationProvider, label?: string, provider?: theia.AuthenticationProvider, options?: theia.AuthenticationProviderOptions):
223
+ theia.Disposable {
224
+ // collect registration data based on registration type: new (all parameters given) vs old (data stored in provider)
225
+ const isNewRegistration = typeof id === 'string';
226
+ const regProvider = isNewRegistration ? provider! : id;
227
+ const regId = isNewRegistration ? id : regProvider.id;
228
+ const regLabel = isNewRegistration ? label! : regProvider.label;
229
+ const regOptions = isNewRegistration ? options : { supportsMultipleAccounts: regProvider.supportsMultipleAccounts };
230
+
231
+ // ensure that all methods of the new AuthenticationProvider are available or delegate otherwise
232
+ if (!regProvider['createSession']) {
233
+ regProvider['createSession'] = (scopes: string[]) => regProvider.login(scopes);
234
+ }
235
+ if (!regProvider['removeSession']) {
236
+ regProvider['removeSession'] = (sessionId: string) => regProvider.logout(sessionId);
237
+ }
238
+ return authenticationExt.registerAuthenticationProvider(regId, regLabel, regProvider, regOptions);
220
239
  },
221
240
  get onDidChangeAuthenticationProviders(): theia.Event<theia.AuthenticationProvidersChangeEvent> {
222
241
  return authenticationExt.onDidChangeAuthenticationProviders;
223
242
  },
224
243
  getProviderIds(): Thenable<ReadonlyArray<string>> {
225
- return authenticationExt.getProviderIds();
244
+ return Promise.resolve(authenticationExt.providerIds);
226
245
  },
227
246
  get providerIds(): string[] {
228
247
  return authenticationExt.providerIds;
@@ -238,6 +257,10 @@ export function createAPIFactory(
238
257
  },
239
258
  get onDidChangeSessions(): theia.Event<theia.AuthenticationSessionsChangeEvent> {
240
259
  return authenticationExt.onDidChangeSessions;
260
+ },
261
+ async hasSession(providerId: string, scopes: readonly string[]): Promise<boolean> {
262
+ const session = await authenticationExt.getSession(plugin, providerId, scopes, { silent: true });
263
+ return !!session;
241
264
  }
242
265
  };
243
266
  const commands: typeof theia.commands = {
@@ -390,8 +413,22 @@ export function createAPIFactory(
390
413
  showInputBox(options?: theia.InputBoxOptions, token?: theia.CancellationToken): PromiseLike<string | undefined> {
391
414
  return quickOpenExt.showInput(options, token);
392
415
  },
393
- createStatusBarItem(alignment?: theia.StatusBarAlignment, priority?: number): theia.StatusBarItem {
394
- return statusBarMessageRegistryExt.createStatusBarItem(alignment, priority);
416
+ createStatusBarItem(alignmentOrId?: theia.StatusBarAlignment | string, priorityOrAlignment?: number | theia.StatusBarAlignment,
417
+ priorityArg?: number): theia.StatusBarItem {
418
+ let id: string | undefined;
419
+ let alignment: number | undefined;
420
+ let priority: number | undefined;
421
+
422
+ if (typeof alignmentOrId === 'string') {
423
+ id = alignmentOrId;
424
+ alignment = priorityOrAlignment;
425
+ priority = priorityArg;
426
+ } else {
427
+ alignment = alignmentOrId;
428
+ priority = priorityOrAlignment;
429
+ }
430
+
431
+ return statusBarMessageRegistryExt.createStatusBarItem(alignment, priority, id);
395
432
  },
396
433
  createOutputChannel(name: string): theia.OutputChannel {
397
434
  return outputChannelRegistryExt.createOutputChannel(name, pluginToPluginInfo(plugin));
@@ -410,6 +447,15 @@ export function createAPIFactory(
410
447
  options: { webviewOptions?: theia.WebviewPanelOptions, supportsMultipleEditorsPerDocument?: boolean } = {}): theia.Disposable {
411
448
  return customEditorExt.registerCustomEditorProvider(viewType, provider, options, plugin);
412
449
  },
450
+ registerWebviewViewProvider(viewType: string,
451
+ provider: theia.WebviewViewProvider,
452
+ options?: {
453
+ webviewOptions?: {
454
+ retainContextWhenHidden?: boolean
455
+ }
456
+ }): theia.Disposable {
457
+ return webviewViewsExt.registerWebviewViewProvider(viewType, provider, plugin, options?.webviewOptions);
458
+ },
413
459
  get state(): theia.WindowState {
414
460
  return windowStateExt.getWindowState();
415
461
  },
@@ -571,6 +617,15 @@ export function createAPIFactory(
571
617
  },
572
618
  registerTimelineProvider(scheme: string | string[], provider: theia.TimelineProvider): theia.Disposable {
573
619
  return timelineExt.registerTimelineProvider(plugin, scheme, provider);
620
+ },
621
+ get isTrusted(): boolean {
622
+ return workspaceExt.trusted;
623
+ },
624
+ async requestWorkspaceTrust(options?: theia.WorkspaceTrustRequestOptions): Promise<boolean | undefined> {
625
+ return workspaceExt.requestWorkspaceTrust(options);
626
+ },
627
+ get onDidGrantWorkspaceTrust(): theia.Event<void> {
628
+ return workspaceExt.onDidGrantWorkspaceTrust;
574
629
  }
575
630
  };
576
631
 
@@ -1043,7 +1098,7 @@ export class PluginExt<T> extends Plugin<T> implements ExtensionPlugin<T> {
1043
1098
  extensionUri: theia.Uri;
1044
1099
  extensionKind: ExtensionKind;
1045
1100
 
1046
- constructor(protected readonly pluginManager: PluginManager, plugin: InternalPlugin) {
1101
+ constructor(protected override readonly pluginManager: PluginManager, plugin: InternalPlugin) {
1047
1102
  super(pluginManager, plugin);
1048
1103
 
1049
1104
  this.extensionPath = this.pluginPath;
@@ -1051,15 +1106,15 @@ export class PluginExt<T> extends Plugin<T> implements ExtensionPlugin<T> {
1051
1106
  this.extensionKind = ExtensionKind.UI; // stub as a local extension (not running on a remote workspace)
1052
1107
  }
1053
1108
 
1054
- get isActive(): boolean {
1109
+ override get isActive(): boolean {
1055
1110
  return this.pluginManager.isActive(this.id);
1056
1111
  }
1057
1112
 
1058
- get exports(): T {
1113
+ override get exports(): T {
1059
1114
  return <T>this.pluginManager.getPluginExport(this.id);
1060
1115
  }
1061
1116
 
1062
- activate(): PromiseLike<T> {
1117
+ override activate(): PromiseLike<T> {
1063
1118
  return this.pluginManager.activatePlugin(this.id).then(() => this.exports);
1064
1119
  }
1065
1120
  }
@@ -91,7 +91,8 @@ export class PluginManagerExtImpl implements PluginManagerExt, PluginManager {
91
91
  'onWebviewPanel',
92
92
  'onFileSystem',
93
93
  'onCustomEditor',
94
- 'onStartupFinished'
94
+ 'onStartupFinished',
95
+ 'onAuthenticationRequest'
95
96
  ]);
96
97
 
97
98
  private configStorage: ConfigStorage | undefined;
@@ -492,11 +492,12 @@ export class InputBoxExt extends QuickInputExt implements InputBox {
492
492
  private _prompt: string | undefined;
493
493
  private _validationMessage: string | undefined;
494
494
 
495
- constructor(readonly quickOpen: QuickOpenExtImpl,
496
- readonly quickOpenMain: QuickOpenMain,
497
- readonly plugin: Plugin,
498
- onDispose: () => void) {
499
-
495
+ constructor(
496
+ override readonly quickOpen: QuickOpenExtImpl,
497
+ override readonly quickOpenMain: QuickOpenMain,
498
+ override readonly plugin: Plugin,
499
+ onDispose: () => void
500
+ ) {
500
501
  super(quickOpen, quickOpenMain, plugin, onDispose);
501
502
 
502
503
  this.buttons = [];
@@ -533,7 +534,7 @@ export class InputBoxExt extends QuickInputExt implements InputBox {
533
534
  }
534
535
  }
535
536
 
536
- async show(): Promise<void> {
537
+ override async show(): Promise<void> {
537
538
  super.show();
538
539
 
539
540
  const update = (value: string) => {
@@ -584,11 +585,12 @@ export class QuickPickExt<T extends theia.QuickPickItem> extends QuickInputExt i
584
585
  private readonly _onDidChangeActiveEmitter = new Emitter<T[]>();
585
586
  private readonly _onDidChangeSelectionEmitter = new Emitter<T[]>();
586
587
 
587
- constructor(readonly quickOpen: QuickOpenExtImpl,
588
- readonly quickOpenMain: QuickOpenMain,
589
- readonly plugin: Plugin,
590
- onDispose: () => void) {
591
-
588
+ constructor(
589
+ override readonly quickOpen: QuickOpenExtImpl,
590
+ override readonly quickOpenMain: QuickOpenMain,
591
+ override readonly plugin: Plugin,
592
+ onDispose: () => void
593
+ ) {
592
594
  super(quickOpen, quickOpenMain, plugin, onDispose);
593
595
  this.buttons = [];
594
596
 
@@ -20,7 +20,7 @@ import { UUID } from '@theia/core/shared/@phosphor/coreutils';
20
20
 
21
21
  export class StatusBarItemImpl implements theia.StatusBarItem {
22
22
 
23
- private readonly id = StatusBarItemImpl.nextId();
23
+ private _id: string;
24
24
 
25
25
  private _alignment: StatusBarAlignment;
26
26
  private _priority: number;
@@ -37,10 +37,16 @@ export class StatusBarItemImpl implements theia.StatusBarItem {
37
37
 
38
38
  constructor(_proxy: StatusBarMessageRegistryMain,
39
39
  alignment: StatusBarAlignment = StatusBarAlignment.Left,
40
- priority: number = 0) {
40
+ priority: number = 0,
41
+ id = StatusBarItemImpl.nextId()) {
41
42
  this._proxy = _proxy;
42
43
  this._alignment = alignment;
43
44
  this._priority = priority;
45
+ this._id = id;
46
+ }
47
+
48
+ public get id(): string {
49
+ return this._id;
44
50
  }
45
51
 
46
52
  public get alignment(): theia.StatusBarAlignment {
@@ -57,9 +57,10 @@ export class StatusBarMessageRegistryExt {
57
57
 
58
58
  }
59
59
 
60
- createStatusBarItem(alignment?: StatusBarAlignment, priority?: number): StatusBarItem {
61
- return new StatusBarItemImpl(this.proxy, alignment, priority);
60
+ createStatusBarItem(alignment?: StatusBarAlignment, priority?: number, id?: string): StatusBarItem {
61
+ return new StatusBarItemImpl(this.proxy, alignment, priority, id);
62
62
  }
63
+
63
64
  }
64
65
 
65
66
  // copied from https://github.com/Microsoft/vscode/blob/6c8f02b41db9ae5c4d15df767d47755e5c73b9d5/src/vs/workbench/api/node/extHostStatusBar.ts#L122
@@ -68,7 +68,7 @@ export class URI extends CodeURI implements theia.Uri {
68
68
  /**
69
69
  * Override to create the correct class.
70
70
  */
71
- with(change: {
71
+ override with(change: {
72
72
  scheme?: string;
73
73
  authority?: string | null;
74
74
  path?: string | null;
@@ -90,19 +90,19 @@ export class URI extends CodeURI implements theia.Uri {
90
90
  * Override to create the correct class.
91
91
  * @param data
92
92
  */
93
- static revive(data: UriComponents | CodeURI): URI;
94
- static revive(data: UriComponents | CodeURI | null): URI | null;
95
- static revive(data: UriComponents | CodeURI | undefined): URI | undefined
96
- static revive(data: UriComponents | CodeURI | undefined | null): URI | undefined | null {
93
+ static override revive(data: UriComponents | CodeURI): URI;
94
+ static override revive(data: UriComponents | CodeURI | null): URI | null;
95
+ static override revive(data: UriComponents | CodeURI | undefined): URI | undefined
96
+ static override revive(data: UriComponents | CodeURI | undefined | null): URI | undefined | null {
97
97
  const uri = CodeURI.revive(data);
98
98
  return uri ? new URI(uri) : undefined;
99
99
  }
100
100
 
101
- static parse(value: string, _strict?: boolean): URI {
101
+ static override parse(value: string, _strict?: boolean): URI {
102
102
  return new URI(CodeURI.parse(value, _strict));
103
103
  }
104
104
 
105
- static file(path: string): URI {
105
+ static override file(path: string): URI {
106
106
  return new URI(CodeURI.file(path));
107
107
  }
108
108
 
@@ -111,7 +111,7 @@ export class URI extends CodeURI implements theia.Uri {
111
111
  * transferring via JSON.stringify(). Making the CodeURI instance
112
112
  * makes sure we transfer this object as a vscode-uri URI.
113
113
  */
114
- toJSON(): UriComponents {
114
+ override toJSON(): UriComponents {
115
115
  return CodeURI.from(this).toJSON();
116
116
  }
117
117
  }
@@ -0,0 +1,213 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2021 SAP SE or an SAP affiliate company 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 WITH Classpath-exception-2.0
15
+ ********************************************************************************/
16
+ /*---------------------------------------------------------------------------------------------
17
+ * Copyright (c) Microsoft Corporation. All rights reserved.
18
+ * Licensed under the MIT License. See License.txt in the project root for license information.
19
+ *--------------------------------------------------------------------------------------------*/
20
+ // some of the code is copied and modified from https://github.com/microsoft/vscode/blob/e1f0f8f51390dea5df9096718fb6b647ed5a9534/src/vs/workbench/api/common/extHostWebviewView.ts
21
+
22
+ import { Disposable } from './types-impl';
23
+ import { RPCProtocol } from '../common/rpc-protocol';
24
+ import { PLUGIN_RPC_CONTEXT, WebviewViewsMain, WebviewViewsExt, Plugin } from '../common/plugin-api-rpc';
25
+ import { CancellationToken } from '@theia/core/lib/common/cancellation';
26
+ import { WebviewImpl, WebviewsExtImpl } from './webviews';
27
+ import { WebviewViewProvider } from '@theia/plugin';
28
+ import { Emitter, Event } from '@theia/core/lib/common/event';
29
+ import * as theia from '@theia/plugin';
30
+
31
+ export class WebviewViewsExtImpl implements WebviewViewsExt {
32
+
33
+ private readonly proxy: WebviewViewsMain;
34
+
35
+ protected readonly viewProviders = new Map<string, {
36
+ readonly provider: WebviewViewProvider;
37
+ readonly plugin: Plugin;
38
+ }>();
39
+ protected readonly webviewViews = new Map<string, WebviewViewExtImpl>();
40
+
41
+ constructor(rpc: RPCProtocol,
42
+ private readonly webviewsExt: WebviewsExtImpl) {
43
+ this.proxy = rpc.getProxy(PLUGIN_RPC_CONTEXT.WEBVIEW_VIEWS_MAIN);
44
+ }
45
+
46
+ registerWebviewViewProvider(
47
+ viewType: string,
48
+ provider: WebviewViewProvider,
49
+ plugin: Plugin,
50
+ webviewOptions?: {
51
+ retainContextWhenHidden?: boolean
52
+ }
53
+ ): Disposable {
54
+ if (this.viewProviders.has(viewType)) {
55
+ throw new Error(`View provider for '${viewType}' already registered`);
56
+ }
57
+
58
+ this.viewProviders.set(viewType, { provider: provider, plugin: plugin });
59
+
60
+ this.proxy.$registerWebviewViewProvider(viewType, {
61
+ retainContextWhenHidden: webviewOptions?.retainContextWhenHidden,
62
+ serializeBuffersForPostMessage: false,
63
+ });
64
+
65
+ return new Disposable(() => {
66
+ this.viewProviders.delete(viewType);
67
+ this.proxy.$unregisterWebviewViewProvider(viewType);
68
+ });
69
+ }
70
+
71
+ async $resolveWebviewView(handle: string,
72
+ viewType: string,
73
+ title: string | undefined,
74
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
75
+ state: any,
76
+ cancellation: CancellationToken
77
+ ): Promise<void> {
78
+ const entry = this.viewProviders.get(viewType);
79
+ if (!entry) {
80
+ throw new Error(`No view provider found for '${viewType}'`);
81
+ }
82
+
83
+ const { provider, plugin } = entry;
84
+
85
+ const webviewNoPanel = this.webviewsExt.createNewWebview({}, plugin, handle);
86
+ const revivedView = new WebviewViewExtImpl(handle, this.proxy, viewType, title, webviewNoPanel, true);
87
+ this.webviewViews.set(handle, revivedView);
88
+ await provider.resolveWebviewView(revivedView, { state }, cancellation);
89
+ }
90
+
91
+ async $onDidChangeWebviewViewVisibility(
92
+ handle: string,
93
+ visible: boolean
94
+ ): Promise<void> {
95
+ const webviewView = this.getWebviewView(handle);
96
+ webviewView.setVisible(visible);
97
+ webviewView.onDidChangeVisibilityEmitter.fire(visible);
98
+ }
99
+
100
+ async $disposeWebviewView(handle: string): Promise<void> {
101
+ const webviewView = this.getWebviewView(handle);
102
+ this.webviewViews.delete(handle);
103
+ webviewView.dispose();
104
+
105
+ this.webviewsExt.deleteWebview(handle);
106
+ }
107
+
108
+ protected getWebviewView(handle: string): WebviewViewExtImpl {
109
+ const entry = this.webviewViews.get(handle);
110
+ if (!entry) {
111
+ throw new Error('No webview found');
112
+ }
113
+
114
+ return entry;
115
+ }
116
+ }
117
+
118
+ export class WebviewViewExtImpl implements theia.WebviewView {
119
+
120
+ readonly onDidChangeVisibilityEmitter = new Emitter<boolean>();
121
+ readonly onDidChangeVisibility = this.onDidChangeVisibilityEmitter.event;
122
+
123
+ readonly onDidDisposeEmitter = new Emitter<void>();
124
+ readonly onDidDispose = this.onDidDisposeEmitter.event;
125
+
126
+ readonly handle: string;
127
+ readonly proxy: WebviewViewsMain;
128
+
129
+ readonly _viewType: string;
130
+ readonly _webview: WebviewImpl;
131
+
132
+ _isDisposed = false;
133
+ _isVisible: boolean;
134
+ _title: string | undefined;
135
+ _description: string | undefined;
136
+
137
+ constructor(
138
+ handle: string,
139
+ proxy: WebviewViewsMain,
140
+ viewType: string,
141
+ title: string | undefined,
142
+ webview: WebviewImpl,
143
+ isVisible: boolean,
144
+ ) {
145
+ this._viewType = viewType;
146
+ this._title = title;
147
+ this.handle = handle;
148
+ this.proxy = proxy;
149
+ this._webview = webview;
150
+ this._isVisible = isVisible;
151
+ }
152
+ onDispose: Event<void>;
153
+
154
+ dispose(): void {
155
+ if (this._isDisposed) {
156
+ return;
157
+ }
158
+
159
+ this._isDisposed = true;
160
+ this.onDidDisposeEmitter.fire();
161
+ }
162
+
163
+ get title(): string | undefined {
164
+ this.assertNotDisposed();
165
+ return this._title;
166
+ }
167
+
168
+ set title(value: string | undefined) {
169
+ this.assertNotDisposed();
170
+ if (this.title !== value) {
171
+ this.title = value;
172
+ this.proxy.$setWebviewViewTitle(this.handle, value);
173
+ }
174
+ }
175
+
176
+ get description(): string | undefined {
177
+ this.assertNotDisposed();
178
+ return this._description;
179
+ }
180
+
181
+ set description(value: string | undefined) {
182
+ this.assertNotDisposed();
183
+ if (this._description !== value) {
184
+ this._description = value;
185
+ this.proxy.$setWebviewViewDescription(this.handle, value);
186
+ }
187
+ }
188
+
189
+ get visible(): boolean { return this._isVisible; }
190
+ get webview(): WebviewImpl { return this._webview; }
191
+ get viewType(): string { return this._viewType; }
192
+
193
+ setVisible(visible: boolean): void {
194
+ if (visible === this._isVisible || this._isDisposed) {
195
+ return;
196
+ }
197
+
198
+ this._isVisible = visible;
199
+ this.onDidChangeVisibilityEmitter.fire(this._isVisible);
200
+ }
201
+
202
+ show(preserveFocus?: boolean): void {
203
+ this.assertNotDisposed();
204
+ this.proxy.$show(this.handle, !!preserveFocus);
205
+ }
206
+
207
+ protected assertNotDisposed(): void {
208
+ if (this._isDisposed) {
209
+ throw new Error('Webview is disposed');
210
+ }
211
+ }
212
+ }
213
+
@@ -27,12 +27,16 @@ import { PluginIconPath } from './plugin-icon-path';
27
27
  export class WebviewsExtImpl implements WebviewsExt {
28
28
  private readonly proxy: WebviewsMain;
29
29
  private readonly webviewPanels = new Map<string, WebviewPanelImpl>();
30
+ private readonly webviews = new Map<string, WebviewImpl>();
30
31
  private readonly serializers = new Map<string, {
31
32
  serializer: theia.WebviewPanelSerializer,
32
33
  plugin: Plugin
33
34
  }>();
34
35
  private initData: WebviewInitData | undefined;
35
36
 
37
+ readonly onDidDisposeEmitter = new Emitter<void>();
38
+ readonly onDidDispose: Event<void> = this.onDidDisposeEmitter.event;
39
+
36
40
  constructor(
37
41
  rpc: RPCProtocol,
38
42
  private readonly workspace: WorkspaceExtImpl,
@@ -49,6 +53,11 @@ export class WebviewsExtImpl implements WebviewsExt {
49
53
  const panel = this.getWebviewPanel(handle);
50
54
  if (panel) {
51
55
  panel.webview.onMessageEmitter.fire(message);
56
+ } else {
57
+ const webview = this.getWebview(handle);
58
+ if (webview) {
59
+ webview.onMessageEmitter.fire(message);
60
+ }
52
61
  }
53
62
  }
54
63
  $onDidChangeWebviewPanelViewState(handle: string, newState: WebviewPanelViewState): void {
@@ -128,6 +137,19 @@ export class WebviewsExtImpl implements WebviewsExt {
128
137
  return panel;
129
138
  }
130
139
 
140
+ createNewWebview(
141
+ options: theia.WebviewPanelOptions & theia.WebviewOptions,
142
+ plugin: Plugin,
143
+ viewId: string
144
+ ): WebviewImpl {
145
+ if (!this.initData) {
146
+ throw new Error('Webviews are not initialized');
147
+ }
148
+ const webview = new WebviewImpl(viewId, this.proxy, options, this.initData, this.workspace, plugin);
149
+ this.webviews.set(viewId, webview);
150
+ return webview;
151
+ }
152
+
131
153
  registerWebviewPanelSerializer(
132
154
  viewType: string,
133
155
  serializer: theia.WebviewPanelSerializer,
@@ -152,6 +174,14 @@ export class WebviewsExtImpl implements WebviewsExt {
152
174
  }
153
175
  return undefined;
154
176
  }
177
+
178
+ public deleteWebview(handle: string): void {
179
+ this.webviews.delete(handle);
180
+ }
181
+
182
+ public getWebview(handle: string): WebviewImpl | undefined {
183
+ return this.webviews.get(handle);
184
+ }
155
185
  }
156
186
 
157
187
  export class WebviewImpl implements theia.Webview {
@@ -56,6 +56,10 @@ export class WorkspaceExtImpl implements WorkspaceExt {
56
56
  private searchInWorkspaceEmitter: Emitter<{ result?: theia.TextSearchResult, searchId: number }> = new Emitter<{ result?: theia.TextSearchResult, searchId: number }>();
57
57
  protected workspaceSearchSequence: number = 0;
58
58
 
59
+ private _trusted?: boolean = undefined;
60
+ private didGrantWorkspaceTrustEmitter = new Emitter<void>();
61
+ public readonly onDidGrantWorkspaceTrust: Event<void> = this.didGrantWorkspaceTrustEmitter.event;
62
+
59
63
  constructor(rpc: RPCProtocol,
60
64
  private editorsAndDocuments: EditorsAndDocumentsExtImpl,
61
65
  private messageService: MessageRegistryExt) {
@@ -418,4 +422,23 @@ export class WorkspaceExtImpl implements WorkspaceExt {
418
422
  this.workspaceFileUri = URI.parse(workspace.resource.toString());
419
423
  }
420
424
  }
425
+
426
+ get trusted(): boolean {
427
+ if (this._trusted === undefined) {
428
+ this.requestWorkspaceTrust();
429
+ }
430
+ return !!this._trusted;
431
+ }
432
+
433
+ requestWorkspaceTrust(options?: theia.WorkspaceTrustRequestOptions): Promise<boolean | undefined> {
434
+ return this.proxy.$requestWorkspaceTrust(options);
435
+ }
436
+
437
+ $onWorkspaceTrustChanged(trust: boolean | undefined): void {
438
+ if (!this._trusted && trust) {
439
+ this._trusted = trust;
440
+ this.didGrantWorkspaceTrustEmitter.fire();
441
+ }
442
+ }
443
+
421
444
  }