@theia/plugin-ext 1.23.0-next.2 → 1.23.0-next.26

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 (362) 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 +12 -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 +31 -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.js +1 -1
  62. package/lib/hosted/node-electron/scanner-theia-electron.js.map +1 -1
  63. package/lib/main/browser/authentication-main.d.ts +18 -11
  64. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  65. package/lib/main/browser/authentication-main.js +111 -67
  66. package/lib/main/browser/authentication-main.js.map +1 -1
  67. package/lib/main/browser/commands.js +3 -3
  68. package/lib/main/browser/commands.js.map +1 -1
  69. package/lib/main/browser/comments/comment-thread-widget.js.map +1 -1
  70. package/lib/main/browser/comments/comments-context-key-service.d.ts +1 -1
  71. package/lib/main/browser/comments/comments-context-key-service.d.ts.map +1 -1
  72. package/lib/main/browser/comments/comments-context-key-service.js +3 -3
  73. package/lib/main/browser/comments/comments-context-key-service.js.map +1 -1
  74. package/lib/main/browser/comments/comments-contribution.js +8 -8
  75. package/lib/main/browser/comments/comments-contribution.js.map +1 -1
  76. package/lib/main/browser/comments/comments-decorator.js +1 -1
  77. package/lib/main/browser/comments/comments-decorator.js.map +1 -1
  78. package/lib/main/browser/comments/comments-main.js +1 -1
  79. package/lib/main/browser/comments/comments-main.js.map +1 -1
  80. package/lib/main/browser/comments/comments-service.js +1 -1
  81. package/lib/main/browser/comments/comments-service.js.map +1 -1
  82. package/lib/main/browser/custom-editors/custom-editor-contribution.js +2 -2
  83. package/lib/main/browser/custom-editors/custom-editor-contribution.js.map +1 -1
  84. package/lib/main/browser/custom-editors/custom-editor-opener.js +3 -3
  85. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  86. package/lib/main/browser/custom-editors/custom-editor-service.js +1 -1
  87. package/lib/main/browser/custom-editors/custom-editor-service.js.map +1 -1
  88. package/lib/main/browser/custom-editors/custom-editor-widget.js +3 -3
  89. package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
  90. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  91. package/lib/main/browser/custom-editors/paths.js +1 -1
  92. package/lib/main/browser/custom-editors/paths.js.map +1 -1
  93. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +8 -8
  94. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  95. package/lib/main/browser/custom-editors/undo-redo-service.js +1 -1
  96. package/lib/main/browser/custom-editors/undo-redo-service.js.map +1 -1
  97. package/lib/main/browser/debug/plugin-debug-service.js +4 -4
  98. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  99. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js +4 -4
  100. package/lib/main/browser/debug/plugin-debug-session-contribution-registry.js.map +1 -1
  101. package/lib/main/browser/dialogs/modal-notification.js +4 -4
  102. package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
  103. package/lib/main/browser/dialogs-main.js.map +1 -1
  104. package/lib/main/browser/documents-main.js +1 -1
  105. package/lib/main/browser/documents-main.js.map +1 -1
  106. package/lib/main/browser/editor/untitled-resource.js +2 -2
  107. package/lib/main/browser/editor/untitled-resource.js.map +1 -1
  108. package/lib/main/browser/keybindings/keybindings-contribution-handler.js +2 -2
  109. package/lib/main/browser/keybindings/keybindings-contribution-handler.js.map +1 -1
  110. package/lib/main/browser/languages-main.js +12 -12
  111. package/lib/main/browser/languages-main.js.map +1 -1
  112. package/lib/main/browser/main-context.d.ts.map +1 -1
  113. package/lib/main/browser/main-context.js +3 -0
  114. package/lib/main/browser/main-context.js.map +1 -1
  115. package/lib/main/browser/main-file-system-event-service.js.map +1 -1
  116. package/lib/main/browser/menus/menus-contribution-handler.js +14 -14
  117. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  118. package/lib/main/browser/output-channel-registry-main.js +2 -2
  119. package/lib/main/browser/output-channel-registry-main.js.map +1 -1
  120. package/lib/main/browser/plugin-authentication-service.d.ts +29 -0
  121. package/lib/main/browser/plugin-authentication-service.d.ts.map +1 -0
  122. package/lib/main/browser/plugin-authentication-service.js +81 -0
  123. package/lib/main/browser/plugin-authentication-service.js.map +1 -0
  124. package/lib/main/browser/plugin-contribution-handler.d.ts +1 -1
  125. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  126. package/lib/main/browser/plugin-contribution-handler.js +23 -23
  127. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  128. package/lib/main/browser/plugin-ext-deploy-command.js +4 -4
  129. package/lib/main/browser/plugin-ext-deploy-command.js.map +1 -1
  130. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  131. package/lib/main/browser/plugin-ext-frontend-module.js +14 -10
  132. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  133. package/lib/main/browser/plugin-ext-widget.js +6 -6
  134. package/lib/main/browser/plugin-ext-widget.js.map +1 -1
  135. package/lib/main/browser/plugin-frontend-contribution.js +3 -3
  136. package/lib/main/browser/plugin-frontend-contribution.js.map +1 -1
  137. package/lib/main/browser/plugin-frontend-view-contribution.js +1 -1
  138. package/lib/main/browser/plugin-frontend-view-contribution.js.map +1 -1
  139. package/lib/main/browser/plugin-icon-theme-service.js +11 -11
  140. package/lib/main/browser/plugin-icon-theme-service.js.map +1 -1
  141. package/lib/main/browser/plugin-shared-style.js +1 -1
  142. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  143. package/lib/main/browser/plugin-storage.js.map +1 -1
  144. package/lib/main/browser/quick-open-main.js +1 -1
  145. package/lib/main/browser/quick-open-main.js.map +1 -1
  146. package/lib/main/browser/scm-main.js.map +1 -1
  147. package/lib/main/browser/selection-provider-command.js +3 -3
  148. package/lib/main/browser/selection-provider-command.js.map +1 -1
  149. package/lib/main/browser/text-editor-main.js +1 -1
  150. package/lib/main/browser/text-editor-main.js.map +1 -1
  151. package/lib/main/browser/text-editor-model-service.js +3 -3
  152. package/lib/main/browser/text-editor-model-service.js.map +1 -1
  153. package/lib/main/browser/text-editors-main.js +9 -9
  154. package/lib/main/browser/text-editors-main.js.map +1 -1
  155. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +3 -3
  156. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  157. package/lib/main/browser/view/plugin-view-registry.d.ts +8 -4
  158. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  159. package/lib/main/browser/view/plugin-view-registry.js +74 -18
  160. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  161. package/lib/main/browser/view/plugin-view-widget.js +7 -7
  162. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  163. package/lib/main/browser/view/tree-view-widget.js +16 -16
  164. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  165. package/lib/main/browser/view/view-context-key-service.js +3 -3
  166. package/lib/main/browser/view/view-context-key-service.js.map +1 -1
  167. package/lib/main/browser/view-column-service.js +4 -4
  168. package/lib/main/browser/view-column-service.js.map +1 -1
  169. package/lib/main/browser/webview/webview-environment.js +3 -3
  170. package/lib/main/browser/webview/webview-environment.js.map +1 -1
  171. package/lib/main/browser/webview/webview-frontend-security-warnings.js +4 -4
  172. package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
  173. package/lib/main/browser/webview/webview-preferences.js +1 -1
  174. package/lib/main/browser/webview/webview-preferences.js.map +1 -1
  175. package/lib/main/browser/webview/webview-resource-cache.js +1 -1
  176. package/lib/main/browser/webview/webview-resource-cache.js.map +1 -1
  177. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +2 -2
  178. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  179. package/lib/main/browser/webview/webview-theme-data-provider.js +5 -5
  180. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  181. package/lib/main/browser/webview/webview.js +17 -17
  182. package/lib/main/browser/webview/webview.js.map +1 -1
  183. package/lib/main/browser/webview-views/webview-views-main.d.ts +46 -0
  184. package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -0
  185. package/lib/main/browser/webview-views/webview-views-main.js +127 -0
  186. package/lib/main/browser/webview-views/webview-views-main.js.map +1 -0
  187. package/lib/main/browser/webview-views/webview-views.d.ts +30 -0
  188. package/lib/main/browser/webview-views/webview-views.d.ts.map +1 -0
  189. package/lib/main/browser/webview-views/webview-views.js +23 -0
  190. package/lib/main/browser/webview-views/webview-views.js.map +1 -0
  191. package/lib/main/browser/webviews-main.js.map +1 -1
  192. package/lib/main/browser/window-state-main.js +1 -1
  193. package/lib/main/browser/window-state-main.js.map +1 -1
  194. package/lib/main/browser/workspace-main.d.ts +2 -0
  195. package/lib/main/browser/workspace-main.d.ts.map +1 -1
  196. package/lib/main/browser/workspace-main.js +6 -1
  197. package/lib/main/browser/workspace-main.js.map +1 -1
  198. package/lib/main/common/plugin-theia-environment.js +2 -2
  199. package/lib/main/common/plugin-theia-environment.js.map +1 -1
  200. package/lib/main/electron-browser/webview/electron-webview-widget-factory.js.map +1 -1
  201. package/lib/main/node/handlers/plugin-theia-directory-handler.js +1 -1
  202. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  203. package/lib/main/node/handlers/plugin-theia-file-handler.js +3 -3
  204. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  205. package/lib/main/node/paths/plugin-paths-service.js +7 -7
  206. package/lib/main/node/paths/plugin-paths-service.js.map +1 -1
  207. package/lib/main/node/plugin-cli-contribution.js +1 -1
  208. package/lib/main/node/plugin-cli-contribution.js.map +1 -1
  209. package/lib/main/node/plugin-deployer-contribution.js +3 -3
  210. package/lib/main/node/plugin-deployer-contribution.js.map +1 -1
  211. package/lib/main/node/plugin-deployer-impl.d.ts +3 -1
  212. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  213. package/lib/main/node/plugin-deployer-impl.js +24 -19
  214. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  215. package/lib/main/node/plugin-deployer-proxy-entry-impl.js +1 -1
  216. package/lib/main/node/plugin-deployer-proxy-entry-impl.js.map +1 -1
  217. package/lib/main/node/plugin-ext-backend-module.js +1 -1
  218. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  219. package/lib/main/node/plugin-github-resolver.js +1 -1
  220. package/lib/main/node/plugin-github-resolver.js.map +1 -1
  221. package/lib/main/node/plugin-http-resolver.js +1 -1
  222. package/lib/main/node/plugin-http-resolver.js.map +1 -1
  223. package/lib/main/node/plugin-server-handler.js +3 -3
  224. package/lib/main/node/plugin-server-handler.js.map +1 -1
  225. package/lib/main/node/plugin-service.js +2 -2
  226. package/lib/main/node/plugin-service.js.map +1 -1
  227. package/lib/main/node/plugin-theia-deployer-participant.js +2 -2
  228. package/lib/main/node/plugin-theia-deployer-participant.js.map +1 -1
  229. package/lib/main/node/plugins-key-value-storage.js +4 -4
  230. package/lib/main/node/plugins-key-value-storage.js.map +1 -1
  231. package/lib/main/node/resolvers/local-directory-plugin-deployer-resolver.js +1 -1
  232. package/lib/main/node/resolvers/local-directory-plugin-deployer-resolver.js.map +1 -1
  233. package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.js +1 -1
  234. package/lib/main/node/resolvers/local-file-plugin-deployer-resolver.js.map +1 -1
  235. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js +1 -1
  236. package/lib/main/node/resolvers/local-plugin-deployer-resolver.js.map +1 -1
  237. package/lib/main/node/webview-backend-security-warnings.js +1 -1
  238. package/lib/main/node/webview-backend-security-warnings.js.map +1 -1
  239. package/lib/plugin/authentication-ext.d.ts +23 -8
  240. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  241. package/lib/plugin/authentication-ext.js +28 -24
  242. package/lib/plugin/authentication-ext.js.map +1 -1
  243. package/lib/plugin/comments.js +6 -6
  244. package/lib/plugin/comments.js.map +1 -1
  245. package/lib/plugin/decorations.js +1 -1
  246. package/lib/plugin/decorations.js.map +1 -1
  247. package/lib/plugin/document-data.js +4 -4
  248. package/lib/plugin/document-data.js.map +1 -1
  249. package/lib/plugin/documents.js +1 -1
  250. package/lib/plugin/documents.js.map +1 -1
  251. package/lib/plugin/editors-and-documents.js +6 -6
  252. package/lib/plugin/editors-and-documents.js.map +1 -1
  253. package/lib/plugin/env.js +2 -2
  254. package/lib/plugin/env.js.map +1 -1
  255. package/lib/plugin/file-system-event-service-ext-impl.js +2 -2
  256. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  257. package/lib/plugin/file-system-ext-impl.js +1 -1
  258. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  259. package/lib/plugin/known-commands.js +17 -16
  260. package/lib/plugin/known-commands.js.map +1 -1
  261. package/lib/plugin/known-commands.spec.js +1 -1
  262. package/lib/plugin/known-commands.spec.js.map +1 -1
  263. package/lib/plugin/languages/completion.js.map +1 -1
  264. package/lib/plugin/languages/declaration.js +2 -2
  265. package/lib/plugin/languages/declaration.js.map +1 -1
  266. package/lib/plugin/languages/definition.js +2 -2
  267. package/lib/plugin/languages/definition.js.map +1 -1
  268. package/lib/plugin/languages/diagnostics.js +3 -3
  269. package/lib/plugin/languages/diagnostics.js.map +1 -1
  270. package/lib/plugin/languages/implementation.js +2 -2
  271. package/lib/plugin/languages/implementation.js.map +1 -1
  272. package/lib/plugin/languages/reference.js +1 -1
  273. package/lib/plugin/languages/reference.js.map +1 -1
  274. package/lib/plugin/languages/rename.js +1 -1
  275. package/lib/plugin/languages/rename.js.map +1 -1
  276. package/lib/plugin/languages/semantic-highlighting.js +4 -4
  277. package/lib/plugin/languages/semantic-highlighting.js.map +1 -1
  278. package/lib/plugin/languages/type-definition.js +2 -2
  279. package/lib/plugin/languages/type-definition.js.map +1 -1
  280. package/lib/plugin/languages.js +1 -1
  281. package/lib/plugin/languages.js.map +1 -1
  282. package/lib/plugin/node/debug/debug.js +7 -7
  283. package/lib/plugin/node/debug/debug.js.map +1 -1
  284. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +1 -1
  285. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  286. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +4 -4
  287. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  288. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts +34 -0
  289. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts.map +1 -0
  290. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js +45 -0
  291. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js.map +1 -0
  292. package/lib/plugin/node/env-node-ext.js +2 -2
  293. package/lib/plugin/node/env-node-ext.js.map +1 -1
  294. package/lib/plugin/path.spec.js +3 -3
  295. package/lib/plugin/path.spec.js.map +1 -1
  296. package/lib/plugin/plugin-context.d.ts.map +1 -1
  297. package/lib/plugin/plugin-context.js +62 -30
  298. package/lib/plugin/plugin-context.js.map +1 -1
  299. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  300. package/lib/plugin/plugin-manager.js +7 -6
  301. package/lib/plugin/plugin-manager.js.map +1 -1
  302. package/lib/plugin/preference-registry.js +3 -3
  303. package/lib/plugin/preference-registry.js.map +1 -1
  304. package/lib/plugin/preferences/configuration.js +1 -1
  305. package/lib/plugin/preferences/configuration.js.map +1 -1
  306. package/lib/plugin/quick-open.js +1 -1
  307. package/lib/plugin/quick-open.js.map +1 -1
  308. package/lib/plugin/scm.js +1 -3
  309. package/lib/plugin/scm.js.map +1 -1
  310. package/lib/plugin/text-editor.js +10 -10
  311. package/lib/plugin/text-editor.js.map +1 -1
  312. package/lib/plugin/timeline.js.map +1 -1
  313. package/lib/plugin/type-converters.js +6 -5
  314. package/lib/plugin/type-converters.js.map +1 -1
  315. package/lib/plugin/type-converters.spec.js +5 -5
  316. package/lib/plugin/type-converters.spec.js.map +1 -1
  317. package/lib/plugin/types-impl.js +34 -32
  318. package/lib/plugin/types-impl.js.map +1 -1
  319. package/lib/plugin/webview-views.d.ts +68 -0
  320. package/lib/plugin/webview-views.d.ts.map +1 -0
  321. package/lib/plugin/webview-views.js +145 -0
  322. package/lib/plugin/webview-views.js.map +1 -0
  323. package/lib/plugin/webviews.d.ts +6 -0
  324. package/lib/plugin/webviews.d.ts.map +1 -1
  325. package/lib/plugin/webviews.js +29 -6
  326. package/lib/plugin/webviews.js.map +1 -1
  327. package/lib/plugin/workspace.d.ts +6 -0
  328. package/lib/plugin/workspace.d.ts.map +1 -1
  329. package/lib/plugin/workspace.js +21 -3
  330. package/lib/plugin/workspace.js.map +1 -1
  331. package/lib/plugin-ext-backend-electron-module.js +2 -2
  332. package/lib/plugin-ext-backend-electron-module.js.map +1 -1
  333. package/lib/plugin-ext-backend-module.js +2 -2
  334. package/lib/plugin-ext-backend-module.js.map +1 -1
  335. package/package.json +23 -23
  336. package/src/common/plugin-api-rpc-model.ts +12 -17
  337. package/src/common/plugin-api-rpc.ts +43 -13
  338. package/src/common/plugin-protocol.ts +7 -0
  339. package/src/hosted/browser/hosted-plugin.ts +20 -40
  340. package/src/hosted/node/hosted-plugin-deployer-handler.ts +23 -3
  341. package/src/hosted/node/plugin-reader.ts +2 -1
  342. package/src/hosted/node/scanners/scanner-theia.ts +2 -1
  343. package/src/main/browser/authentication-main.ts +137 -81
  344. package/src/main/browser/main-context.ts +4 -0
  345. package/src/main/browser/plugin-authentication-service.ts +71 -0
  346. package/src/main/browser/plugin-ext-frontend-module.ts +13 -8
  347. package/src/main/browser/view/plugin-view-registry.ts +73 -5
  348. package/src/main/browser/view-column-service.ts +1 -1
  349. package/src/main/browser/webview-views/webview-views-main.ts +142 -0
  350. package/src/main/browser/webview-views/webview-views.ts +38 -0
  351. package/src/main/browser/workspace-main.ts +9 -1
  352. package/src/main/electron-browser/webview/electron-webview-widget-factory.ts +2 -2
  353. package/src/main/node/paths/plugin-paths-service.ts +1 -1
  354. package/src/main/node/plugin-deployer-impl.ts +11 -7
  355. package/src/plugin/authentication-ext.ts +42 -32
  356. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +1 -1
  357. package/src/plugin/node/debug/plugin-inline-debug-adapter.ts +47 -0
  358. package/src/plugin/plugin-context.ts +44 -3
  359. package/src/plugin/plugin-manager.ts +2 -1
  360. package/src/plugin/webview-views.ts +213 -0
  361. package/src/plugin/webviews.ts +30 -0
  362. package/src/plugin/workspace.ts +23 -0
