@theia/plugin-ext 1.53.0-next.6 → 1.53.0-next.64

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 (173) hide show
  1. package/lib/common/plugin-api-rpc.d.ts +16 -4
  2. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  3. package/lib/common/plugin-api-rpc.js +4 -2
  4. package/lib/common/plugin-api-rpc.js.map +1 -1
  5. package/lib/common/rpc-protocol.d.ts +14 -13
  6. package/lib/common/rpc-protocol.d.ts.map +1 -1
  7. package/lib/common/rpc-protocol.js +56 -53
  8. package/lib/common/rpc-protocol.js.map +1 -1
  9. package/lib/hosted/browser/hosted-plugin.d.ts +1 -0
  10. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  11. package/lib/hosted/browser/hosted-plugin.js +13 -3
  12. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  13. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  14. package/lib/hosted/node/scanners/scanner-theia.js +13 -1
  15. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  16. package/lib/main/browser/authentication-main.d.ts +6 -5
  17. package/lib/main/browser/authentication-main.d.ts.map +1 -1
  18. package/lib/main/browser/authentication-main.js +15 -9
  19. package/lib/main/browser/authentication-main.js.map +1 -1
  20. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +9 -3
  21. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  22. package/lib/main/browser/custom-editors/custom-editor-opener.js +120 -31
  23. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  24. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts +7 -4
  25. package/lib/main/browser/custom-editors/custom-editor-widget.d.ts.map +1 -1
  26. package/lib/main/browser/custom-editors/custom-editor-widget.js +21 -7
  27. package/lib/main/browser/custom-editors/custom-editor-widget.js.map +1 -1
  28. package/lib/main/browser/custom-editors/custom-editors-main.d.ts +3 -4
  29. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  30. package/lib/main/browser/custom-editors/custom-editors-main.js +5 -55
  31. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  32. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts +4 -3
  33. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.d.ts.map +1 -1
  34. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js +24 -16
  35. package/lib/main/browser/custom-editors/plugin-custom-editor-registry.js.map +1 -1
  36. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  37. package/lib/main/browser/editors-and-documents-main.js +14 -2
  38. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  39. package/lib/main/browser/main-context.d.ts.map +1 -1
  40. package/lib/main/browser/main-context.js +3 -0
  41. package/lib/main/browser/main-context.js.map +1 -1
  42. package/lib/main/browser/menus/menus-contribution-handler.d.ts.map +1 -1
  43. package/lib/main/browser/menus/menus-contribution-handler.js +1 -1
  44. package/lib/main/browser/menus/menus-contribution-handler.js.map +1 -1
  45. package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts +1 -0
  46. package/lib/main/browser/menus/plugin-menu-command-adapter.d.ts.map +1 -1
  47. package/lib/main/browser/menus/plugin-menu-command-adapter.js +22 -1
  48. package/lib/main/browser/menus/plugin-menu-command-adapter.js.map +1 -1
  49. package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts +2 -2
  50. package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
  51. package/lib/main/browser/menus/vscode-theia-menu-mappings.js +2 -0
  52. package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
  53. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.d.ts.map +1 -1
  54. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +3 -1
  55. package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
  56. package/lib/main/browser/notebooks/notebook-documents-main.d.ts.map +1 -1
  57. package/lib/main/browser/notebooks/notebook-documents-main.js +22 -3
  58. package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -1
  59. package/lib/main/browser/notebooks/notebook-editors-main.d.ts +1 -1
  60. package/lib/main/browser/notebooks/notebook-editors-main.d.ts.map +1 -1
  61. package/lib/main/browser/notebooks/notebook-editors-main.js +16 -2
  62. package/lib/main/browser/notebooks/notebook-editors-main.js.map +1 -1
  63. package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
  64. package/lib/main/browser/plugin-ext-frontend-module.js +18 -0
  65. package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
  66. package/lib/main/browser/tabs/tabs-main.d.ts +1 -1
  67. package/lib/main/browser/tabs/tabs-main.d.ts.map +1 -1
  68. package/lib/main/browser/tabs/tabs-main.js +1 -1
  69. package/lib/main/browser/tabs/tabs-main.js.map +1 -1
  70. package/lib/main/browser/text-editor-main.d.ts +6 -3
  71. package/lib/main/browser/text-editor-main.d.ts.map +1 -1
  72. package/lib/main/browser/text-editor-main.js +39 -5
  73. package/lib/main/browser/text-editor-main.js.map +1 -1
  74. package/lib/main/browser/uri-main.d.ts +16 -0
  75. package/lib/main/browser/uri-main.d.ts.map +1 -0
  76. package/lib/main/browser/uri-main.js +64 -0
  77. package/lib/main/browser/uri-main.js.map +1 -0
  78. package/lib/main/browser/webview/webview.d.ts +1 -3
  79. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  80. package/lib/main/browser/webview/webview.js +5 -4
  81. package/lib/main/browser/webview/webview.js.map +1 -1
  82. package/lib/main/browser/webviews-main.d.ts.map +1 -1
  83. package/lib/main/browser/webviews-main.js +6 -1
  84. package/lib/main/browser/webviews-main.js.map +1 -1
  85. package/lib/plugin/authentication-ext.d.ts +3 -2
  86. package/lib/plugin/authentication-ext.d.ts.map +1 -1
  87. package/lib/plugin/authentication-ext.js +8 -5
  88. package/lib/plugin/authentication-ext.js.map +1 -1
  89. package/lib/plugin/custom-editors.d.ts +2 -4
  90. package/lib/plugin/custom-editors.d.ts.map +1 -1
  91. package/lib/plugin/custom-editors.js +5 -7
  92. package/lib/plugin/custom-editors.js.map +1 -1
  93. package/lib/plugin/env.d.ts +2 -0
  94. package/lib/plugin/env.d.ts.map +1 -1
  95. package/lib/plugin/env.js +4 -1
  96. package/lib/plugin/env.js.map +1 -1
  97. package/lib/plugin/known-commands.d.ts.map +1 -1
  98. package/lib/plugin/known-commands.js +1 -0
  99. package/lib/plugin/known-commands.js.map +1 -1
  100. package/lib/plugin/notebook/notebooks.d.ts +1 -0
  101. package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
  102. package/lib/plugin/notebook/notebooks.js +22 -2
  103. package/lib/plugin/notebook/notebooks.js.map +1 -1
  104. package/lib/plugin/plugin-context.d.ts.map +1 -1
  105. package/lib/plugin/plugin-context.js +17 -6
  106. package/lib/plugin/plugin-context.js.map +1 -1
  107. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  108. package/lib/plugin/plugin-manager.js +2 -1
  109. package/lib/plugin/plugin-manager.js.map +1 -1
  110. package/lib/plugin/terminal-ext.d.ts +2 -0
  111. package/lib/plugin/terminal-ext.d.ts.map +1 -1
  112. package/lib/plugin/terminal-ext.js +2 -0
  113. package/lib/plugin/terminal-ext.js.map +1 -1
  114. package/lib/plugin/text-editor.d.ts +1 -1
  115. package/lib/plugin/text-editor.d.ts.map +1 -1
  116. package/lib/plugin/text-editor.js.map +1 -1
  117. package/lib/plugin/type-converters.d.ts +5 -0
  118. package/lib/plugin/type-converters.d.ts.map +1 -1
  119. package/lib/plugin/type-converters.js +24 -3
  120. package/lib/plugin/type-converters.js.map +1 -1
  121. package/lib/plugin/types-impl.d.ts +5 -0
  122. package/lib/plugin/types-impl.d.ts.map +1 -1
  123. package/lib/plugin/types-impl.js +9 -1
  124. package/lib/plugin/types-impl.js.map +1 -1
  125. package/lib/plugin/uri-ext.d.ts +37 -0
  126. package/lib/plugin/uri-ext.d.ts.map +1 -0
  127. package/lib/plugin/uri-ext.js +50 -0
  128. package/lib/plugin/uri-ext.js.map +1 -0
  129. package/lib/plugin/webviews.js +1 -1
  130. package/lib/plugin/webviews.js.map +1 -1
  131. package/package.json +29 -29
  132. package/src/common/plugin-api-rpc.ts +21 -6
  133. package/src/common/rpc-protocol.ts +62 -66
  134. package/src/hosted/browser/hosted-plugin.ts +16 -5
  135. package/src/hosted/node/scanners/scanner-theia.ts +12 -1
  136. package/src/main/browser/authentication-main.ts +24 -11
  137. package/src/main/browser/custom-editors/custom-editor-opener.tsx +125 -25
  138. package/src/main/browser/custom-editors/custom-editor-widget.ts +20 -11
  139. package/src/main/browser/custom-editors/custom-editors-main.ts +11 -70
  140. package/src/main/browser/custom-editors/plugin-custom-editor-registry.ts +20 -14
  141. package/src/main/browser/editors-and-documents-main.ts +25 -2
  142. package/src/main/browser/main-context.ts +4 -0
  143. package/src/main/browser/menus/menus-contribution-handler.ts +2 -1
  144. package/src/main/browser/menus/plugin-menu-command-adapter.ts +22 -1
  145. package/src/main/browser/menus/vscode-theia-menu-mappings.ts +3 -1
  146. package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +5 -2
  147. package/src/main/browser/notebooks/notebook-documents-main.ts +24 -4
  148. package/src/main/browser/notebooks/notebook-editors-main.ts +15 -2
  149. package/src/main/browser/plugin-ext-frontend-module.ts +23 -4
  150. package/src/main/browser/tabs/tabs-main.ts +6 -2
  151. package/src/main/browser/text-editor-main.ts +55 -14
  152. package/src/main/browser/uri-main.ts +72 -0
  153. package/src/main/browser/webview/pre/service-worker.js +2 -1
  154. package/src/main/browser/webview/webview.ts +5 -6
  155. package/src/main/browser/webviews-main.ts +6 -1
  156. package/src/plugin/authentication-ext.ts +9 -5
  157. package/src/plugin/custom-editors.ts +8 -10
  158. package/src/plugin/env.ts +6 -1
  159. package/src/plugin/known-commands.ts +1 -0
  160. package/src/plugin/notebook/notebooks.ts +21 -0
  161. package/src/plugin/plugin-context.ts +19 -8
  162. package/src/plugin/plugin-manager.ts +2 -1
  163. package/src/plugin/terminal-ext.ts +3 -0
  164. package/src/plugin/text-editor.ts +1 -1
  165. package/src/plugin/type-converters.ts +20 -0
  166. package/src/plugin/types-impl.ts +10 -0
  167. package/src/plugin/uri-ext.ts +60 -0
  168. package/src/plugin/webviews.ts +1 -1
  169. package/lib/common/proxy-handler.d.ts +0 -73
  170. package/lib/common/proxy-handler.d.ts.map +0 -1
  171. package/lib/common/proxy-handler.js +0 -106
  172. package/lib/common/proxy-handler.js.map +0 -1
  173. package/src/common/proxy-handler.ts +0 -143
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
2
  "name": "@theia/plugin-ext",
