@theia/plugin-ext 1.27.0-next.9 → 1.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (273) hide show
  1. package/lib/common/connection.d.ts +3 -3
  2. package/lib/common/connection.d.ts.map +1 -1
  3. package/lib/common/connection.js +0 -1
  4. package/lib/common/connection.js.map +1 -1
  5. package/lib/common/plugin-api-rpc.d.ts +18 -8
  6. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  7. package/lib/common/plugin-api-rpc.js.map +1 -1
  8. package/lib/common/plugin-identifiers.d.ts +41 -0
  9. package/lib/common/plugin-identifiers.d.ts.map +1 -0
  10. package/lib/common/plugin-identifiers.js +81 -0
  11. package/lib/common/plugin-identifiers.js.map +1 -0
  12. package/lib/common/plugin-protocol.d.ts +50 -11
  13. package/lib/common/plugin-protocol.d.ts.map +1 -1
  14. package/lib/common/plugin-protocol.js +3 -1
  15. package/lib/common/plugin-protocol.js.map +1 -1
  16. package/lib/hosted/browser/hosted-plugin.d.ts +2 -2
  17. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  18. package/lib/hosted/browser/hosted-plugin.js +26 -18
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/browser/worker/debug-stub.d.ts +1 -1
  21. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  22. package/lib/hosted/browser/worker/debug-stub.js +2 -2
  23. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  24. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  25. package/lib/hosted/browser/worker/plugin-manifest-loader.js +4 -1
  26. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +17 -9
  28. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  29. package/lib/hosted/node/hosted-plugin-deployer-handler.js +99 -18
  30. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  31. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
  32. package/lib/hosted/node/hosted-plugin-localization-service.js +2 -4
  33. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
  34. package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
  35. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  36. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  37. package/lib/hosted/node/hosted-plugin.d.ts +2 -2
  38. package/lib/hosted/node/hosted-plugin.d.ts.map +1 -1
  39. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  40. package/lib/hosted/node/metadata-scanner.d.ts +3 -2
  41. package/lib/hosted/node/metadata-scanner.d.ts.map +1 -1
  42. package/lib/hosted/node/metadata-scanner.js +8 -3
  43. package/lib/hosted/node/metadata-scanner.js.map +1 -1
  44. package/lib/hosted/node/plugin-host-rpc.js +2 -2
  45. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  46. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
  47. package/lib/hosted/node/plugin-manifest-loader.js +3 -0
  48. package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
  49. package/lib/hosted/node/plugin-service.d.ts +18 -4
  50. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  51. package/lib/hosted/node/plugin-service.js +73 -18
  52. package/lib/hosted/node/plugin-service.js.map +1 -1
  53. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  54. package/lib/hosted/node/scanners/scanner-theia.js +6 -3
  55. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  56. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  57. package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -2
  58. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  59. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +3 -3
  60. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  61. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  62. package/lib/main/browser/documents-main.d.ts +1 -2
  63. package/lib/main/browser/documents-main.d.ts.map +1 -1
  64. package/lib/main/browser/documents-main.js +26 -6
  65. package/lib/main/browser/documents-main.js.map +1 -1
  66. package/lib/main/browser/editors-and-documents-main.d.ts +2 -0
  67. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  68. package/lib/main/browser/editors-and-documents-main.js +14 -2
  69. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  70. package/lib/main/browser/languages-main.d.ts.map +1 -1
  71. package/lib/main/browser/languages-main.js +2 -1
  72. package/lib/main/browser/languages-main.js.map +1 -1
  73. package/lib/main/browser/main-context.d.ts.map +1 -1
  74. package/lib/main/browser/main-context.js +5 -4
  75. package/lib/main/browser/main-context.js.map +1 -1
  76. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
  77. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  78. package/lib/main/browser/plugin-contribution-handler.js +36 -1
  79. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  80. package/lib/main/browser/plugin-shared-style.d.ts +4 -2
  81. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  82. package/lib/main/browser/plugin-shared-style.js +15 -4
  83. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  84. package/lib/main/browser/text-editors-main.d.ts +6 -3
  85. package/lib/main/browser/text-editors-main.d.ts.map +1 -1
  86. package/lib/main/browser/text-editors-main.js +8 -1
  87. package/lib/main/browser/text-editors-main.js.map +1 -1
  88. package/lib/main/browser/theming-main.d.ts +2 -1
  89. package/lib/main/browser/theming-main.d.ts.map +1 -1
  90. package/lib/main/browser/theming-main.js +3 -6
  91. package/lib/main/browser/theming-main.js.map +1 -1
  92. package/lib/main/browser/view/plugin-tree-view-node-label-provider.d.ts.map +1 -1
  93. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +7 -5
  94. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  95. package/lib/main/browser/view/plugin-view-registry.d.ts +1 -1
  96. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  97. package/lib/main/browser/view/plugin-view-registry.js +11 -6
  98. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  99. package/lib/main/browser/view/tree-view-widget.d.ts +10 -5
  100. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  101. package/lib/main/browser/view/tree-view-widget.js +40 -14
  102. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  103. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +3 -1
  104. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  105. package/lib/main/browser/webview/webview-theme-data-provider.js +5 -1
  106. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  107. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +6 -1
  108. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  109. package/lib/main/node/handlers/plugin-theia-directory-handler.js +61 -20
  110. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  111. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +4 -0
  112. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  113. package/lib/main/node/handlers/plugin-theia-file-handler.js +26 -4
  114. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  115. package/lib/main/node/plugin-cli-contribution.d.ts +3 -0
  116. package/lib/main/node/plugin-cli-contribution.d.ts.map +1 -1
  117. package/lib/main/node/plugin-cli-contribution.js +13 -0
  118. package/lib/main/node/plugin-cli-contribution.js.map +1 -1
  119. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts +1 -0
  120. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts.map +1 -1
  121. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +17 -0
  122. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
  123. package/lib/main/node/plugin-deployer-file-handler-context-impl.d.ts.map +1 -1
  124. package/lib/main/node/plugin-deployer-file-handler-context-impl.js +0 -1
  125. package/lib/main/node/plugin-deployer-file-handler-context-impl.js.map +1 -1
  126. package/lib/main/node/plugin-deployer-impl.d.ts +10 -7
  127. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  128. package/lib/main/node/plugin-deployer-impl.js +84 -38
  129. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  130. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  131. package/lib/main/node/plugin-ext-backend-module.js +2 -0
  132. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  133. package/lib/main/node/plugin-server-handler.d.ts +5 -4
  134. package/lib/main/node/plugin-server-handler.d.ts.map +1 -1
  135. package/lib/main/node/plugin-server-handler.js +12 -5
  136. package/lib/main/node/plugin-server-handler.js.map +1 -1
  137. package/lib/main/node/plugin-uninstallation-manager.d.ts +15 -0
  138. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -0
  139. package/lib/main/node/plugin-uninstallation-manager.js +85 -0
  140. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -0
  141. package/lib/plugin/{node/debug/debug.d.ts → debug/debug-ext.d.ts} +15 -13
  142. package/lib/plugin/debug/debug-ext.d.ts.map +1 -0
  143. package/lib/plugin/{node/debug/debug.js → debug/debug-ext.js} +17 -51
  144. package/lib/plugin/debug/debug-ext.js.map +1 -0
  145. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts +11 -0
  146. package/lib/plugin/debug/plugin-debug-adapter-creator.d.ts.map +1 -0
  147. package/lib/plugin/debug/plugin-debug-adapter-creator.js +42 -0
  148. package/lib/plugin/debug/plugin-debug-adapter-creator.js.map +1 -0
  149. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.d.ts +4 -4
  150. package/lib/plugin/debug/plugin-debug-adapter-session.d.ts.map +1 -0
  151. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-session.js +1 -1
  152. package/lib/plugin/debug/plugin-debug-adapter-session.js.map +1 -0
  153. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.d.ts +0 -0
  154. package/lib/plugin/debug/plugin-debug-adapter-tracker.d.ts.map +1 -0
  155. package/lib/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.js +0 -0
  156. package/lib/plugin/debug/plugin-debug-adapter-tracker.js.map +1 -0
  157. package/lib/plugin/languages-utils.d.ts.map +1 -1
  158. package/lib/plugin/languages-utils.js +3 -2
  159. package/lib/plugin/languages-utils.js.map +1 -1
  160. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts +18 -0
  161. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.d.ts.map +1 -0
  162. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js +155 -0
  163. package/lib/plugin/node/debug/plugin-node-debug-adapter-creator.js.map +1 -0
  164. package/lib/plugin/plugin-context.d.ts +1 -1
  165. package/lib/plugin/plugin-context.d.ts.map +1 -1
  166. package/lib/plugin/plugin-context.js +1 -2
  167. package/lib/plugin/plugin-context.js.map +1 -1
  168. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  169. package/lib/plugin/plugin-manager.js +5 -9
  170. package/lib/plugin/plugin-manager.js.map +1 -1
  171. package/lib/plugin/text-editor.d.ts +2 -0
  172. package/lib/plugin/text-editor.d.ts.map +1 -1
  173. package/lib/plugin/text-editor.js +9 -0
  174. package/lib/plugin/text-editor.js.map +1 -1
  175. package/lib/plugin/theming.d.ts +1 -1
  176. package/lib/plugin/theming.d.ts.map +1 -1
  177. package/lib/plugin/tree/tree-views.d.ts +1 -0
  178. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  179. package/lib/plugin/tree/tree-views.js +10 -9
  180. package/lib/plugin/tree/tree-views.js.map +1 -1
  181. package/lib/plugin/types-impl.d.ts +1 -0
  182. package/lib/plugin/types-impl.d.ts.map +1 -1
  183. package/lib/plugin/types-impl.js +3 -2
  184. package/lib/plugin/types-impl.js.map +1 -1
  185. package/package.json +26 -25
  186. package/src/common/connection.ts +3 -4
  187. package/src/common/plugin-api-rpc.ts +20 -12
  188. package/src/common/plugin-identifiers.ts +84 -0
  189. package/src/common/plugin-protocol.ts +57 -12
  190. package/src/hosted/browser/hosted-plugin.ts +28 -21
  191. package/src/hosted/browser/worker/debug-stub.ts +1 -1
  192. package/src/hosted/browser/worker/plugin-manifest-loader.ts +4 -2
  193. package/src/hosted/node/hosted-plugin-deployer-handler.ts +109 -28
  194. package/src/hosted/node/hosted-plugin-localization-service.ts +4 -6
  195. package/src/hosted/node/hosted-plugin-process.ts +4 -4
  196. package/src/hosted/node/hosted-plugin.ts +2 -2
  197. package/src/hosted/node/metadata-scanner.ts +8 -6
  198. package/src/hosted/node/plugin-host-rpc.ts +2 -2
  199. package/src/hosted/node/plugin-manifest-loader.ts +2 -0
  200. package/src/hosted/node/plugin-service.ts +79 -23
  201. package/src/hosted/node/scanners/scanner-theia.ts +7 -4
  202. package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -2
  203. package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
  204. package/src/main/browser/documents-main.ts +26 -8
  205. package/src/main/browser/editors-and-documents-main.ts +16 -2
  206. package/src/main/browser/languages-main.ts +2 -1
  207. package/src/main/browser/main-context.ts +4 -3
  208. package/src/main/browser/plugin-contribution-handler.ts +41 -3
  209. package/src/main/browser/plugin-icon-theme-service.ts +1 -1
  210. package/src/main/browser/plugin-shared-style.ts +9 -5
  211. package/src/main/browser/text-editors-main.ts +12 -2
  212. package/src/main/browser/theming-main.ts +3 -7
  213. package/src/main/browser/view/plugin-tree-view-node-label-provider.ts +7 -5
  214. package/src/main/browser/view/plugin-view-registry.ts +12 -7
  215. package/src/main/browser/view/tree-view-widget.tsx +45 -17
  216. package/src/main/browser/webview/webview-theme-data-provider.ts +7 -10
  217. package/src/main/node/handlers/plugin-theia-directory-handler.ts +56 -28
  218. package/src/main/node/handlers/plugin-theia-file-handler.ts +26 -4
  219. package/src/main/node/plugin-cli-contribution.ts +12 -0
  220. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +17 -1
  221. package/src/main/node/plugin-deployer-file-handler-context-impl.ts +0 -1
  222. package/src/main/node/plugin-deployer-impl.ts +88 -41
  223. package/src/main/node/plugin-ext-backend-module.ts +3 -0
  224. package/src/main/node/plugin-server-handler.ts +15 -7
  225. package/src/main/node/plugin-uninstallation-manager.ts +74 -0
  226. package/src/plugin/{node/debug/debug.ts → debug/debug-ext.ts} +25 -56
  227. package/src/plugin/debug/plugin-debug-adapter-creator.ts +50 -0
  228. package/src/plugin/{node/debug → debug}/plugin-debug-adapter-session.ts +4 -4
  229. package/src/plugin/{node/debug → debug}/plugin-debug-adapter-tracker.ts +0 -0
  230. package/src/plugin/languages-utils.ts +3 -2
  231. package/src/plugin/node/debug/plugin-node-debug-adapter-creator.ts +167 -0
  232. package/src/plugin/plugin-context.ts +2 -3
  233. package/src/plugin/plugin-manager.ts +5 -9
  234. package/src/plugin/text-editor.ts +16 -5
  235. package/src/plugin/theming.ts +1 -1
  236. package/src/plugin/tree/tree-views.ts +15 -12
  237. package/src/plugin/types-impl.ts +1 -1
  238. package/lib/main/browser/custom-editors/glob.d.ts +0 -51
  239. package/lib/main/browser/custom-editors/glob.d.ts.map +0 -1
  240. package/lib/main/browser/custom-editors/glob.js +0 -593
  241. package/lib/main/browser/custom-editors/glob.js.map +0 -1
  242. package/lib/main/browser/custom-editors/paths.d.ts +0 -25
  243. package/lib/main/browser/custom-editors/paths.d.ts.map +0 -1
  244. package/lib/main/browser/custom-editors/paths.js +0 -227
  245. package/lib/main/browser/custom-editors/paths.js.map +0 -1
  246. package/lib/main/browser/editor/untitled-resource.d.ts +0 -3
  247. package/lib/main/browser/editor/untitled-resource.d.ts.map +0 -1
  248. package/lib/main/browser/editor/untitled-resource.js +0 -24
  249. package/lib/main/browser/editor/untitled-resource.js.map +0 -1
  250. package/lib/plugin/node/debug/debug.d.ts.map +0 -1
  251. package/lib/plugin/node/debug/debug.js.map +0 -1
  252. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts +0 -7
  253. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.d.ts.map +0 -1
  254. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js +0 -57
  255. package/lib/plugin/node/debug/plugin-debug-adapter-executable-resolver.js.map +0 -1
  256. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +0 -1
  257. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +0 -1
  258. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +0 -15
  259. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +0 -1
  260. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +0 -85
  261. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +0 -1
  262. package/lib/plugin/node/debug/plugin-debug-adapter-tracker.d.ts.map +0 -1
  263. package/lib/plugin/node/debug/plugin-debug-adapter-tracker.js.map +0 -1
  264. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts +0 -19
  265. package/lib/plugin/node/debug/plugin-inline-debug-adapter.d.ts.map +0 -1
  266. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js +0 -45
  267. package/lib/plugin/node/debug/plugin-inline-debug-adapter.js.map +0 -1
  268. package/src/main/browser/custom-editors/glob.ts +0 -743
  269. package/src/main/browser/custom-editors/paths.ts +0 -250
  270. package/src/main/browser/editor/untitled-resource.ts +0 -18
  271. package/src/plugin/node/debug/plugin-debug-adapter-executable-resolver.ts +0 -58
  272. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +0 -86
  273. package/src/plugin/node/debug/plugin-inline-debug-adapter.ts +0 -47