@@ -62,6 +62,7 @@ import { JsonSchemaStore } from '@theia/core/lib/browser/json-schema-store';
62
62
  import { FileService, FileSystemProviderActivationEvent } from '@theia/filesystem/lib/browser/file-service';
63
63
  import { PluginCustomEditorRegistry } from '../../main/browser/custom-editors/plugin-custom-editor-registry';
64
64
  import { CustomEditorWidget } from '../../main/browser/custom-editors/custom-editor-widget';
65
+ import { Measurement, Stopwatch } from '@theia/core/lib/common';
65
66
 
66
67
  export type PluginHost = 'frontend' | string;
67
68
  export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker' | 'onDebugDynamicConfigurations';
@@ -154,6 +155,9 @@ export class HostedPluginSupport {
154
155
  @inject(PluginCustomEditorRegistry)
155
156
  protected readonly customEditorRegistry: PluginCustomEditorRegistry;
156
157
 
158
+ @inject(Stopwatch)
159
+ protected readonly stopwatch: Stopwatch;
160
+
157
161
  private theiaReadyPromise: Promise<any>;
158
162
 
159
163
  protected readonly managers = new Map<string, PluginManagerExt>();
@@ -302,15 +306,15 @@ export class HostedPluginSupport {
302
306
  */
303
307
  protected async syncPlugins(): Promise<void> {
304
308
  let initialized = 0;
305
- const waitPluginsMeasurement = this.createMeasurement('waitForDeployment');
306
- let syncPluginsMeasurement: () => number;
309
+ const waitPluginsMeasurement = this.measure('waitForDeployment');
310
+ let syncPluginsMeasurement: Measurement | undefined;
307
311
 
308
312
  const toUnload = new Set(this.contributions.keys());
309
313
  try {
310
314
  const pluginIds: string[] = [];
311
315
  const deployedPluginIds = await this.server.getDeployedPluginIds();
312
- this.logMeasurement('Waiting for backend deployment', waitPluginsMeasurement);
313
- syncPluginsMeasurement = this.createMeasurement('syncPlugins');
316
+ waitPluginsMeasurement.log('Waiting for backend deployment');
317
+ syncPluginsMeasurement = this.measure('syncPlugins');
314
318
  for (const pluginId of deployedPluginIds) {
315
319
  toUnload.delete(pluginId);
316
320
  if (!this.contributions.has(pluginId)) {
@@ -337,9 +341,14 @@ export class HostedPluginSupport {
337
341
  if (initialized || toUnload.size) {
338
342
  this.onDidChangePluginsEmitter.fire(undefined);
339
343
  }
344
+
345
+ if (!syncPluginsMeasurement) {
346
+ // await didn't complete normally
347
+ waitPluginsMeasurement.error('Backend deployment failed.');
348
+ }
340
349
  }
341
350
 
342
- this.logMeasurement(`Sync of ${this.getPluginCount(initialized)}`, syncPluginsMeasurement);
351
+ syncPluginsMeasurement?.log(`Sync of ${this.getPluginCount(initialized)}`);
343
352
  }
344
353
 
345
354
  /**
@@ -348,7 +357,7 @@ export class HostedPluginSupport {
348
357
  */
349
358
  protected loadContributions(toDisconnect: DisposableCollection): Map<PluginHost, PluginContributions[]> {
350
359
  let loaded = 0;
351
- const loadPluginsMeasurement = this.createMeasurement('loadPlugins');
360
+ const loadPluginsMeasurement = this.measure('loadPlugins');
352
361
 
353
362
  const hostContributions = new Map<PluginHost, PluginContributions[]>();
354
363
  for (const contributions of this.contributions.values()) {
@@ -377,14 +386,14 @@ export class HostedPluginSupport {
377
386
  }
378
387
  }
379
388
 
380
- this.logMeasurement(`Load contributions of ${this.getPluginCount(loaded)}`, loadPluginsMeasurement);
389
+ loadPluginsMeasurement.log(`Load contributions of ${this.getPluginCount(loaded)}`);
381
390
 
382
391
  return hostContributions;
383
392
  }
384
393
 
385
394
  protected async startPlugins(contributionsByHost: Map<PluginHost, PluginContributions[]>, toDisconnect: DisposableCollection): Promise<void> {
386
395
  let started = 0;
387
- const startPluginsMeasurement = this.createMeasurement('startPlugins');
396
+ const startPluginsMeasurement = this.measure('startPlugins');
388
397
 
389
398
  const [hostLogPath, hostStoragePath, hostGlobalStoragePath] = await Promise.all([
390
399
  this.pluginPathsService.getHostLogPath(),
@@ -447,7 +456,7 @@ export class HostedPluginSupport {
447
456
  return;
448
457
  }
449
458
 
450
- this.logMeasurement(`Start of ${this.getPluginCount(started)}`, startPluginsMeasurement);
459
+ startPluginsMeasurement.log(`Start of ${this.getPluginCount(started)}`);
451
460
  }
452
461
 
453
462
  protected async obtainManager(host: string, hostContributions: PluginContributions[], toDisconnect: DisposableCollection): Promise<PluginManagerExt | undefined> {
@@ -693,37 +702,8 @@ export class HostedPluginSupport {
693
702
  await Promise.all(activation);
694
703
  }
695
704
 
696
- protected createMeasurement(name: string): () => number {
697
- const startMarker = `${name}-start`;
698
- const endMarker = `${name}-end`;
699
- performance.clearMeasures(name);
700
- performance.clearMarks(startMarker);
701
- performance.clearMarks(endMarker);
702
-
703
- performance.mark(startMarker);
704
- return () => {
705
- performance.mark(endMarker);
706
- performance.measure(name, startMarker, endMarker);
707
-
708
- const entries = performance.getEntriesByName(name);
709
- const duration = entries.length > 0 ? entries[0].duration : Number.NaN;
710
-
711
- performance.clearMeasures(name);
712
- performance.clearMarks(startMarker);
713
- performance.clearMarks(endMarker);
714
- return duration;
715
- };
716
- }
717
-
718
- protected logMeasurement(measurementName: string, measurement: () => number): void {
719
- const duration = measurement();
720
- if (duration === Number.NaN) {
721
- // Measurement was prevented by native API, do not log NaN duration
722
- return;
723
- }
724
-
725
- const timeFromFrontendStart = `Finished ${(performance.now() / 1000).toFixed(3)} s after frontend start`;
726
- console.log(`[${this.clientId}] ${measurementName} took: ${duration.toFixed(1)} ms [${timeFromFrontendStart}]`);
705
+ protected measure(name: string): Measurement {
706
+ return this.stopwatch.start(name, { context: this.clientId });
727
707
  }
728
708
 
729
709
  protected getPluginCount(plugins: number): string {
@@ -21,6 +21,7 @@ import { PluginDeployerHandler, PluginDeployerEntry, PluginEntryPoint, DeployedP
21
21
  import { HostedPluginReader } from './plugin-reader';
22
22
  import { Deferred } from '@theia/core/lib/common/promise-util';
23
23
  import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
24
+ import { Stopwatch } from '@theia/core/lib/common';
24
25
 
25
26
  @injectable()
26
27
  export class HostedPluginDeployerHandler implements PluginDeployerHandler {
@@ -34,6 +35,9 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
34
35
  @inject(HostedPluginLocalizationService)
35
36
  private readonly localizationService: HostedPluginLocalizationService;
36
37
 
38
+ @inject(Stopwatch)
39
+ protected readonly stopwatch: Stopwatch;
40
+
37
41
  private readonly deployedLocations = new Map<string, Set<string>>();
38
42
 
39
43
  /**
@@ -118,9 +122,11 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
118
122
  */
119
123
  protected async deployPlugin(entry: PluginDeployerEntry, entryPoint: keyof PluginEntryPoint): Promise<void> {
120
124
  const pluginPath = entry.path();
125
+ const deployPlugin = this.stopwatch.start('deployPlugin');
121
126
  try {
122
127
  const manifest = await this.reader.readPackage(pluginPath);
123
128
  if (!manifest) {
129
+ deployPlugin.error(`Failed to read ${entryPoint} plugin manifest from '${pluginPath}''`);
124
130
  return;
125
131
  }
126
132
 
@@ -132,6 +138,7 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
132
138
 
133
139
  const deployedPlugins = entryPoint === 'backend' ? this.deployedBackendPlugins : this.deployedFrontendPlugins;
134
140
  if (deployedPlugins.has(metadata.model.id)) {
141
+ deployPlugin.debug(`Skipped ${entryPoint} plugin ${metadata.model.name} already deployed`);
135
142
  return;
136
143
  }
137
144
 
@@ -140,9 +147,9 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
140
147
  deployed.contributes = this.reader.readContribution(manifest);
141
148
  this.localizationService.deployLocalizations(deployed);
142
149
  deployedPlugins.set(metadata.model.id, deployed);
143
- this.logger.info(`Deploying ${entryPoint} plugin "${metadata.model.name}@${metadata.model.version}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`);
150
+ deployPlugin.log(`Deployed ${entryPoint} plugin "${metadata.model.name}@${metadata.model.version}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`);
144
151
  } catch (e) {
145
- console.error(`Failed to deploy ${entryPoint} plugin from '${pluginPath}' path`, e);
152
+ deployPlugin.error(`Failed to deploy ${entryPoint} plugin from '${pluginPath}' path`, e);
146
153
  }
147
154
  }
148
155
 
@@ -153,14 +160,27 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
153
160
  if (!deployedLocations) {
154
161
  return false;
155
162
  }
163
+
164
+ const undeployPlugin = this.stopwatch.start('undeployPlugin');
156
165
  this.deployedLocations.delete(pluginId);
166
+ let undeployError: unknown;
167
+ const failedLocations: string[] = [];
168
+
157
169
  for (const location of deployedLocations) {
158
170
  try {
159
171
  await fs.remove(location);
160
172
  } catch (e) {
161
- console.error(`[${pluginId}]: failed to undeploy from "${location}", reason`, e);
173
+ failedLocations.push(location);
174
+ undeployError = undeployError ?? e;
162
175
  }
163
176
  }
177
+
178
+ if (undeployError) {
179
+ undeployPlugin.error(`[${pluginId}]: failed to undeploy from locations "${failedLocations}". First reason:`, undeployError);
180
+ } else {
181
+ undeployPlugin.log(`[${pluginId}]: undeployed from "${location}"`);
182
+ }
183
+
164
184
  return true;
165
185
  }
166
186
  }
@@ -58,7 +58,8 @@ export class HostedPluginReader implements BackendApplicationContribution {
58
58
  // the request was already closed
59
59
  return;
60
60
  }
61
- if ('code' in e && e['code'] === 'ENOENT') {
61
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
62
+ if ((e as any)['code'] === 'ENOENT') {
62
63
  res.status(404).send(`No such file found in '${escape_html(pluginId)}' plugin.`);
63
64
  } else {
64
65
  res.status(500).send(`Failed to transfer a file from '${escape_html(pluginId)}' plugin.`);
@@ -572,7 +572,8 @@ export class TheiaPluginScanner implements PluginScanner {
572
572
  const result: View = {
573
573
  id: rawView.id,
574
574
  name: rawView.name,
575
- when: rawView.when
575
+ when: rawView.when,
576
+ type: rawView.type
576
577
  };
577
578
 
578
579
  return result;
@@ -21,21 +21,21 @@
21
21
  // code copied and modified from https://github.com/microsoft/vscode/blob/1.47.3/src/vs/workbench/api/browser/mainThreadAuthentication.ts
22
22
 
23
23
  import { interfaces } from '@theia/core/shared/inversify';
24
- import { AuthenticationExt, AuthenticationMain, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc';
24
+ import { AuthenticationExt, AuthenticationMain, PluginManagerExt, MAIN_RPC_CONTEXT } from '../../common/plugin-api-rpc';
25
25
  import { RPCProtocol } from '../../common/rpc-protocol';
26
26
  import { MessageService } from '@theia/core/lib/common/message-service';
27
- import { StorageService } from '@theia/core/lib/browser';
27
+ import { Dialog, StorageService } from '@theia/core/lib/browser';
28
28
  import {
29
29
  AuthenticationProvider,
30
30
  AuthenticationService,
31
31
  readAllowedExtensions
32
32
  } from '@theia/core/lib/browser/authentication-service';
33
33
  import { QuickPickService } from '@theia/core/lib/common/quick-pick-service';
34
- import {
35
- AuthenticationSession,
36
- AuthenticationSessionsChangeEvent
37
- } from '../../common/plugin-api-rpc-model';
34
+ import * as theia from '@theia/plugin';
38
35
  import { QuickPickValue } from '@theia/core/lib/browser/quick-input/quick-input-service';
36
+ import { nls } from '@theia/core/lib/common/nls';
37
+
38
+ export function getAuthenticationProviderActivationEvent(id: string): string { return `onAuthenticationRequest:${id}`; }
39
39
 
40
40
  export class AuthenticationMainImpl implements AuthenticationMain {
41
41
  private readonly proxy: AuthenticationExt;
@@ -43,15 +43,17 @@ export class AuthenticationMainImpl implements AuthenticationMain {
43
43
  private readonly storageService: StorageService;
44
44
  private readonly authenticationService: AuthenticationService;
45
45
  private readonly quickPickService: QuickPickService;
46
+ private readonly extensionService: PluginManagerExt;
46
47
  constructor(rpc: RPCProtocol, container: interfaces.Container) {
47
48
  this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.AUTHENTICATION_EXT);
48
49
  this.messageService = container.get(MessageService);
49
50
  this.storageService = container.get(StorageService);
50
51
  this.authenticationService = container.get(AuthenticationService);
51
52
  this.quickPickService = container.get(QuickPickService);
53
+ this.extensionService = rpc.getProxy(MAIN_RPC_CONTEXT.HOSTED_PLUGIN_MANAGER_EXT);
52
54
 
53
55
  this.authenticationService.onDidChangeSessions(e => {
54
- this.proxy.$onDidChangeAuthenticationSessions(e.providerId, e.label, e.event);
56
+ this.proxy.$onDidChangeAuthenticationSessions(e.providerId, e.label);
55
57
  });
56
58
  this.authenticationService.onDidRegisterAuthenticationProvider(info => {
57
59
  this.proxy.$onDidChangeAuthenticationProviders([info], []);
@@ -73,7 +75,7 @@ export class AuthenticationMainImpl implements AuthenticationMain {
73
75
  this.authenticationService.unregisterAuthenticationProvider(id);
74
76
  }
75
77
 
76
- async $updateSessions(id: string, event: AuthenticationSessionsChangeEvent): Promise<void> {
78
+ async $updateSessions(id: string, event: theia.AuthenticationProviderAuthenticationSessionsChangeEvent): Promise<void> {
77
79
  this.authenticationService.updateSessions(id, event);
78
80
  }
79
81
 
@@ -86,75 +88,85 @@ export class AuthenticationMainImpl implements AuthenticationMain {
86
88
  }
87
89
 
88
90
  async $getSession(providerId: string, scopes: string[], extensionId: string, extensionName: string,
89
- options: { createIfNone: boolean, clearSessionPreference: boolean }): Promise<AuthenticationSession | undefined> {
90
- const orderedScopes = scopes.sort().join(' ');
91
- const sessions = (await this.authenticationService.getSessions(providerId)).filter(session => session.scopes.slice().sort().join(' ') === orderedScopes);
92
- const label = this.authenticationService.getLabel(providerId);
93
-
94
- if (sessions.length) {
95
- if (!this.authenticationService.supportsMultipleAccounts(providerId)) {
96
- const session = sessions[0];
97
- const allowed = await this.getSessionsPrompt(providerId, session.account.label, label, extensionId, extensionName);
98
- if (allowed) {
99
- return session;
91
+ options: theia.AuthenticationGetSessionOptions): Promise<theia.AuthenticationSession | undefined> {
92
+ const sessions = await this.authenticationService.getSessions(providerId, scopes);
93
+
94
+ // Error cases
95
+ if (options.forceNewSession && !sessions.length) {
96
+ throw new Error('No existing sessions found.');
97
+ }
98
+ if (options.forceNewSession && options.createIfNone) {
99
+ throw new Error('Invalid combination of options. Please remove one of the following: forceNewSession, createIfNone');
100
+ }
101
+ if (options.forceNewSession && options.silent) {
102
+ throw new Error('Invalid combination of options. Please remove one of the following: forceNewSession, silent');
103
+ }
104
+ if (options.createIfNone && options.silent) {
105
+ throw new Error('Invalid combination of options. Please remove one of the following: createIfNone, silent');
106
+ }
107
+
108
+ const supportsMultipleAccounts = this.authenticationService.supportsMultipleAccounts(providerId);
109
+ // Check if the sessions we have are valid
110
+ if (!options.forceNewSession && sessions.length) {
111
+ if (supportsMultipleAccounts) {
112
+ if (options.clearSessionPreference) {
113
+ await this.storageService.setData(`authentication-session-${extensionName}-${providerId}`, undefined);
100
114
  } else {
101
- throw new Error('User did not consent to login.');
115
+ const existingSessionPreference = await this.storageService.getData(`authentication-session-${extensionName}-${providerId}`);
116
+ if (existingSessionPreference) {
117
+ const matchingSession = sessions.find(session => session.id === existingSessionPreference);
118
+ if (matchingSession && await this.isAccessAllowed(providerId, matchingSession.account.label, extensionId)) {
119
+ return matchingSession;
120
+ }
121
+ }
102
122
  }
123
+ } else if (await this.isAccessAllowed(providerId, sessions[0].account.label, extensionId)) {
124
+ return sessions[0];
103
125
  }
126
+ }
104
127
 
105
- // On renderer side, confirm consent, ask user to choose between accounts if multiple sessions are valid
106
- const selected = await this.selectSession(providerId, label, extensionId, extensionName, sessions, scopes, !!options.clearSessionPreference);
107
- return sessions.find(session => session.id === selected.id);
108
- } else {
109
- if (options.createIfNone) {
110
- const isAllowed = await this.loginPrompt(label, extensionName);
111
- if (!isAllowed) {
112
- throw new Error('User did not consent to login.');
113
- }
114
-
115
- const session = await this.authenticationService.login(providerId, scopes);
116
- await this.setTrustedExtensionAndAccountPreference(providerId, session.account.label, extensionId, extensionName, session.id);
117
- return session;
118
- } else {
119
- await this.requestNewSession(providerId, scopes, extensionId, extensionName);
120
- return undefined;
128
+ // We may need to prompt because we don't have a valid session modal flows
129
+ if (options.createIfNone || options.forceNewSession) {
130
+ const providerName = this.authenticationService.getLabel(providerId);
131
+ const detail = (typeof options.forceNewSession === 'object') ? options.forceNewSession!.detail : undefined;
132
+ const isAllowed = await this.loginPrompt(providerName, extensionName, !!options.forceNewSession, detail);
133
+ if (!isAllowed) {
134
+ throw new Error('User did not consent to login.');
121
135
  }
136
+
137
+ const session = sessions?.length && !options.forceNewSession && supportsMultipleAccounts
138
+ ? await this.selectSession(providerId, providerName, extensionId, extensionName, sessions, scopes, !!options.clearSessionPreference)
139
+ : await this.authenticationService.login(providerId, scopes);
140
+ await this.setTrustedExtensionAndAccountPreference(providerId, session.account.label, extensionId, extensionName, session.id);
141
+ return session;
142
+ }
143
+
144
+ // passive flows (silent or default)
145
+ const validSession = sessions.find(s => this.isAccessAllowed(providerId, s.account.label, extensionId));
146
+ if (!options.silent && !validSession) {
147
+ this.authenticationService.requestNewSession(providerId, scopes, extensionId, extensionName);
122
148
  }
149
+ return validSession;
123
150
  }
124
151
 
125
152
  protected async selectSession(providerId: string, providerName: string, extensionId: string, extensionName: string,
126
- potentialSessions: AuthenticationSession[], scopes: string[], clearSessionPreference: boolean): Promise<AuthenticationSession> {
153
+ potentialSessions: Readonly<theia.AuthenticationSession[]>, scopes: string[], clearSessionPreference: boolean): Promise<theia.AuthenticationSession> {
127
154
  if (!potentialSessions.length) {
128
155
  throw new Error('No potential sessions found');
129
156
  }
130
157
 
131
- if (clearSessionPreference) {
132
- await this.storageService.setData(`authentication-session-${extensionName}-${providerId}`, undefined);
133
- } else {
134
- const existingSessionPreference = await this.storageService.getData(`authentication-session-${extensionName}-${providerId}`);
135
- if (existingSessionPreference) {
136
- const matchingSession = potentialSessions.find(session => session.id === existingSessionPreference);
137
- if (matchingSession) {
138
- const allowed = await this.getSessionsPrompt(providerId, matchingSession.account.label, providerName, extensionId, extensionName);
139
- if (allowed) {
140
- return matchingSession;
141
- }
142
- }
143
- }
144
- }
145
-
146
158
  return new Promise(async (resolve, reject) => {
147
- const items: QuickPickValue<{ session?: AuthenticationSession }>[] = potentialSessions.map(session => ({
159
+ const items: QuickPickValue<{ session?: theia.AuthenticationSession }>[] = potentialSessions.map(session => ({
148
160
  label: session.account.label,
149
161
  value: { session }
150
162
  }));
151
163
  items.push({
152
- label: 'Sign in to another account',
164
+ label: nls.localizeByDefault('Sign in to another account'),
153
165
  value: { session: undefined }
154
166
  });
155
167
  const selected = await this.quickPickService.show(items,
156
168
  {
157
- title: `The extension '${extensionName}' wants to access a ${providerName} account`,
169
+ title: nls.localizeByDefault("The extension '{0}' wants to access a {1} account", extensionName, providerName),
158
170
  ignoreFocusOut: true
159
171
  });
160
172
  if (selected) {
@@ -196,20 +208,39 @@ export class AuthenticationMainImpl implements AuthenticationMain {
196
208
  return allow;
197
209
  }
198
210
 
199
- protected async loginPrompt(providerName: string, extensionName: string): Promise<boolean> {
200
- const choice = await this.messageService.info(`The extension '${extensionName}' wants to sign in using ${providerName}.`, 'Allow', 'Cancel');
211
+ protected async loginPrompt(providerName: string, extensionName: string, recreatingSession: boolean, _detail?: string): Promise<boolean> {
212
+ const message = recreatingSession
213
+ ? nls.localizeByDefault("The extension '{0}' wants you to sign in again using {1}.", extensionName, providerName)
214
+ : nls.localizeByDefault("The extension '{0}' wants to sign in using {1}.", extensionName, providerName);
215
+ const choice = await this.messageService.info(message, 'Allow', 'Cancel');
201
216
  return choice === 'Allow';
202
217
  }
203
218
 
219
+ protected async isAccessAllowed(providerId: string, accountName: string, extensionId: string): Promise<boolean> {
220
+ const allowList = await readAllowedExtensions(this.storageService, providerId, accountName);
221
+ return !!allowList.find(allowed => allowed.id === extensionId);
222
+ }
223
+
204
224
  protected async setTrustedExtensionAndAccountPreference(providerId: string, accountName: string, extensionId: string, extensionName: string, sessionId: string): Promise<void> {
205
225
  const allowList = await readAllowedExtensions(this.storageService, providerId, accountName);
206
226
  if (!allowList.find(allowed => allowed.id === extensionId)) {
207
227
  allowList.push({ id: extensionId, name: extensionName });
208
228
  this.storageService.setData(`authentication-trusted-extensions-${providerId}-${accountName}`, JSON.stringify(allowList));
209
229
  }
210
-
211
230
  this.storageService.setData(`authentication-session-${extensionName}-${providerId}`, sessionId);
212
231
  }
232
+
233
+ $ensureProvider(id: string): Promise<void> {
234
+ return this.extensionService.$activateByEvent(getAuthenticationProviderActivationEvent(id));
235
+ }
236
+
237
+ $removeSession(providerId: string, sessionId: string): Promise<void> {
238
+ return this.authenticationService.logout(providerId, sessionId);
239
+ }
240
+
241
+ $sendDidChangeSessions(providerId: string, event: theia.AuthenticationProviderAuthenticationSessionsChangeEvent): void {
242
+ this.authenticationService.updateSessions(providerId, event);
243
+ }
213
244
  }
214
245
 
215
246
  async function addAccountUsage(storageService: StorageService, providerId: string, accountName: string, extensionId: string, extensionName: string): Promise<void> {
@@ -244,6 +275,8 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
244
275
  private accounts = new Map<string, string[]>(); // Map account name to session ids
245
276
  private sessions = new Map<string, string>(); // Map account id to name
246
277
 
278
+ readonly onDidChangeSessions: theia.Event<theia.AuthenticationProviderAuthenticationSessionsChangeEvent>;
279
+
247
280
  constructor(
248
281
  private readonly proxy: AuthenticationExt,
249
282
  public readonly id: string,
@@ -257,7 +290,7 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
257
290
  return !!this.sessions.size;
258
291
  }
259
292
 
260
- private registerSession(session: AuthenticationSession): void {
293
+ private registerSession(session: theia.AuthenticationSession): void {
261
294
  this.sessions.set(session.id, session.account.label);
262
295
 
263
296
  const existingSessionsForAccount = this.accounts.get(session.account.label);
@@ -272,34 +305,41 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
272
305
  async signOut(accountName: string): Promise<void> {
273
306
  const accountUsages = await readAccountUsages(this.storageService, this.id, accountName);
274
307
  const sessionsForAccount = this.accounts.get(accountName);
275
- const result = await this.messageService.info(accountUsages.length ? `The account ${accountName} has been used by:
276
- ${accountUsages.map(usage => usage.extensionName).join(', ')}. Sign out of these features?` : `Sign out of ${accountName}?`, 'Yes');
277
-
278
- if (result && result === 'Yes' && sessionsForAccount) {
308
+ const result = await this.messageService.info(accountUsages.length
309
+ ? nls.localizeByDefault("The account '{0}' has been used by: \n\n{1}\n\n Sign out from these extensions?", accountName,
310
+ accountUsages.map(usage => usage.extensionName).join(', '))
311
+ : nls.localizeByDefault("Sign out of '{0}'?", accountName),
312
+ nls.localizeByDefault('Sign Out'),
313
+ Dialog.CANCEL);
314
+
315
+ if (result && result === nls.localizeByDefault('Sign Out') && sessionsForAccount) {
279
316
  sessionsForAccount.forEach(sessionId => this.logout(sessionId));
280
317
  removeAccountUsage(this.storageService, this.id, accountName);
281
318
  }
282
319
  }
283
320
 
284
- async getSessions(): Promise<ReadonlyArray<AuthenticationSession>> {
285
- return this.proxy.$getSessions(this.id);
321
+ async getSessions(scopes?: string[]): Promise<ReadonlyArray<theia.AuthenticationSession>> {
322
+ return this.proxy.$getSessions(this.id, scopes);
286
323
  }
287
324
 
288
- async updateSessionItems(event: AuthenticationSessionsChangeEvent): Promise<void> {
325
+ async updateSessionItems(event: theia.AuthenticationProviderAuthenticationSessionsChangeEvent): Promise<void> {
289
326
  const { added, removed } = event;
290
327
  const session = await this.proxy.$getSessions(this.id);
291
- const addedSessions = session.filter(s => added.some(id => id === s.id));
292
-
293
- removed.forEach(sessionId => {
294
- const accountName = this.sessions.get(sessionId);
295
- if (accountName) {
296
- this.sessions.delete(sessionId);
297
- const sessionsForAccount = this.accounts.get(accountName) || [];
298
- const sessionIndex = sessionsForAccount.indexOf(sessionId);
299
- sessionsForAccount.splice(sessionIndex);
300
-
301
- if (!sessionsForAccount.length) {
302
- this.accounts.delete(accountName);
328
+ const addedSessions = session.filter(s => added.some(addedSession => this.getSessionId(addedSession) === s.id));
329
+
330
+ removed.forEach(removedSession => {
331
+ const sessionId = this.getSessionId(removedSession);
332
+ if (sessionId) {
333
+ const accountName = this.sessions.get(sessionId);
334
+ if (accountName) {
335
+ this.sessions.delete(sessionId);
336
+ const sessionsForAccount = this.accounts.get(accountName) || [];
337
+ const sessionIndex = sessionsForAccount.indexOf(sessionId);
338
+ sessionsForAccount.splice(sessionIndex);
339
+
340
+ if (!sessionsForAccount.length) {
341
+ this.accounts.delete(accountName);
342
+ }
303
343
  }
304
344
  }
305
345
  });
@@ -307,14 +347,30 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
307
347
  addedSessions.forEach(s => this.registerSession(s));
308
348
  }
309
349
 
310
- login(scopes: string[]): Promise<AuthenticationSession> {
311
- return this.proxy.$login(this.id, scopes);
350
+ login(scopes: string[]): Promise<theia.AuthenticationSession> {
351
+ return this.proxy.$createSession(this.id, scopes);
312
352
  }
313
353
 
314
354
  async logout(sessionId: string): Promise<void> {
315
- await this.proxy.$logout(this.id, sessionId);
355
+ await this.proxy.$removeSession(this.id, sessionId);
316
356
  this.messageService.info('Successfully signed out.');
317
357
  }
358
+
359
+ createSession(scopes: string[]): Thenable<theia.AuthenticationSession> {
360
+ return this.login(scopes);
361
+ }
362
+
363
+ removeSession(sessionId: string): Thenable<void> {
364
+ return this.logout(sessionId);
365
+ }
366
+
367
+ // utility method to be backwards compatible with the old AuthenticationProviderAuthenticationSessionsChangeEvent containing only the session id string
368
+ private getSessionId(obj: string | theia.AuthenticationSession | undefined): string | undefined {
369
+ if (!obj || typeof obj === 'string') {
370
+ return obj;
371
+ }
372
+ return obj.id;
373
+ }
318
374
  }
319
375
 
320
376
  async function readAccountUsages(storageService: StorageService, providerId: string, accountName: string): Promise<AccountUsage[]> {
@@ -56,6 +56,7 @@ import { ThemingMainImpl } from './theming-main';
56
56
  import { CommentsMainImp } from './comments/comments-main';
57
57
  import { CustomEditorsMainImpl } from './custom-editors/custom-editors-main';
58
58
  import { SecretsMainImpl } from './secrets-main';
59
+ import { WebviewViewsMainImpl } from './webview-views/webview-views-main';
59
60
 
60
61
  export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container): void {
61
62
  const authenticationMain = new AuthenticationMainImpl(rpc, container);
@@ -127,6 +128,9 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
127
128
  const customEditorsMain = new CustomEditorsMainImpl(rpc, container, webviewsMain);
128
129
  rpc.set(PLUGIN_RPC_CONTEXT.CUSTOM_EDITORS_MAIN, customEditorsMain);
129
130
 
131
+ const webviewViewsMain = new WebviewViewsMainImpl(rpc, container, webviewsMain);
132
+ rpc.set(PLUGIN_RPC_CONTEXT.WEBVIEW_VIEWS_MAIN, webviewViewsMain);
133
+
130
134
  const storageMain = new StorageMainImpl(container);
131
135
  rpc.set(PLUGIN_RPC_CONTEXT.STORAGE_MAIN, storageMain);
132
136