3
- "version": "1.53.0-next.6+5255c512c",
3
+ "version": "1.53.0-next.64+23b351d26",
4
4
  "description": "Theia - Plugin Extension",
5
5
  "main": "lib/common/index.js",
6
6
  "typings": "lib/common/index.d.ts",
7
7
  "dependencies": {
8
- "@theia/bulk-edit": "1.53.0-next.6+5255c512c",
9
- "@theia/callhierarchy": "1.53.0-next.6+5255c512c",
10
- "@theia/console": "1.53.0-next.6+5255c512c",
11
- "@theia/core": "1.53.0-next.6+5255c512c",
12
- "@theia/debug": "1.53.0-next.6+5255c512c",
13
- "@theia/editor": "1.53.0-next.6+5255c512c",
14
- "@theia/editor-preview": "1.53.0-next.6+5255c512c",
15
- "@theia/file-search": "1.53.0-next.6+5255c512c",
16
- "@theia/filesystem": "1.53.0-next.6+5255c512c",
17
- "@theia/markers": "1.53.0-next.6+5255c512c",
18
- "@theia/messages": "1.53.0-next.6+5255c512c",
19
- "@theia/monaco": "1.53.0-next.6+5255c512c",
8
+ "@theia/bulk-edit": "1.53.0-next.64+23b351d26",
9
+ "@theia/callhierarchy": "1.53.0-next.64+23b351d26",
10
+ "@theia/console": "1.53.0-next.64+23b351d26",
11
+ "@theia/core": "1.53.0-next.64+23b351d26",
12
+ "@theia/debug": "1.53.0-next.64+23b351d26",
13
+ "@theia/editor": "1.53.0-next.64+23b351d26",
14
+ "@theia/editor-preview": "1.53.0-next.64+23b351d26",
15
+ "@theia/file-search": "1.53.0-next.64+23b351d26",
16
+ "@theia/filesystem": "1.53.0-next.64+23b351d26",
17
+ "@theia/markers": "1.53.0-next.64+23b351d26",
18
+ "@theia/messages": "1.53.0-next.64+23b351d26",
19
+ "@theia/monaco": "1.53.0-next.64+23b351d26",
20
20
  "@theia/monaco-editor-core": "1.83.101",
21
- "@theia/navigator": "1.53.0-next.6+5255c512c",
22
- "@theia/notebook": "1.53.0-next.6+5255c512c",
23
- "@theia/output": "1.53.0-next.6+5255c512c",
24
- "@theia/plugin": "1.53.0-next.6+5255c512c",
25
- "@theia/preferences": "1.53.0-next.6+5255c512c",
26
- "@theia/scm": "1.53.0-next.6+5255c512c",
27
- "@theia/search-in-workspace": "1.53.0-next.6+5255c512c",
28
- "@theia/task": "1.53.0-next.6+5255c512c",
29
- "@theia/terminal": "1.53.0-next.6+5255c512c",
30
- "@theia/test": "1.53.0-next.6+5255c512c",
31
- "@theia/timeline": "1.53.0-next.6+5255c512c",
32
- "@theia/typehierarchy": "1.53.0-next.6+5255c512c",
33
- "@theia/variable-resolver": "1.53.0-next.6+5255c512c",
34
- "@theia/workspace": "1.53.0-next.6+5255c512c",
21
+ "@theia/navigator": "1.53.0-next.64+23b351d26",
22
+ "@theia/notebook": "1.53.0-next.64+23b351d26",
23
+ "@theia/output": "1.53.0-next.64+23b351d26",
24
+ "@theia/plugin": "1.53.0-next.64+23b351d26",
25
+ "@theia/preferences": "1.53.0-next.64+23b351d26",
26
+ "@theia/scm": "1.53.0-next.64+23b351d26",
27
+ "@theia/search-in-workspace": "1.53.0-next.64+23b351d26",
28
+ "@theia/task": "1.53.0-next.64+23b351d26",
29
+ "@theia/terminal": "1.53.0-next.64+23b351d26",
30
+ "@theia/test": "1.53.0-next.64+23b351d26",
31
+ "@theia/timeline": "1.53.0-next.64+23b351d26",
32
+ "@theia/typehierarchy": "1.53.0-next.64+23b351d26",
33
+ "@theia/variable-resolver": "1.53.0-next.64+23b351d26",
34
+ "@theia/workspace": "1.53.0-next.64+23b351d26",
35
35
  "@types/mime": "^2.0.1",
36
36
  "@vscode/debugprotocol": "^1.51.0",
37
37
  "@vscode/proxy-agent": "^0.13.2",
@@ -88,7 +88,7 @@
88
88
  "watch": "theiaext watch"
89
89
  },