@@ -18,7 +18,7 @@ import * as cp from 'child_process';
18
18
  import { injectable, inject, named } from '@theia/core/shared/inversify';
19
19
  import { ILogger, ConnectionErrorHandler, ContributionProvider, MessageService } from '@theia/core/lib/common';
20
20
  import { createIpcEnv } from '@theia/core/lib/node/messaging/ipc-protocol';
21
- import { HostedPluginClient, ServerPluginRunner, PluginHostEnvironmentVariable, DeployedPlugin, PLUGIN_HOST_BACKEND } from '../../common/plugin-protocol';
21
+ import { HostedPluginClient, ServerPluginRunner, PluginHostEnvironmentVariable, DeployedPlugin, PLUGIN_HOST_BACKEND, PluginIdentifiers } from '../../common/plugin-protocol';
22
22
  import { MessageType } from '../../common/rpc-protocol';
23
23
  import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
24
24
  import * as psTree from 'ps-tree';
@@ -105,7 +105,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
105
105
 
106
106
  const waitForTerminated = new Deferred<void>();
107
107
  cp.on('message', message => {
108
- const msg = JSON.parse(message);
108
+ const msg = JSON.parse(message as string);
109
109
  if ('type' in msg && msg.type === MessageType.Terminated) {
110
110
  waitForTerminated.resolve();
111
111
  }
@@ -158,7 +158,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
158
158
  });