90
90
  "devDependencies": {
91
- "@theia/ext-scripts": "1.52.0",
91
+ "@theia/ext-scripts": "1.53.0",
92
92
  "@types/decompress": "^4.2.2",
93
93
  "@types/escape-html": "^0.0.20",
94
94
  "@types/lodash.clonedeep": "^4.5.3",
@@ -97,5 +97,5 @@
97
97
  "nyc": {
98
98
  "extends": "../../configs/nyc.json"
99
99
  },
100
- "gitHead": "5255c512c6c9da44c11cb4d5fca7379de60b71cc"
100
+ "gitHead": "23b351d26346a2b5d6aca3ee81fba59c056132f7"
101
101
  }
@@ -181,6 +181,7 @@ export interface EnvInit {
181
181
  appName: string;
182
182
  appHost: string;
183
183
  appRoot: string;
184
+ appUriScheme: string;
184
185
  }
185
186
 
186
187
  export interface PluginAPI {
@@ -1882,7 +1883,7 @@ export interface CustomEditorsExt {
1882
1883
  newWebviewHandle: string,
1883
1884
  viewType: string,
1884
1885
  title: string,
1885
- widgetOpenerOptions: object | undefined,
1886
+ position: number,
1886
1887
  options: theia.WebviewPanelOptions,
1887
1888
  cancellation: CancellationToken): Promise<void>;
1888
1889
  $createCustomDocument(resource: UriComponents, viewType: string, openContext: theia.CustomDocumentOpenContext, cancellation: CancellationToken): Promise<{ editable: boolean }>;
@@ -1905,7 +1906,6 @@ export interface CustomEditorsMain {
1905
1906
  $registerTextEditorProvider(viewType: string, options: theia.WebviewPanelOptions, capabilities: CustomTextEditorCapabilities): void;
1906
1907
  $registerCustomEditorProvider(viewType: string, options: theia.WebviewPanelOptions, supportsMultipleEditorsPerDocument: boolean): void;
1907
1908
  $unregisterEditorProvider(viewType: string): void;
1908
- $createCustomEditorPanel(handle: string, title: string, widgetOpenerOptions: object | undefined, options: theia.WebviewPanelOptions & theia.WebviewOptions): Promise<void>;
1909
1909
  $onDidEdit(resource: UriComponents, viewType: string, editId: number, label: string | undefined): void;
1910
1910
  $onContentChange(resource: UriComponents, viewType: string): void;
1911
1911
  }
@@ -2242,6 +2242,17 @@ export interface TestingExt {
2242
2242
  $onResolveChildren(controllerId: string, path: string[]): void;
2243
2243
  }
2244
2244
 
2245
+ // based from https://github.com/microsoft/vscode/blob/1.85.1/src/vs/workbench/api/common/extHostUrls.ts
2246
+ export interface UriExt {
2247
+ registerUriHandler(handler: theia.UriHandler, plugin: PluginInfo): theia.Disposable;
2248
+ $handleExternalUri(uri: UriComponents): Promise<void>;
2249
+ }
2250
+
2251
+ export interface UriMain {
2252
+ $registerUriHandler(extensionId: string, extensionName: string): void;
2253
+ $unregisterUriHandler(extensionId: string): void;
2254
+ }
2255
+
2245
2256
  export interface TestControllerUpdate {
2246
2257
  label: string;
2247
2258
  canRefresh: boolean;
@@ -2319,7 +2330,8 @@ export const PLUGIN_RPC_CONTEXT = {
2319
2330
  TABS_MAIN: <ProxyIdentifier<TabsMain>>createProxyIdentifier<TabsMain>('TabsMain'),
2320
2331
  TELEMETRY_MAIN: <ProxyIdentifier<TelemetryMain>>createProxyIdentifier<TelemetryMain>('TelemetryMain'),
2321
2332
  LOCALIZATION_MAIN: <ProxyIdentifier<LocalizationMain>>createProxyIdentifier<LocalizationMain>('LocalizationMain'),
2322
- TESTING_MAIN: createProxyIdentifier<TestingMain>('TestingMain')
2333
+ TESTING_MAIN: createProxyIdentifier<TestingMain>('TestingMain'),
2334
+ URI_MAIN: createProxyIdentifier<UriMain>('UriMain')
2323
2335
  };
2324
2336
 
2325
2337
  export const MAIN_RPC_CONTEXT = {
@@ -2361,7 +2373,8 @@ export const MAIN_RPC_CONTEXT = {
2361
2373
  COMMENTS_EXT: createProxyIdentifier<CommentsExt>('CommentsExt'),
2362
2374
  TABS_EXT: createProxyIdentifier<TabsExt>('TabsExt'),
2363
2375
  TELEMETRY_EXT: createProxyIdentifier<TelemetryExt>('TelemetryExt)'),
2364
- TESTING_EXT: createProxyIdentifier<TestingExt>('TestingExt')
2376
+ TESTING_EXT: createProxyIdentifier<TestingExt>('TestingExt'),
2377
+ URI_EXT: createProxyIdentifier<UriExt>('UriExt')
2365
2378
  };
2366
2379
 
2367
2380
  export interface TasksExt {
@@ -2385,13 +2398,14 @@ export interface TasksMain {
2385
2398
  }
2386
2399
 
2387
2400
  export interface AuthenticationExt {
2388
- $getSessions(id: string, scopes?: string[]): Promise<ReadonlyArray<theia.AuthenticationSession>>;
2389
- $createSession(id: string, scopes: string[]): Promise<theia.AuthenticationSession>;
2401
+ $getSessions(providerId: string, scopes: string[] | undefined, options: theia.AuthenticationProviderSessionOptions): Promise<ReadonlyArray<theia.AuthenticationSession>>;
2402
+ $createSession(id: string, scopes: string[], options: theia.AuthenticationProviderSessionOptions): Promise<theia.AuthenticationSession>;
2390
2403
  $removeSession(id: string, sessionId: string): Promise<void>;
2391
2404
  $onDidChangeAuthenticationSessions(provider: theia.AuthenticationProviderInformation): Promise<void>;
2392
2405
  }
2393
2406
 
2394
2407
  export interface AuthenticationMain {
2408
+ $getAccounts(providerId: string): Thenable<readonly theia.AuthenticationSessionAccountInformation[]>;
2395
2409
  $registerAuthenticationProvider(id: string, label: string, supportsMultipleAccounts: boolean): void;
2396
2410
  $unregisterAuthenticationProvider(id: string): void;
2397
2411
  $onDidChangeSessions(providerId: string, event: AuthenticationProviderAuthenticationSessionsChangeEvent): void;
@@ -2659,6 +2673,7 @@ export interface NotebookDocumentsExt {
2659
2673
 
2660
2674
  export interface NotebookDocumentsAndEditorsExt {
2661
2675
  $acceptDocumentsAndEditorsDelta(delta: NotebookDocumentsAndEditorsDelta): Promise<void>;
2676
+ $acceptActiveCellEditorChange(newActiveEditor: string | null): void;
2662
2677
  }
2663
2678
 
2664
2679
  export interface NotebookDocumentsAndEditorsMain extends Disposable {
@@ -22,17 +22,14 @@
22
22
 
23
23
  /* eslint-disable @typescript-eslint/no-explicit-any */
24
24
 
25
- import { Channel, Disposable, DisposableCollection, isObject, ReadBuffer, URI, WriteBuffer } from '@theia/core';
25
+ import { Channel, Disposable, DisposableCollection, isObject, ReadBuffer, RpcProtocol, URI, WriteBuffer } from '@theia/core';
26
26
  import { Emitter, Event } from '@theia/core/lib/common/event';
27
- import { ChannelMultiplexer, MessageProvider } from '@theia/core/lib/common/message-rpc/channel';
28
- import { MsgPackMessageDecoder, MsgPackMessageEncoder } from '@theia/core/lib/common/message-rpc/rpc-message-encoder';
27
+ import { MessageProvider } from '@theia/core/lib/common/message-rpc/channel';
29
28
  import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/common/message-rpc/uint8-array-message-buffer';
30
- import { ClientProxyHandler, ProxySynchronizer, RpcInvocationHandler } from './proxy-handler';
31
29
  import { MsgPackExtensionManager } from '@theia/core/lib/common/message-rpc/msg-pack-extension-manager';
32
30
  import { URI as VSCodeURI } from '@theia/core/shared/vscode-uri';
33
31
  import { BinaryBuffer } from '@theia/core/lib/common/buffer';
34
32
  import { Range, Position } from '../plugin/types-impl';
35
- import { Deferred } from '@theia/core/lib/common/promise-util';
36
33
 
37
34
  export interface MessageConnection {
38
35
  send(msg: string): void;
@@ -79,21 +76,36 @@ export namespace ConnectionClosedError {
79
76
  }
80
77
 
81
78
  export class RPCProtocolImpl implements RPCProtocol {
82
- private readonly locals = new Map<string, RpcInvocationHandler>();
79
+ private readonly locals = new Map<string, any>();
83
80
  private readonly proxies = new Map<string, any>();
84
- private readonly multiplexer: ChannelMultiplexer;
85
- private readonly encoder = new MsgPackMessageEncoder();
86
- private readonly decoder = new MsgPackMessageDecoder();
87
- private readonly initCallback: ProxySynchronizer;
81
+ private readonly rpc: RpcProtocol;
88
82
 
89
83
  private readonly toDispose = new DisposableCollection(
90
84
  Disposable.create(() => { /* mark as no disposed */ })
91
85
  );
92
86
 
93
87
  constructor(channel: Channel) {
94
- this.toDispose.push(this.multiplexer = new ChannelMultiplexer(new BatchingChannel(channel)));
88
+ this.rpc = new RpcProtocol(new BatchingChannel(channel), (method, args) => this.handleRequest(method, args));
89
+ this.rpc.onNotification((evt: { method: string; args: any[]; }) => this.handleNotification(evt.method, evt.args));
95
90
  this.toDispose.push(Disposable.create(() => this.proxies.clear()));
96
- this.initCallback = new ProxySynchronizerImpl();
91
+ }
92
+
93
+ handleNotification(method: any, args: any[]): void {
94
+ const serviceId = args[0] as string;
95
+ const handler: any = this.locals.get(serviceId);
96
+ if (!handler) {
97
+ throw new Error(`no local service handler with id ${serviceId}`);
98
+ }
99
+ handler[method](...(args.slice(1)));
100
+ }
101
+
102
+ handleRequest(method: string, args: any[]): Promise<any> {
103
+ const serviceId = args[0] as string;
104
+ const handler: any = this.locals.get(serviceId);
105
+ if (!handler) {
106
+ throw new Error(`no local service handler with id ${serviceId}`);
107
+ }
108
+ return handler[method](...(args.slice(1)));
97
109
  }
98
110
 
99
111
  dispose(): void {
@@ -117,76 +129,60 @@ export class RPCProtocolImpl implements RPCProtocol {
117
129
  }
118
130
 
119
131
  protected createProxy<T>(proxyId: string): T {
120
- const handler = new ClientProxyHandler({
121
- id: proxyId, encoder: this.encoder, decoder: this.decoder, channelProvider: () => this.multiplexer.open(proxyId), proxySynchronizer: this.initCallback
122
- });
132
+ const handler = {
133
+ get: (target: any, name: string, receiver: any): any => {
134
+ if (target[name] || name.charCodeAt(0) !== 36 /* CharCode.DollarSign */) {
135
+ // not a remote property
136
+ return target[name];
137
+ }
138
+ const isNotify = this.isNotification(name);
139
+ return async (...args: any[]) => {
140
+ const method = name.toString();
141
+ if (isNotify) {
142
+ this.rpc.sendNotification(method, [proxyId, ...args]);
143
+ } else {
144
+ return await this.rpc.sendRequest(method, [proxyId, ...args]) as Promise<any>;
145
+ }
146
+ };
147
+ }
148
+
149
+ };
123
150
  return new Proxy(Object.create(null), handler);
124
151
  }
125
152
 
153
+ /**
154
+ * Return whether the given property represents a notification. If true,
155
+ * the promise returned from the invocation will resolve immediately to `undefined`
156
+ *
157
+ * A property leads to a notification rather than a method call if its name
158
+ * begins with `notify` or `on`.
159
+ *
160
+ * @param p - The property being called on the proxy.
161
+ * @return Whether `p` represents a notification.
162
+ */
163
+ protected isNotification(p: PropertyKey): boolean {
164
+ let propertyString = p.toString();
165
+ if (propertyString.charCodeAt(0) === 36/* CharCode.DollarSign */) {
166
+ propertyString = propertyString.substring(1);
167
+ }
168
+ return propertyString.startsWith('notify') || propertyString.startsWith('on');
169
+ }
170
+
126
171
  set<T, R extends T>(identifier: ProxyIdentifier<T>, instance: R): R {
127
172
  if (this.isDisposed) {
128
173
  throw ConnectionClosedError.create();
129
174
  }
130
- const invocationHandler = this.locals.get(identifier.id);
131
- if (!invocationHandler) {
132
- const handler = new RpcInvocationHandler({ id: identifier.id, target: instance, encoder: this.encoder, decoder: this.decoder });
133
-
134
- const channel = this.multiplexer.getOpenChannel(identifier.id);
135
- if (channel) {
136
- handler.listen(channel);
137
- } else {
138
- const channelOpenListener = this.multiplexer.onDidOpenChannel(event => {
139
- if (event.id === identifier.id) {
140
- handler.listen(event.channel);
141
- channelOpenListener.dispose();
142
- }
143
- });
144
- }
145
-
146
- this.locals.set(identifier.id, handler);
175
+ if (!this.locals.has(identifier.id)) {
176
+ this.locals.set(identifier.id, instance);
147
177
  if (Disposable.is(instance)) {
148
178
  this.toDispose.push(instance);
149
179
  }
150
180
  this.toDispose.push(Disposable.create(() => this.locals.delete(identifier.id)));
151
-
152
181
  }
153
182
  return instance;
154
183
  }
155
184
  }
156
185
 
157
- export class ProxySynchronizerImpl implements ProxySynchronizer {
158
-
159
- private readonly runningInitializations = new Set<string>();
160
-
161
- private _pendingProxyInitializations: Deferred<void>;
162
-
163
- constructor() {
164
- this._pendingProxyInitializations = new Deferred();
165
- /* after creation no init is active */
166
- this._pendingProxyInitializations.resolve();
167
- }
168
-
169
- startProxyInitialization(id: string, init: Promise<void>): void {
170
- if (this.runningInitializations.size === 0) {
171
- this._pendingProxyInitializations = new Deferred();
172
- }
173
- init.then(() => this.finishedProxyInitialization(id));
174
- this.runningInitializations.add(id);
175
- }
176
-
177
- protected finishedProxyInitialization(id: string): void {
178
- this.runningInitializations.delete(id);
179
- if (this.runningInitializations.size === 0) {
180
- this._pendingProxyInitializations.resolve();
181
- }
182
- }
183
-
184
- pendingProxyInitializations(): Promise<void> {
185
- return this._pendingProxyInitializations.promise;
186
- }
187
-
188
- }
189
-
190
186
  /**
191
187
  * Wraps and underlying channel to send/receive multiple messages in one go:
192
188
  * - multiple messages to be sent from one stack get sent in bulk at `process.nextTick`.
@@ -40,10 +40,10 @@ import { WorkspaceService } from '@theia/workspace/lib/browser';
40
40
  import { PluginContributionHandler } from '../../main/browser/plugin-contribution-handler';
41
41
  import { getQueryParameters } from '../../main/browser/env-main';
42
42
  import { getPreferences } from '../../main/browser/preference-registry-main';
43
- import { Deferred } from '@theia/core/lib/common/promise-util';
43
+ import { Deferred, waitForEvent } from '@theia/core/lib/common/promise-util';
44
44
  import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
45
45
  import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager';
46
- import { WaitUntilEvent } from '@theia/core/lib/common/event';
46
+ import { Event, WaitUntilEvent } from '@theia/core/lib/common/event';
47
47
  import { FileSearchService } from '@theia/file-search/lib/common/file-search-service';
48
48
  import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
49
49
  import { PluginViewRegistry } from '../../main/browser/view/plugin-view-registry';
@@ -209,7 +209,8 @@ export class HostedPluginSupport extends AbstractHostedPluginSupport<PluginManag
209
209
  this.notebookRendererMessagingService.onWillActivateRenderer(rendererId => this.activateByNotebookRenderer(rendererId));
210
210
 
211
211
  this.widgets.onDidCreateWidget(({ factoryId, widget }) => {
212
- if ((factoryId === WebviewWidget.FACTORY_ID || factoryId === CustomEditorWidget.FACTORY_ID) && widget instanceof WebviewWidget) {
212
+ // note: state restoration of custom editors is handled in `PluginCustomEditorRegistry.init`
213
+ if (factoryId === WebviewWidget.FACTORY_ID && widget instanceof WebviewWidget) {
213
214
  const storeState = widget.storeState.bind(widget);
214
215
  const restoreState = widget.restoreState.bind(widget);
215
216
 
@@ -327,7 +328,8 @@ export class HostedPluginSupport extends AbstractHostedPluginSupport<PluginManag
327
328
  uiKind: isElectron ? UIKind.Desktop : UIKind.Web,
328
329
  appName: FrontendApplicationConfigProvider.get().applicationName,
329
330
  appHost: isElectron ? 'desktop' : 'web', // TODO: 'web' could be the embedder's name, e.g. 'github.dev'
330
- appRoot
331
+ appRoot,
332
+ appUriScheme: FrontendApplicationConfigProvider.get().electron.uriScheme
331
333
  },
332
334
  extApi,
333
335
  webview: {
@@ -415,6 +417,10 @@ export class HostedPluginSupport extends AbstractHostedPluginSupport<PluginManag
415
417
  await this.activateByEvent(`onLanguage:${languageId}`);
416
418
  }
417
419
 
420
+ async activateByUri(scheme: string, authority: string): Promise<void> {
421
+ await this.activateByEvent(`onUri:${scheme}://${authority}`);
422
+ }
423
+
418
424
  async activateByCommand(commandId: string): Promise<void> {
419
425
  await this.activateByEvent(`onCommand:${commandId}`);
420
426
  }
@@ -448,7 +454,12 @@ export class HostedPluginSupport extends AbstractHostedPluginSupport<PluginManag
448
454
  }
449
455
 
450
456
  protected ensureFileSystemActivation(event: FileSystemProviderActivationEvent): void {
451
- event.waitUntil(this.activateByFileSystem(event));
457
+ event.waitUntil(this.activateByFileSystem(event).then(() => {
458
+ if (!this.fileService.hasProvider(event.scheme)) {
459
+ return waitForEvent(Event.filter(this.fileService.onDidChangeFileSystemProviderRegistrations,
460
+ ({ added, scheme }) => added && scheme === event.scheme), 3000);
461
+ }
462
+ }));
452
463
  }
453
464
 
454
465
  protected ensureCommandHandlerRegistration(event: WillExecuteCommandEvent): void {
@@ -192,11 +192,22 @@ export class TheiaPluginScanner extends AbstractPluginScanner {
192
192
  try {
193
193
  if (rawPlugin.contributes.configuration) {
194
194
  const configurations = Array.isArray(rawPlugin.contributes.configuration) ? rawPlugin.contributes.configuration : [rawPlugin.contributes.configuration];
195
+ const hasMultipleConfigs = configurations.length > 1;
195
196
  contributions.configuration = [];
196
197
  for (const c of configurations) {
197
198
  const config = this.readConfiguration(c, rawPlugin.packagePath);
198
199
  if (config) {
199
- Object.values(config.properties).forEach(property => property.title = config.title);
200
+ Object.values(config.properties).forEach(property => {
201
+ if (hasMultipleConfigs) {
202
+ // If there are multiple configuration contributions, we need to distinguish them by their title in the settings UI.
203
+ // They are placed directly under the plugin's name in the settings UI.
204
+ property.owner = rawPlugin.displayName;
205
+ property.group = config.title;
206
+ } else {
207
+ // If there's only one configuration contribution, we display the title in the settings UI.
208
+ property.owner = config.title;
209
+ }
210
+ });
200
211
  contributions.configuration.push(config);
201
212
  }
202
213
  }
@@ -27,7 +27,10 @@ import { MessageService } from '@theia/core/lib/common/message-service';
27
27
  import { ConfirmDialog, Dialog, StorageService } from '@theia/core/lib/browser';
28
28
  import {
29
29
  AuthenticationProvider,
30
+ AuthenticationProviderSessionOptions,
30
31
  AuthenticationService,
32
+ AuthenticationSession,
33
+ AuthenticationSessionAccountInformation,
31
34
  readAllowedExtensions
32
35
  } from '@theia/core/lib/browser/authentication-service';
33
36
  import { QuickPickService } from '@theia/core/lib/common/quick-pick-service';
@@ -77,9 +80,13 @@ export class AuthenticationMainImpl implements AuthenticationMain {
77
80
  return this.authenticationService.requestNewSession(providerId, scopes, extensionId, extensionName);
78
81
  }
79
82
 
83
+ $getAccounts(providerId: string): Thenable<readonly theia.AuthenticationSessionAccountInformation[]> {
84
+ return this.authenticationService.getSessions(providerId).then(sessions => sessions.map(session => session.account));
85
+ }
86
+
80
87
  async $getSession(providerId: string, scopes: string[], extensionId: string, extensionName: string,
81
88
  options: theia.AuthenticationGetSessionOptions): Promise<theia.AuthenticationSession | undefined> {
82
- const sessions = await this.authenticationService.getSessions(providerId, scopes);
89
+ const sessions = await this.authenticationService.getSessions(providerId, scopes, options?.account);
83
90
 
84
91
  // Error cases
85
92
  if (options.forceNewSession && !sessions.length) {
@@ -140,26 +147,32 @@ export class AuthenticationMainImpl implements AuthenticationMain {
140
147
  }
141
148
 
142
149
  protected async selectSession(providerId: string, providerName: string, extensionId: string, extensionName: string,
143
- potentialSessions: Readonly<theia.AuthenticationSession[]>, scopes: string[], clearSessionPreference: boolean): Promise<theia.AuthenticationSession> {
150
+ potentialSessions: Readonly<AuthenticationSession[]>, scopes: string[], clearSessionPreference: boolean): Promise<theia.AuthenticationSession> {
151
+
144
152
  if (!potentialSessions.length) {
145
153
  throw new Error('No potential sessions found');
146
154
  }
147
155
 
148
156
  return new Promise(async (resolve, reject) => {
149
- const items: QuickPickValue<{ session?: theia.AuthenticationSession }>[] = potentialSessions.map(session => ({
157
+ const items: QuickPickValue<{ session?: AuthenticationSession, account?: AuthenticationSessionAccountInformation }>[] = potentialSessions.map(session => ({
150
158
  label: session.account.label,
151
159
  value: { session }
152
160
  }));
153
161
  items.push({
154
162
  label: nls.localizeByDefault('Sign in to another account'),
155
- value: { session: undefined }
163
+ value: {}
156
164
  });
165
+
166
+ // VS Code has code here that pushes accounts that have no active sessions. However, since we do not store
167
+ // any accounts that don't have sessions, we dont' do this.
157
168
  const selected = await this.quickPickService.show(items,
158
169
  {
159
170
  title: nls.localizeByDefault("The extension '{0}' wants to access a {1} account", extensionName, providerName),
160
171
  ignoreFocusOut: true
161
172
  });
162
173
  if (selected) {
174
+
175
+ // if we ever have accounts without sessions, pass the account to the login call
163
176
  const session = selected.value?.session ?? await this.authenticationService.login(providerId, scopes);
164
177
  const accountName = session.account.label;
165
178
 
@@ -318,13 +331,13 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
318
331
  }
319
332
  }
320
333
 
321
- async getSessions(scopes?: string[]): Promise<ReadonlyArray<theia.AuthenticationSession>> {
322
- return this.proxy.$getSessions(this.id, scopes);
334
+ async getSessions(scopes?: string[], account?: AuthenticationSessionAccountInformation): Promise<ReadonlyArray<theia.AuthenticationSession>> {
335
+ return this.proxy.$getSessions(this.id, scopes, { account: account });
323
336
  }
324
337
 
325
338
  async updateSessionItems(event: theia.AuthenticationProviderAuthenticationSessionsChangeEvent): Promise<void> {
326
339
  const { added, removed } = event;
327
- const session = await this.proxy.$getSessions(this.id);
340
+ const session = await this.proxy.$getSessions(this.id, undefined, {});
328
341
  const addedSessions = added ? session.filter(s => added.some(addedSession => addedSession.id === s.id)) : [];
329
342
 
330
343
  removed?.forEach(removedSession => {
@@ -347,16 +360,16 @@ export class AuthenticationProviderImpl implements AuthenticationProvider {
347
360
  addedSessions.forEach(s => this.registerSession(s));
348
361
  }
349
362
 
350
- async login(scopes: string[]): Promise<theia.AuthenticationSession> {
351
- return this.createSession(scopes);
363
+ async login(scopes: string[], options: AuthenticationProviderSessionOptions): Promise<theia.AuthenticationSession> {
364
+ return this.createSession(scopes, options);
352
365
  }
353
366
 
354
367
  async logout(sessionId: string): Promise<void> {
355
368
  return this.removeSession(sessionId);
356
369
  }
357
370
 
358
- createSession(scopes: string[]): Thenable<theia.AuthenticationSession> {
359
- return this.proxy.$createSession(this.id, scopes);
371
+ createSession(scopes: string[], options: AuthenticationProviderSessionOptions): Thenable<theia.AuthenticationSession> {
372
+ return this.proxy.$createSession(this.id, scopes, options);
360
373
  }
361
374
 
362
375
  removeSession(sessionId: string): Thenable<void> {