159
159
  this.childProcess.on('message', message => {
160
160
  if (this.client) {
161
- this.client.postMessage(PLUGIN_HOST_BACKEND, message);
161
+ this.client.postMessage(PLUGIN_HOST_BACKEND, message as string);
162
162
  }
163
163
  });
164
164
  }
@@ -225,7 +225,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
225
225
  /**
226
226
  * Provides additional plugin ids.
227
227
  */
228
- public async getExtraDeployedPluginIds(): Promise<string[]> {
228
+ public async getExtraDeployedPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
229
229
  return [];
230
230
  }
231
231
 
@@ -16,7 +16,7 @@
16
16
 
17
17
  import { injectable, inject, multiInject, postConstruct, optional } from '@theia/core/shared/inversify';
18
18
  import { ILogger, ConnectionErrorHandler } from '@theia/core/lib/common';
19
- import { HostedPluginClient, PluginModel, ServerPluginRunner, DeployedPlugin } from '../../common/plugin-protocol';
19
+ import { HostedPluginClient, PluginModel, ServerPluginRunner, DeployedPlugin, PluginIdentifiers } from '../../common/plugin-protocol';
20
20
  import { LogPart } from '../../common/types';
21
21
  import { HostedPluginProcess } from './hosted-plugin-process';
22
22
 
@@ -95,7 +95,7 @@ export class HostedPluginSupport {
95
95
  /**
96
96
  * Provides additional plugin ids.
97
97
  */
98
- async getExtraDeployedPluginIds(): Promise<string[]> {
98
+ async getExtraDeployedPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
99
99
  return [].concat.apply([], await Promise.all(this.pluginRunners.map(runner => runner.getExtraDeployedPluginIds())));
100
100
  }
101
101
 
@@ -14,15 +14,16 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable, multiInject } from '@theia/core/shared/inversify';
18
- import { PluginPackage, PluginScanner, PluginMetadata, PLUGIN_HOST_BACKEND } from '../../common/plugin-protocol';
17
+ import { inject, injectable, multiInject } from '@theia/core/shared/inversify';
18
+ import { PluginPackage, PluginScanner, PluginMetadata, PLUGIN_HOST_BACKEND, PluginIdentifiers } from '../../common/plugin-protocol';
19
+ import { PluginUninstallationManager } from '../../main/node/plugin-uninstallation-manager';
19
20
  @injectable()
20
21
  export class MetadataScanner {
21
22
  private scanners: Map<string, PluginScanner> = new Map();
22
23
 
23
- constructor( // eslint-disable-next-line @typescript-eslint/indent
24
- @multiInject(PluginScanner) scanners: PluginScanner[]
25
- ) {
24
+ @inject(PluginUninstallationManager) protected readonly uninstallationManager: PluginUninstallationManager;
25
+
26
+ constructor(@multiInject(PluginScanner) scanners: PluginScanner[]) {
26
27
  scanners.forEach((scanner: PluginScanner) => {
27
28
  this.scanners.set(scanner.apiType, scanner);
28
29
  });
@@ -33,7 +34,8 @@ export class MetadataScanner {
33
34
  return {
34
35
  host: PLUGIN_HOST_BACKEND,
35
36
  model: scanner.getModel(plugin),
36
- lifecycle: scanner.getLifecycle(plugin)
37
+ lifecycle: scanner.getLifecycle(plugin),
38
+ outOfSync: this.uninstallationManager.isUninstalled(PluginIdentifiers.componentsToVersionedId(plugin)),
37
39
  };
38
40
  }
39
41
 
@@ -22,7 +22,7 @@ import { createAPIFactory } from '../../plugin/plugin-context';
22
22
  import { EnvExtImpl } from '../../plugin/env';
23
23
  import { PreferenceRegistryExtImpl } from '../../plugin/preference-registry';
24
24
  import { ExtPluginApi, ExtPluginApiBackendInitializationFn } from '../../common/plugin-ext-api-contribution';
25
- import { DebugExtImpl } from '../../plugin/node/debug/debug';
25
+ import { DebugExtImpl } from '../../plugin/debug/debug-ext';
26
26
  import { EditorsAndDocumentsExtImpl } from '../../plugin/editors-and-documents';
27
27
  import { WorkspaceExtImpl } from '../../plugin/workspace';
28
28
  import { MessageRegistryExt } from '../../plugin/message-registry';
@@ -114,7 +114,7 @@ export class PluginHostRPC {
114
114
  console.log('PLUGIN_HOST(' + process.pid + '): PluginManagerExtImpl/loadPlugin(' + plugin.pluginPath + ')');
115
115
  // cleaning the cache for all files of that plug-in.
116
116
  Object.keys(require.cache).forEach(function (key): void {
117
- const mod: NodeJS.Module = require.cache[key];
117
+ const mod: NodeJS.Module = require.cache[key]!;
118
118
 
119
119
  // attempting to reload a native module will throw an error, so skip them
120
120
  if (mod.id.endsWith('.node')) {
@@ -16,6 +16,7 @@
16
16
 
17
17
  import * as path from 'path';
18
18
  import * as fs from '@theia/core/shared/fs-extra';
19
+ import { PluginIdentifiers } from '../../common';
19
20
 
20
21
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
21
22
  export async function loadManifest(pluginPath: string): Promise<any> {
@@ -25,5 +26,6 @@ export async function loadManifest(pluginPath: string): Promise<any> {
25
26
  if (manifest && manifest.name && manifest.name.startsWith(built_prefix)) {
26
27
  manifest.name = manifest.name.substr(built_prefix.length);
27
28
  }
29
+ manifest.publisher ??= PluginIdentifiers.UNPUBLISHED;
28
30
  return manifest;
29
31
  }
@@ -14,13 +14,14 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
  import { injectable, inject, named, postConstruct } from '@theia/core/shared/inversify';
17
- import { HostedPluginServer, HostedPluginClient, PluginDeployer, GetDeployedPluginsParams, DeployedPlugin } from '../../common/plugin-protocol';
17
+ import { HostedPluginServer, HostedPluginClient, PluginDeployer, GetDeployedPluginsParams, DeployedPlugin, PluginIdentifiers } from '../../common/plugin-protocol';
18
18
  import { HostedPluginSupport } from './hosted-plugin';
19
- import { ILogger, Disposable, ContributionProvider } from '@theia/core';
19
+ import { ILogger, Disposable, ContributionProvider, DisposableCollection } from '@theia/core';
20
20
  import { ExtPluginApiProvider, ExtPluginApi } from '../../common/plugin-ext-api-contribution';
21
21
  import { HostedPluginDeployerHandler } from './hosted-plugin-deployer-handler';
22
22
  import { PluginDeployerImpl } from '../../main/node/plugin-deployer-impl';
23
23
  import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
24
+ import { PluginUninstallationManager } from '../../main/node/plugin-uninstallation-manager';
24
25
 
25
26
  @injectable()
26
27
  export class HostedPluginServerImpl implements HostedPluginServer {
@@ -40,9 +41,21 @@ export class HostedPluginServerImpl implements HostedPluginServer {
40
41
  @named(Symbol.for(ExtPluginApiProvider))
41
42
  protected readonly extPluginAPIContributions: ContributionProvider<ExtPluginApiProvider>;
42
43
 
44
+ @inject(PluginUninstallationManager) protected readonly uninstallationManager: PluginUninstallationManager;
45
+
43
46
  protected client: HostedPluginClient | undefined;
47
+ protected toDispose = new DisposableCollection();
48
+
49
+ protected _ignoredPlugins?: Set<PluginIdentifiers.VersionedId>;
50
+ // We ignore any plugins that are marked as uninstalled the first time the frontend requests information about deployed plugins.
51
+ protected get ignoredPlugins(): Set<PluginIdentifiers.VersionedId> {
52
+ if (!this._ignoredPlugins) {
53
+ this._ignoredPlugins = new Set(this.uninstallationManager.getUninstalledPluginIds());
54
+ }
55
+ return this._ignoredPlugins;
56
+ }
44
57
 
45
- protected deployedListener: Disposable;
58
+ protected readonly pluginVersions = new Map<PluginIdentifiers.UnversionedId, string>();
46
59
 
47
60
  constructor(
48
61
  @inject(HostedPluginSupport) private readonly hostedPlugin: HostedPluginSupport) {
@@ -50,38 +63,78 @@ export class HostedPluginServerImpl implements HostedPluginServer {
50
63
 
51
64
  @postConstruct()
52
65
  protected init(): void {
53
- this.deployedListener = this.pluginDeployer.onDidDeploy(() => {
54
- if (this.client) {
55
- this.client.onDidDeploy();
56
- }
57
- });
66
+ this.toDispose.pushAll([
67
+ this.pluginDeployer.onDidDeploy(() => this.client?.onDidDeploy()),
68
+ this.uninstallationManager.onDidChangeUninstalledPlugins(currentUninstalled => {
69
+ if (this._ignoredPlugins) {
70
+ const uninstalled = new Set(currentUninstalled);
71
+ for (const previouslyUninstalled of this._ignoredPlugins) {
72
+ if (!uninstalled.has(previouslyUninstalled)) {
73
+ this._ignoredPlugins.delete(previouslyUninstalled);
74
+ }
75
+ }
76
+ }
77
+ this.client?.onDidDeploy();
78
+ }),
79
+ Disposable.create(() => this.hostedPlugin.clientClosed()),
80
+ ]);
58
81
  }
59
82
 
60
83
  dispose(): void {
61
- this.hostedPlugin.clientClosed();
62
- this.deployedListener.dispose();
84
+ this.toDispose.dispose();
63
85
  }
86
+
64
87
  setClient(client: HostedPluginClient): void {
65
88
  this.client = client;
66
89
  this.hostedPlugin.setClient(client);
67
90
  }
68
91
 
69
- async getDeployedPluginIds(): Promise<string[]> {
92
+ async getDeployedPluginIds(): Promise<PluginIdentifiers.VersionedId[]> {
70
93
  const backendMetadata = await this.deployerHandler.getDeployedBackendPluginIds();
71
94
  if (backendMetadata.length > 0) {
72
95
  this.hostedPlugin.runPluginServer();
73
96
  }
74
- const plugins = new Set<string>();
75
- for (const pluginId of await this.deployerHandler.getDeployedFrontendPluginIds()) {
76
- plugins.add(pluginId);
97
+ const plugins = new Set<PluginIdentifiers.VersionedId>();
98
+ const addIds = async (identifiers: PluginIdentifiers.VersionedId[]): Promise<void> => {
99
+ for (const pluginId of identifiers) {
100
+ if (this.isRelevantPlugin(pluginId)) {
101
+ plugins.add(pluginId);
102
+ }
103
+ }
104
+ };
105
+ addIds(await this.deployerHandler.getDeployedFrontendPluginIds());
106
+ addIds(backendMetadata);
107
+ addIds(await this.hostedPlugin.getExtraDeployedPluginIds());
108
+ return Array.from(plugins);
109
+ }
110
+
111
+ /**
112
+ * Ensures that the plugin was not uninstalled when this session was started
113
+ * and that it matches the first version of the given plugin seen by this session.
114
+ *
115
+ * The deployment system may have multiple versions of the same plugin available, but
116
+ * a single session should only ever activate one of them.
117
+ */
118
+ protected isRelevantPlugin(identifier: PluginIdentifiers.VersionedId): boolean {
119
+ const versionAndId = PluginIdentifiers.idAndVersionFromVersionedId(identifier);
120
+ if (!versionAndId) {
121
+ return false;
77
122
  }
78
- for (const pluginId of backendMetadata) {
79
- plugins.add(pluginId);
123
+ const knownVersion = this.pluginVersions.get(versionAndId.id);
124
+ if (knownVersion !== undefined && knownVersion !== versionAndId.version) {
125
+ return false;
80
126
  }
81
- for (const pluginId of await this.hostedPlugin.getExtraDeployedPluginIds()) {
82
- plugins.add(pluginId);
127
+ if (this.ignoredPlugins.has(identifier)) {
128
+ return false;
83
129
  }
84
- return [...plugins.values()];
130
+ if (knownVersion === undefined) {
131
+ this.pluginVersions.set(versionAndId.id, versionAndId.version);
132
+ }
133
+ return true;
134
+ }
135
+
136
+ getUninstalledPluginIds(): Promise<readonly PluginIdentifiers.VersionedId[]> {
137
+ return Promise.resolve(this.uninstallationManager.getUninstalledPluginIds());
85
138
  }
86
139
 
87
140
  async getDeployedPlugins({ pluginIds }: GetDeployedPluginsParams): Promise<DeployedPlugin[]> {
@@ -90,16 +143,19 @@ export class HostedPluginServerImpl implements HostedPluginServer {
90
143
  }
91
144
  const plugins: DeployedPlugin[] = [];
92
145
  let extraDeployedPlugins: Map<string, DeployedPlugin> | undefined;
93
- for (const pluginId of pluginIds) {
94
- let plugin = this.deployerHandler.getDeployedPlugin(pluginId);
146
+ for (const versionedId of pluginIds) {
147
+ if (!this.isRelevantPlugin(versionedId)) {
148
+ continue;
149
+ }
150
+ let plugin = this.deployerHandler.getDeployedPlugin(versionedId);
95
151
  if (!plugin) {
96
152
  if (!extraDeployedPlugins) {
97
153
  extraDeployedPlugins = new Map<string, DeployedPlugin>();
98
154
  for (const extraDeployedPlugin of await this.hostedPlugin.getExtraDeployedPlugins()) {
99
- extraDeployedPlugins.set(extraDeployedPlugin.metadata.model.id, extraDeployedPlugin);
155
+ extraDeployedPlugins.set(PluginIdentifiers.componentsToVersionedId(extraDeployedPlugin.metadata.model), extraDeployedPlugin);
100
156
  }
101
157
  }
102
- plugin = extraDeployedPlugins.get(pluginId);
158
+ plugin = extraDeployedPlugins.get(versionedId);
103
159
  }
104
160
  if (plugin) {
105
161
  plugins.push(plugin);
@@ -58,7 +58,8 @@ import {
58
58
  PluginPackageLocalization,
59
59
  Localization,
60
60
  PluginPackageTranslation,
61
- Translation
61
+ Translation,
62
+ PluginIdentifiers
62
63
  } from '../../../common/plugin-protocol';
63
64
  import * as fs from 'fs';
64
65
  import * as path from 'path';
@@ -109,13 +110,14 @@ export class TheiaPluginScanner implements PluginScanner {
109
110
  }
110
111
 
111
112
  getModel(plugin: PluginPackage): PluginModel {
113
+ const publisher = plugin.publisher ?? PluginIdentifiers.UNPUBLISHED;
112
114
  const result: PluginModel = {
113
115
  packagePath: plugin.packagePath,
114
116
  packageUri: this.pluginUriFactory.createUri(plugin).toString(),
115
117
  // see id definition: https://github.com/microsoft/vscode/blob/15916055fe0cb9411a5f36119b3b012458fe0a1d/src/vs/platform/extensions/common/extensions.ts#L167-L169
116
- id: `${plugin.publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
118
+ id: `${publisher.toLowerCase()}.${plugin.name.toLowerCase()}`,
117
119
  name: plugin.name,
118
- publisher: plugin.publisher,
120
+ publisher,
119
121
  version: plugin.version,
120
122
  displayName: plugin.displayName,
121
123
  description: plugin.description,
@@ -660,7 +662,8 @@ export class TheiaPluginScanner implements PluginScanner {
660
662
  wordPattern: rawConfiguration.wordPattern,
661
663
  autoClosingPairs: this.extractValidAutoClosingPairs(rawLang.id, rawConfiguration),
662
664
  indentationRules: rawConfiguration.indentationRules,
663
- surroundingPairs: this.extractValidSurroundingPairs(rawLang.id, rawConfiguration)
665
+ surroundingPairs: this.extractValidSurroundingPairs(rawLang.id, rawConfiguration),
666
+ onEnterRules: rawConfiguration.onEnterRules,
664
667
  };
665
668
  result.configuration = configuration;
666
669
  }
@@ -18,10 +18,10 @@ import { inject } from '@theia/core/shared/inversify';
18
18
  import URI from '@theia/core/lib/common/uri';
19
19
  import { ApplicationShell, OpenHandler, Widget, WidgetManager, WidgetOpenerOptions } from '@theia/core/lib/browser';
20
20
  import { CustomEditor, CustomEditorPriority, CustomEditorSelector } from '../../../common';
21
- import * as glob from './glob';
22
21
  import { CustomEditorWidget } from './custom-editor-widget';
23
22
  import { v4 } from 'uuid';
24
23
  import { Emitter } from '@theia/core';
24
+ import { match } from '@theia/core/lib/common/glob';
25
25
 
26
26
  export class CustomEditorOpener implements OpenHandler {
27
27
 
@@ -96,7 +96,7 @@ export class CustomEditorOpener implements OpenHandler {
96
96
 
97
97
  selectorMatches(selector: CustomEditorSelector, resource: URI): boolean {
98
98
  if (selector.filenamePattern) {
99
- if (glob.match(selector.filenamePattern.toLowerCase(), resource.path.name.toLowerCase() + resource.path.ext.toLowerCase())) {
99
+ if (match(selector.filenamePattern.toLowerCase(), resource.path.name.toLowerCase() + resource.path.ext.toLowerCase())) {
100
100
  return true;
101
101
  }
102
102
  }
@@ -30,8 +30,8 @@ import { TerminalOptionsExt } from '../../../common/plugin-api-rpc';
30
30
  import { FileService } from '@theia/filesystem/lib/browser/file-service';
31
31
  import { DebugContribution } from '@theia/debug/lib/browser/debug-contribution';
32
32
  import { ContributionProvider } from '@theia/core/lib/common/contribution-provider';
33
- import { Channel } from '@theia/debug/lib/common/debug-service';
34
33
  import { WorkspaceService } from '@theia/workspace/lib/browser';
34
+ import { PluginChannel } from '../../../common/connection';
35
35
 
36
36
  export class PluginDebugSession extends DebugSession {
37
37
  constructor(
@@ -71,7 +71,7 @@ export class PluginDebugSessionFactory extends DefaultDebugSessionFactory {
71
71
  protected override readonly messages: MessageClient,
72
72
  protected override readonly outputChannelManager: OutputChannelManager,
73
73
  protected override readonly debugPreferences: DebugPreferences,
74
- protected readonly connectionFactory: (sessionId: string) => Promise<Channel>,
74
+ protected readonly connectionFactory: (sessionId: string) => Promise<PluginChannel>,
75
75
  protected override readonly fileService: FileService,
76
76
  protected readonly terminalOptionsExt: TerminalOptionsExt | undefined,
77
77
  protected override readonly debugContributionProvider: ContributionProvider<DebugContribution>,
@@ -16,11 +16,10 @@
16
16
  import { DocumentsMain, MAIN_RPC_CONTEXT, DocumentsExt } from '../../common/plugin-api-rpc';
17
17
  import { UriComponents } from '../../common/uri-components';
18
18
  import { EditorsAndDocumentsMain } from './editors-and-documents-main';
19
- import { DisposableCollection, Disposable } from '@theia/core';
19
+ import { DisposableCollection, Disposable, UntitledResourceResolver } from '@theia/core';
20
20
  import { MonacoEditorModel } from '@theia/monaco/lib/browser/monaco-editor-model';
21
21
  import { RPCProtocol } from '../../common/rpc-protocol';
22
22
  import { EditorModelService } from './text-editor-model-service';
23
- import { UntitledResourceResolver } from './editor/untitled-resource';
24
23
  import { EditorManager, EditorOpenerOptions } from '@theia/editor/lib/browser';
25
24
  import URI from '@theia/core/lib/common/uri';
26
25
  import { URI as CodeURI } from '@theia/core/shared/vscode-uri';
@@ -248,16 +247,35 @@ export class DocumentsMainImpl implements DocumentsMain, Disposable {
248
247
  }
249
248
  /* fall back to side group -> split relative to the active widget */
250
249
  let widgetOptions: ApplicationShell.WidgetOptions | undefined = { mode: 'split-right' };
251
- const viewColumn = options.viewColumn;
250
+ let viewColumn = options.viewColumn;
251
+ if (viewColumn === -2) {
252
+ /* show besides -> compute current column and adjust viewColumn accordingly */
253
+ const tabBars = shell.mainAreaTabBars;
254
+ const currentTabBar = shell.currentTabBar;
255
+ if (currentTabBar) {
256
+ const currentColumn = tabBars.indexOf(currentTabBar);
257
+ if (currentColumn > -1) {
258
+ // +2 because conversion from 0-based to 1-based index and increase of 1
259
+ viewColumn = currentColumn + 2;
260
+ }
261
+ }
262
+ }
252
263
  if (viewColumn === undefined || viewColumn === -1) {
253
264
  /* active group -> skip (default behaviour) */
254
265
  widgetOptions = undefined;
255
- } else if (viewColumn > 0) {
266
+ } else if (viewColumn > 0 && shell.mainAreaTabBars.length > 0) {
256
267
  const tabBars = shell.mainAreaTabBars;
257
- // convert to zero-based index
258
- const tabBar = tabBars[viewColumn - 1];
259
- if (tabBar && tabBar.currentTitle) {
260
- widgetOptions = { ref: tabBar.currentTitle.owner };
268
+ if (viewColumn <= tabBars.length) {
269
+ // convert to zero-based index
270
+ const tabBar = tabBars[viewColumn - 1];
271
+ if (tabBar?.currentTitle) {
272
+ widgetOptions = { ref: tabBar.currentTitle.owner };
273
+ }
274
+ } else {
275
+ const tabBar = tabBars[tabBars.length - 1];
276
+ if (tabBar?.currentTitle) {
277
+ widgetOptions!.ref = tabBar.currentTitle.owner;
278
+ }
261
279
  }
262
280
  }
263
281
  return {
@@ -41,6 +41,7 @@ export class EditorsAndDocumentsMain implements Disposable {
41
41
  private readonly textEditors = new Map<string, TextEditorMain>();
42
42
 
43
43
  private readonly modelService: EditorModelService;
44
+ private readonly editorService: EditorManager;
44
45
 
45
46
  private readonly onTextEditorAddEmitter = new Emitter<TextEditorMain[]>();
46
47
  private readonly onTextEditorRemoveEmitter = new Emitter<string[]>();
@@ -59,10 +60,10 @@ export class EditorsAndDocumentsMain implements Disposable {
59
60
  constructor(rpc: RPCProtocol, container: interfaces.Container) {
60
61
  this.proxy = rpc.getProxy(MAIN_RPC_CONTEXT.EDITORS_AND_DOCUMENTS_EXT);
61
62
 
62
- const editorService = container.get(EditorManager);
63
+ this.editorService = container.get(EditorManager);
63
64
  this.modelService = container.get(EditorModelService);
64
65
 
65
- this.stateComputer = new EditorAndDocumentStateComputer(d => this.onDelta(d), editorService, this.modelService);
66
+ this.stateComputer = new EditorAndDocumentStateComputer(d => this.onDelta(d), this.editorService, this.modelService);
66
67
  this.toDispose.push(this.stateComputer);
67
68
  this.toDispose.push(this.onTextEditorAddEmitter);
68
69
  this.toDispose.push(this.onTextEditorRemoveEmitter);
@@ -168,6 +169,19 @@ export class EditorsAndDocumentsMain implements Disposable {
168
169
  saveAll(includeUntitled?: boolean): Promise<boolean> {
169
170
  return this.modelService.saveAll(includeUntitled);
170
171
  }
172
+
173
+ hideEditor(id: string): Promise<void> {
174
+ for (const editorWidget of this.editorService.all) {
175
+ const monacoEditor = MonacoEditor.get(editorWidget);
176
+ if (monacoEditor) {
177
+ if (id === new EditorSnapshot(monacoEditor).id) {
178
+ editorWidget.close();
179
+ break;
180
+ }
181
+ }
182
+ }
183
+ return Promise.resolve();
184
+ }
171
185
  }
172
186
 
173
187
  class EditorAndDocumentStateComputer implements Disposable {
@@ -1075,7 +1075,8 @@ function reviveOnEnterRule(onEnterRule: SerializedOnEnterRule): monaco.languages
1075
1075
  return {
1076
1076
  beforeText: reviveRegExp(onEnterRule.beforeText)!,
1077
1077
  afterText: reviveRegExp(onEnterRule.afterText),
1078
- action: onEnterRule.action
1078
+ previousLineText: reviveRegExp(onEnterRule.previousLineText),
1079
+ action: onEnterRule.action,
1079
1080
  };
1080
1081
  }
1081
1082
 
@@ -46,7 +46,6 @@ import { OpenerService } from '@theia/core/lib/browser/opener-service';
46
46
  import { ApplicationShell } from '@theia/core/lib/browser/shell/application-shell';
47
47
  import { MonacoBulkEditService } from '@theia/monaco/lib/browser/monaco-bulk-edit-service';
48
48
  import { MonacoEditorService } from '@theia/monaco/lib/browser/monaco-editor-service';
49
- import { UntitledResourceResolver } from './editor/untitled-resource';
50
49
  import { MainFileSystemEventService } from './main-file-system-event-service';
51
50
  import { LabelServiceMainImpl } from './label-service-main';
52
51
  import { TimelineMainImpl } from './timeline-main';
@@ -58,6 +57,8 @@ import { SecretsMainImpl } from './secrets-main';
58
57
  import { WebviewViewsMainImpl } from './webview-views/webview-views-main';
59
58
  import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages';
60
59
  import { NotificationExtImpl } from '../../plugin/notification';
60
+ import { UntitledResourceResolver } from '@theia/core/lib/common/resource';
61
+ import { ThemeService } from '@theia/core/lib/browser/theming';
61
62
 
62
63
  export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container): void {
63
64
  const authenticationMain = new AuthenticationMainImpl(rpc, container);
@@ -94,7 +95,7 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
94
95
 
95
96
  const bulkEditService = container.get(MonacoBulkEditService);
96
97
  const monacoEditorService = container.get(MonacoEditorService);
97
- const editorsMain = new TextEditorsMainImpl(editorsAndDocuments, rpc, bulkEditService, monacoEditorService);
98
+ const editorsMain = new TextEditorsMainImpl(editorsAndDocuments, documentsMain, rpc, bulkEditService, monacoEditorService);
98
99
  rpc.set(PLUGIN_RPC_CONTEXT.TEXT_EDITORS_MAIN, editorsMain);
99
100
 
100
101
  // start listening only after all clients are subscribed to events
@@ -178,7 +179,7 @@ export function setUpPluginApi(rpc: RPCProtocol, container: interfaces.Container
178
179
  const timelineMain = new TimelineMainImpl(rpc, container);
179
180
  rpc.set(PLUGIN_RPC_CONTEXT.TIMELINE_MAIN, timelineMain);
180
181
 
181
- const themingMain = new ThemingMainImpl(rpc);
182
+ const themingMain = new ThemingMainImpl(rpc, container.get(ThemeService));
182
183
  rpc.set(PLUGIN_RPC_CONTEXT.THEMING_MAIN, themingMain);
183
184
 
184
185
  const commentsMain = new CommentsMainImp(rpc, container);
@@ -20,7 +20,7 @@ import { TextmateRegistry, getEncodedLanguageId, MonacoTextmateService, GrammarD
20
20
  import { MenusContributionPointHandler } from './menus/menus-contribution-handler';
21
21
  import { PluginViewRegistry } from './view/plugin-view-registry';
22
22
  import { PluginCustomEditorRegistry } from './custom-editors/plugin-custom-editor-registry';
23
- import { PluginContribution, IndentationRules, FoldingRules, ScopeMap, DeployedPlugin, GrammarsContribution } from '../../common';
23
+ import { PluginContribution, IndentationRules, FoldingRules, ScopeMap, DeployedPlugin, GrammarsContribution, EnterAction, OnEnterRule } from '../../common';
24
24
  import {
25
25
  DefaultUriLabelProviderContribution,
26
26
  LabelProviderContribution,
@@ -172,7 +172,8 @@ export class PluginContributionHandler {
172
172
  comments: langConfiguration.comments,
173
173
  folding: this.convertFolding(langConfiguration.folding),
174
174
  surroundingPairs: langConfiguration.surroundingPairs,
175
- indentationRules: this.convertIndentationRules(langConfiguration.indentationRules)
175
+ indentationRules: this.convertIndentationRules(langConfiguration.indentationRules),
176
+ onEnterRules: this.convertOnEnterRules(langConfiguration.onEnterRules),
176
177
  }));
177
178
  }
178
179
  }
@@ -484,7 +485,6 @@ export class PluginContributionHandler {
484
485
  }
485
486
 
486
487
  return result;
487
-
488
488
  }
489
489
 
490
490
  private convertTokenTypes(tokenTypes?: ScopeMap): ITokenTypeMap | undefined {
@@ -530,4 +530,42 @@ export class PluginContributionHandler {
530
530
  return result;
531
531
  }
532
532
 
533
+ private convertOnEnterRules(onEnterRules?: OnEnterRule[]): monaco.languages.OnEnterRule[] | undefined {
534
+ if (!onEnterRules) {
535
+ return undefined;
536
+ }
537
+
538
+ const result: monaco.languages.OnEnterRule[] = [];
539
+ for (const onEnterRule of onEnterRules) {
540
+ const rule: monaco.languages.OnEnterRule = {
541
+ beforeText: this.createRegex(onEnterRule.beforeText)!,
542
+ afterText: this.createRegex(onEnterRule.afterText),
543
+ previousLineText: this.createRegex(onEnterRule.previousLineText),
544
+ action: this.createEnterAction(onEnterRule.action),
545
+ };
546
+ result.push(rule);
547
+ }
548
+
549
+ return result;
550
+ }
551
+
552
+ private createEnterAction(action: EnterAction): monaco.languages.EnterAction {
553
+ let indentAction: monaco.languages.IndentAction;
554
+ switch (action.indent) {
555
+ case 'indent':
556
+ indentAction = monaco.languages.IndentAction.Indent;
557
+ break;
558
+ case 'indentOutdent':
559
+ indentAction = monaco.languages.IndentAction.IndentOutdent;
560
+ break;
561
+ case 'outdent':
562
+ indentAction = monaco.languages.IndentAction.Outdent;
563
+ break;
564
+ default:
565
+ indentAction = monaco.languages.IndentAction.None;
566
+ break;
567
+ }
568
+ return { indentAction, appendText: action.appendText, removeText: action.removeText };
569
+ }
570
+
533
571
  }
@@ -30,7 +30,7 @@ import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposa
30
30
  import { Emitter } from '@theia/core/lib/common/event';
31
31
  import { RecursivePartial } from '@theia/core/lib/common/types';
32
32
  import { LabelProviderContribution, DidChangeLabelEvent, LabelProvider, URIIconReference } from '@theia/core/lib/browser/label-provider';
33
- import { ThemeType } from '@theia/core/lib/browser/theming';
33
+ import { ThemeType } from '@theia/core/lib/common/theme';
34
34
  import { FileStatNode, DirNode } from '@theia/filesystem/lib/browser';
35
35
  import { WorkspaceRootNode } from '@theia/navigator/lib/browser/navigator-tree';
36
36
  import { Endpoint } from '@theia/core/lib/browser/endpoint';
@@ -14,9 +14,10 @@
14
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  // *****************************************************************************
16
16
 
17
- import { injectable } from '@theia/core/shared/inversify';
17
+ import { inject, injectable, postConstruct } from '@theia/core/shared/inversify';
18
18
  import { Disposable, DisposableCollection } from '@theia/core/lib/common/disposable';
19
- import { ThemeService, Theme } from '@theia/core/lib/browser/theming';
19
+ import { ThemeService } from '@theia/core/lib/browser/theming';
20
+ import { Theme } from '@theia/core/lib/common/theme';
20
21
  import { IconUrl } from '../../common/plugin-protocol';
21
22
  import { Reference, SyncReferenceCollection } from '@theia/core/lib/common/reference';
22
23
  import { Endpoint } from '@theia/core/lib/browser/endpoint';
@@ -33,15 +34,18 @@ export interface PluginIcon extends Disposable {
33
34
  @injectable()
34
35
  export class PluginSharedStyle {
35
36
 
37
+ @inject(ThemeService) protected readonly themeService: ThemeService;
38
+
36
39
  protected style: HTMLStyleElement;
37
40
  protected readonly rules: {
38
41
  selector: string;
39
42
  body: (theme: Theme) => string
40
43
  }[] = [];
41
44
 
42
- constructor() {
45
+ @postConstruct()
46
+ protected init(): void {
43
47
  this.update();
44
- ThemeService.get().onDidColorThemeChange(() => this.update());
48
+ this.themeService.onDidColorThemeChange(() => this.update());
45
49
  }
46
50
 
47
51
  protected readonly toUpdate = new DisposableCollection();
@@ -78,7 +82,7 @@ export class PluginSharedStyle {
78
82
  body: (theme: Theme) => string
79
83
  }): void {
80
84
  const sheet = (<CSSStyleSheet>this.style.sheet);
81
- const cssBody = body(ThemeService.get().getCurrentTheme());
85
+ const cssBody = body(this.themeService.getCurrentTheme());
82
86
  sheet.insertRule(selector + ' {\n' + cssBody + '\n}', 0);
83
87
  }
84
88
  deleteRule(selector: string): void {