@theia/plugin-ext 1.27.0-next.4 → 1.27.0-next.43

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 (224) 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 +20 -11
  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 +41 -7
  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 +20 -13
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/browser/worker/plugin-manifest-loader.d.ts.map +1 -1
  21. package/lib/hosted/browser/worker/plugin-manifest-loader.js +4 -1
  22. package/lib/hosted/browser/worker/plugin-manifest-loader.js.map +1 -1
  23. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +10 -5
  24. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  25. package/lib/hosted/node/hosted-plugin-deployer-handler.js +54 -12
  26. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
  28. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  29. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  30. package/lib/hosted/node/hosted-plugin.d.ts +2 -2
  31. package/lib/hosted/node/hosted-plugin.d.ts.map +1 -1
  32. package/lib/hosted/node/hosted-plugin.js.map +1 -1
  33. package/lib/hosted/node/metadata-scanner.d.ts +3 -2
  34. package/lib/hosted/node/metadata-scanner.d.ts.map +1 -1
  35. package/lib/hosted/node/metadata-scanner.js +8 -3
  36. package/lib/hosted/node/metadata-scanner.js.map +1 -1
  37. package/lib/hosted/node/plugin-host-rpc.js.map +1 -1
  38. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
  39. package/lib/hosted/node/plugin-manifest-loader.js +3 -0
  40. package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
  41. package/lib/hosted/node/plugin-service.d.ts +18 -4
  42. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  43. package/lib/hosted/node/plugin-service.js +73 -18
  44. package/lib/hosted/node/plugin-service.js.map +1 -1
  45. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  46. package/lib/hosted/node/scanners/scanner-theia.js +6 -3
  47. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  48. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  49. package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -2
  50. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  51. package/lib/main/browser/debug/plugin-debug-service.d.ts +6 -0
  52. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  53. package/lib/main/browser/debug/plugin-debug-service.js +25 -3
  54. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  55. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +3 -3
  56. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  57. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  58. package/lib/main/browser/documents-main.d.ts +1 -2
  59. package/lib/main/browser/documents-main.d.ts.map +1 -1
  60. package/lib/main/browser/documents-main.js +26 -6
  61. package/lib/main/browser/documents-main.js.map +1 -1
  62. package/lib/main/browser/editors-and-documents-main.d.ts +2 -0
  63. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  64. package/lib/main/browser/editors-and-documents-main.js +14 -2
  65. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  66. package/lib/main/browser/languages-main.d.ts.map +1 -1
  67. package/lib/main/browser/languages-main.js +2 -1
  68. package/lib/main/browser/languages-main.js.map +1 -1
  69. package/lib/main/browser/main-context.d.ts.map +1 -1
  70. package/lib/main/browser/main-context.js +5 -4
  71. package/lib/main/browser/main-context.js.map +1 -1
  72. package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
  73. package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
  74. package/lib/main/browser/plugin-contribution-handler.js +36 -1
  75. package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
  76. package/lib/main/browser/plugin-shared-style.d.ts +4 -2
  77. package/lib/main/browser/plugin-shared-style.d.ts.map +1 -1
  78. package/lib/main/browser/plugin-shared-style.js +15 -4
  79. package/lib/main/browser/plugin-shared-style.js.map +1 -1
  80. package/lib/main/browser/text-editors-main.d.ts +6 -3
  81. package/lib/main/browser/text-editors-main.d.ts.map +1 -1
  82. package/lib/main/browser/text-editors-main.js +8 -1
  83. package/lib/main/browser/text-editors-main.js.map +1 -1
  84. package/lib/main/browser/theming-main.d.ts +2 -1
  85. package/lib/main/browser/theming-main.d.ts.map +1 -1
  86. package/lib/main/browser/theming-main.js +3 -6
  87. package/lib/main/browser/theming-main.js.map +1 -1
  88. package/lib/main/browser/view/plugin-tree-view-node-label-provider.d.ts.map +1 -1
  89. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js +7 -5
  90. package/lib/main/browser/view/plugin-tree-view-node-label-provider.js.map +1 -1
  91. package/lib/main/browser/view/plugin-view-registry.d.ts +1 -1
  92. package/lib/main/browser/view/plugin-view-registry.js +2 -2
  93. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  94. package/lib/main/browser/view/tree-view-widget.d.ts +10 -5
  95. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  96. package/lib/main/browser/view/tree-view-widget.js +39 -13
  97. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  98. package/lib/main/browser/webview/webview-theme-data-provider.d.ts +3 -1
  99. package/lib/main/browser/webview/webview-theme-data-provider.d.ts.map +1 -1
  100. package/lib/main/browser/webview/webview-theme-data-provider.js +5 -1
  101. package/lib/main/browser/webview/webview-theme-data-provider.js.map +1 -1
  102. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts +6 -1
  103. package/lib/main/node/handlers/plugin-theia-directory-handler.d.ts.map +1 -1
  104. package/lib/main/node/handlers/plugin-theia-directory-handler.js +61 -20
  105. package/lib/main/node/handlers/plugin-theia-directory-handler.js.map +1 -1
  106. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts +4 -0
  107. package/lib/main/node/handlers/plugin-theia-file-handler.d.ts.map +1 -1
  108. package/lib/main/node/handlers/plugin-theia-file-handler.js +25 -4
  109. package/lib/main/node/handlers/plugin-theia-file-handler.js.map +1 -1
  110. package/lib/main/node/plugin-cli-contribution.d.ts +3 -0
  111. package/lib/main/node/plugin-cli-contribution.d.ts.map +1 -1
  112. package/lib/main/node/plugin-cli-contribution.js +13 -0
  113. package/lib/main/node/plugin-cli-contribution.js.map +1 -1
  114. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts +1 -0
  115. package/lib/main/node/plugin-deployer-directory-handler-context-impl.d.ts.map +1 -1
  116. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js +17 -0
  117. package/lib/main/node/plugin-deployer-directory-handler-context-impl.js.map +1 -1
  118. package/lib/main/node/plugin-deployer-file-handler-context-impl.d.ts.map +1 -1
  119. package/lib/main/node/plugin-deployer-file-handler-context-impl.js +0 -1
  120. package/lib/main/node/plugin-deployer-file-handler-context-impl.js.map +1 -1
  121. package/lib/main/node/plugin-deployer-impl.d.ts +5 -2
  122. package/lib/main/node/plugin-deployer-impl.d.ts.map +1 -1
  123. package/lib/main/node/plugin-deployer-impl.js +72 -28
  124. package/lib/main/node/plugin-deployer-impl.js.map +1 -1
  125. package/lib/main/node/plugin-ext-backend-module.d.ts.map +1 -1
  126. package/lib/main/node/plugin-ext-backend-module.js +2 -0
  127. package/lib/main/node/plugin-ext-backend-module.js.map +1 -1
  128. package/lib/main/node/plugin-server-handler.d.ts +3 -2
  129. package/lib/main/node/plugin-server-handler.d.ts.map +1 -1
  130. package/lib/main/node/plugin-server-handler.js +3 -0
  131. package/lib/main/node/plugin-server-handler.js.map +1 -1
  132. package/lib/main/node/plugin-uninstallation-manager.d.ts +12 -0
  133. package/lib/main/node/plugin-uninstallation-manager.d.ts.map +1 -0
  134. package/lib/main/node/plugin-uninstallation-manager.js +66 -0
  135. package/lib/main/node/plugin-uninstallation-manager.js.map +1 -0
  136. package/lib/plugin/custom-editors.d.ts +1 -2
  137. package/lib/plugin/custom-editors.d.ts.map +1 -1
  138. package/lib/plugin/custom-editors.js.map +1 -1
  139. package/lib/plugin/languages-utils.d.ts.map +1 -1
  140. package/lib/plugin/languages-utils.js +3 -2
  141. package/lib/plugin/languages-utils.js.map +1 -1
  142. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +2 -2
  143. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  144. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  145. package/lib/plugin/plugin-context.d.ts.map +1 -1
  146. package/lib/plugin/plugin-context.js +0 -1
  147. package/lib/plugin/plugin-context.js.map +1 -1
  148. package/lib/plugin/text-editor.d.ts +2 -0
  149. package/lib/plugin/text-editor.d.ts.map +1 -1
  150. package/lib/plugin/text-editor.js +9 -0
  151. package/lib/plugin/text-editor.js.map +1 -1
  152. package/lib/plugin/theming.d.ts +1 -1
  153. package/lib/plugin/theming.d.ts.map +1 -1
  154. package/lib/plugin/tree/tree-views.d.ts +1 -0
  155. package/lib/plugin/tree/tree-views.d.ts.map +1 -1
  156. package/lib/plugin/tree/tree-views.js +10 -9
  157. package/lib/plugin/tree/tree-views.js.map +1 -1
  158. package/lib/plugin/types-impl.d.ts +1 -0
  159. package/lib/plugin/types-impl.d.ts.map +1 -1
  160. package/lib/plugin/types-impl.js +3 -2
  161. package/lib/plugin/types-impl.js.map +1 -1
  162. package/package.json +25 -24
  163. package/src/common/connection.ts +3 -4
  164. package/src/common/plugin-api-rpc.ts +23 -17
  165. package/src/common/plugin-identifiers.ts +84 -0
  166. package/src/common/plugin-protocol.ts +47 -8
  167. package/src/hosted/browser/hosted-plugin.ts +22 -16
  168. package/src/hosted/browser/worker/plugin-manifest-loader.ts +4 -2
  169. package/src/hosted/node/hosted-plugin-deployer-handler.ts +64 -20
  170. package/src/hosted/node/hosted-plugin-process.ts +4 -4
  171. package/src/hosted/node/hosted-plugin.ts +2 -2
  172. package/src/hosted/node/metadata-scanner.ts +8 -6
  173. package/src/hosted/node/plugin-host-rpc.ts +1 -1
  174. package/src/hosted/node/plugin-manifest-loader.ts +2 -0
  175. package/src/hosted/node/plugin-service.ts +79 -23
  176. package/src/hosted/node/scanners/scanner-theia.ts +7 -4
  177. package/src/main/browser/custom-editors/custom-editor-opener.tsx +2 -2
  178. package/src/main/browser/debug/plugin-debug-service.ts +32 -3
  179. package/src/main/browser/debug/plugin-debug-session-factory.ts +2 -2
  180. package/src/main/browser/documents-main.ts +26 -8
  181. package/src/main/browser/editors-and-documents-main.ts +16 -2
  182. package/src/main/browser/languages-main.ts +2 -1
  183. package/src/main/browser/main-context.ts +4 -3
  184. package/src/main/browser/plugin-contribution-handler.ts +41 -3
  185. package/src/main/browser/plugin-icon-theme-service.ts +1 -1
  186. package/src/main/browser/plugin-shared-style.ts +9 -5
  187. package/src/main/browser/text-editors-main.ts +12 -2
  188. package/src/main/browser/theming-main.ts +3 -7
  189. package/src/main/browser/view/plugin-tree-view-node-label-provider.ts +7 -5
  190. package/src/main/browser/view/plugin-view-registry.ts +3 -3
  191. package/src/main/browser/view/tree-view-widget.tsx +44 -16
  192. package/src/main/browser/webview/webview-theme-data-provider.ts +7 -10
  193. package/src/main/node/handlers/plugin-theia-directory-handler.ts +56 -28
  194. package/src/main/node/handlers/plugin-theia-file-handler.ts +25 -4
  195. package/src/main/node/plugin-cli-contribution.ts +12 -0
  196. package/src/main/node/plugin-deployer-directory-handler-context-impl.ts +17 -1
  197. package/src/main/node/plugin-deployer-file-handler-context-impl.ts +0 -1
  198. package/src/main/node/plugin-deployer-impl.ts +75 -30
  199. package/src/main/node/plugin-ext-backend-module.ts +3 -0
  200. package/src/main/node/plugin-server-handler.ts +6 -2
  201. package/src/main/node/plugin-uninstallation-manager.ts +60 -0
  202. package/src/plugin/custom-editors.ts +2 -3
  203. package/src/plugin/languages-utils.ts +3 -2
  204. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +2 -2
  205. package/src/plugin/plugin-context.ts +0 -1
  206. package/src/plugin/text-editor.ts +16 -5
  207. package/src/plugin/theming.ts +1 -1
  208. package/src/plugin/tree/tree-views.ts +15 -12
  209. package/src/plugin/types-impl.ts +1 -1
  210. package/lib/main/browser/custom-editors/glob.d.ts +0 -51
  211. package/lib/main/browser/custom-editors/glob.d.ts.map +0 -1
  212. package/lib/main/browser/custom-editors/glob.js +0 -593
  213. package/lib/main/browser/custom-editors/glob.js.map +0 -1
  214. package/lib/main/browser/custom-editors/paths.d.ts +0 -25
  215. package/lib/main/browser/custom-editors/paths.d.ts.map +0 -1
  216. package/lib/main/browser/custom-editors/paths.js +0 -227
  217. package/lib/main/browser/custom-editors/paths.js.map +0 -1
  218. package/lib/main/browser/editor/untitled-resource.d.ts +0 -3
  219. package/lib/main/browser/editor/untitled-resource.d.ts.map +0 -1
  220. package/lib/main/browser/editor/untitled-resource.js +0 -24
  221. package/lib/main/browser/editor/untitled-resource.js.map +0 -1
  222. package/src/main/browser/custom-editors/glob.ts +0 -743
  223. package/src/main/browser/custom-editors/paths.ts +0 -250
  224. package/src/main/browser/editor/untitled-resource.ts +0 -18
@@ -17,11 +17,12 @@
17
17
  /* eslint-disable @typescript-eslint/no-explicit-any */
18
18
 
19
19
  import { injectable, optional, multiInject, inject, named } from '@theia/core/shared/inversify';
20
+ import * as semver from 'semver';
20
21
  import {
21
22
  PluginDeployerResolver, PluginDeployerFileHandler, PluginDeployerDirectoryHandler,
22
23
  PluginDeployerEntry, PluginDeployer, PluginDeployerParticipant, PluginDeployerStartContext,
23
24
  PluginDeployerResolverInit, PluginDeployerFileHandlerContext,
24
- PluginDeployerDirectoryHandlerContext, PluginDeployerEntryType, PluginDeployerHandler, PluginType, UnresolvedPluginEntry
25
+ PluginDeployerDirectoryHandlerContext, PluginDeployerEntryType, PluginDeployerHandler, PluginType, UnresolvedPluginEntry, PluginIdentifiers
25
26
  } from '../../common/plugin-protocol';
26
27
  import { PluginDeployerEntryImpl } from './plugin-deployer-entry-impl';
27
28
  import {
@@ -135,7 +136,11 @@ export class PluginDeployerImpl implements PluginDeployer {
135
136
  deployPlugins.log('Deploy plugins list');
136
137
  }
137
138
 
138
- async undeploy(pluginId: string): Promise<void> {
139
+ async uninstall(pluginId: PluginIdentifiers.VersionedId): Promise<void> {
140
+ await this.pluginDeployerHandler.uninstallPlugin(pluginId);
141
+ }
142
+
143
+ async undeploy(pluginId: PluginIdentifiers.VersionedId): Promise<void> {
139
144
  if (await this.pluginDeployerHandler.undeployPlugin(pluginId)) {
140
145
  this.onDidDeployEmitter.fire();
141
146
  }
@@ -163,49 +168,49 @@ export class PluginDeployerImpl implements PluginDeployer {
163
168
  */
164
169
  async resolvePlugins(plugins: UnresolvedPluginEntry[]): Promise<PluginDeployerEntry[]> {
165
170
  const visited = new Set<string>();
166
- const pluginsToDeploy = new Map<string, PluginDeployerEntry>();
171
+ const hasBeenVisited = (id: string) => visited.has(id) || (visited.add(id), false);
172
+ const pluginsToDeploy = new Map<PluginIdentifiers.VersionedId, PluginDeployerEntry>();
173
+ const unversionedIdsHandled = new Map<PluginIdentifiers.UnversionedId, string[]>();
167
174
 
168
- let queue: UnresolvedPluginEntry[] = [...plugins];
175
+ const queue: UnresolvedPluginEntry[] = [...plugins];
169
176
  while (queue.length) {
170
- const dependenciesChunk: Array<{
177
+ const pendingDependencies: Array<{
171
178
  dependencies: Map<string, string>
172
179
  type: PluginType
173
180
  }> = [];
174
- const workload: UnresolvedPluginEntry[] = [];
175
- while (queue.length) {
176
- const current = queue.shift()!;
177
- if (visited.has(current.id)) {
178
- continue;
179
- } else {
180
- workload.push(current);
181
- }
182
- visited.add(current.id);
183
- }
184
- queue = [];
185
- await Promise.all(workload.map(async ({ id, type }) => {
186
- if (type === undefined) {
187
- type = PluginType.System;
181
+ await Promise.all(queue.map(async entry => {
182
+ if (hasBeenVisited(entry.id)) {
183
+ return;
188
184
  }
185
+ const type = entry.type ?? PluginType.System;
189
186
  try {
190
- const pluginDeployerEntries = await this.resolvePlugin(id, type);
191
- await this.applyFileHandlers(pluginDeployerEntries);
192
- await this.applyDirectoryFileHandlers(pluginDeployerEntries);
187
+ const pluginDeployerEntries = await this.resolveAndHandle(entry.id, type);
193
188
  for (const deployerEntry of pluginDeployerEntries) {
194
- const dependencies = await this.pluginDeployerHandler.getPluginDependencies(deployerEntry);
195
- if (dependencies && !pluginsToDeploy.has(dependencies.metadata.model.id)) {
196
- pluginsToDeploy.set(dependencies.metadata.model.id, deployerEntry);
197
- if (dependencies.mapping) {
198
- dependenciesChunk.push({ dependencies: dependencies.mapping, type });
189
+ const pluginData = await this.pluginDeployerHandler.getPluginDependencies(deployerEntry);
190
+ const versionedId = pluginData && PluginIdentifiers.componentsToVersionedId(pluginData.metadata.model);
191
+ const unversionedId = versionedId && PluginIdentifiers.componentsToUnversionedId(pluginData.metadata.model);
192
+ if (unversionedId && !pluginsToDeploy.has(versionedId)) {
193
+ pluginsToDeploy.set(versionedId, deployerEntry);
194
+ if (pluginData.mapping) {
195
+ pendingDependencies.push({ dependencies: pluginData.mapping, type });
196
+ }
197
+ const otherVersions = unversionedIdsHandled.get(unversionedId) ?? [];
198
+ otherVersions.push(pluginData.metadata.model.version);
199
+ if (otherVersions.length === 1) {
200
+ unversionedIdsHandled.set(unversionedId, otherVersions);
201
+ } else {
202
+ this.findBestVersion(unversionedId, otherVersions, pluginsToDeploy);
199
203
  }
200
204
  }
201
205
  }
202
206
  } catch (e) {
203
- console.error(`Failed to resolve plugins from '${id}'`, e);
207
+ console.error(`Failed to resolve plugins from '${entry.id}'`, e);
204
208
  }
205
209
  }));
206
- for (const { dependencies, type } of dependenciesChunk) {
210
+ queue.length = 0;
211
+ for (const { dependencies, type } of pendingDependencies) {
207
212
  for (const [dependency, deployableDependency] of dependencies) {
208
- if (!pluginsToDeploy.has(dependency)) {
213
+ if (!unversionedIdsHandled.has(dependency as PluginIdentifiers.UnversionedId)) {
209
214
  queue.push({
210
215
  id: deployableDependency,
211
216
  type
@@ -217,6 +222,46 @@ export class PluginDeployerImpl implements PluginDeployer {
217
222
  return [...pluginsToDeploy.values()];
218
223
  }
219
224
 
225
+ protected async resolveAndHandle(id: string, type: PluginType): Promise<PluginDeployerEntry[]> {
226
+ const entries = await this.resolvePlugin(id, type);
227
+ await this.applyFileHandlers(entries);
228
+ await this.applyDirectoryFileHandlers(entries);
229
+ return entries;
230
+ }
231
+
232
+ protected findBestVersion(unversionedId: PluginIdentifiers.UnversionedId, versions: string[], knownPlugins: Map<PluginIdentifiers.VersionedId, PluginDeployerEntry>): void {
233
+ // If left better, return negative. Then best is index 0.
234
+ versions.map(version => ({ version, plugin: knownPlugins.get(PluginIdentifiers.idAndVersionToVersionedId({ version, id: unversionedId })) }))
235
+ .sort((left, right) => {
236
+ const leftPlugin = left.plugin;
237
+ const rightPlugin = right.plugin;
238
+ if (!leftPlugin && !rightPlugin) {
239
+ return 0;
240
+ }
241
+ if (!rightPlugin) {
242
+ return -1;
243
+ }
244
+ if (!leftPlugin) {
245
+ return 1;
246
+ }
247
+ if (leftPlugin.type === PluginType.System && rightPlugin.type === PluginType.User) {
248
+ return -1;
249
+ }
250
+ if (leftPlugin.type === PluginType.User && rightPlugin.type === PluginType.System) {
251
+ return 1;
252
+ }
253
+ if (semver.gtr(left.version, right.version)) {
254
+ return -1;
255
+ }
256
+ return 1;
257
+ }).forEach((versionedEntry, index) => {
258
+ if (index !== 0) {
259
+ // Mark as not accepted to prevent deployment of all but the winner.
260
+ versionedEntry.plugin?.accept();
261
+ }
262
+ });
263
+ }
264
+
220
265
  /**
221
266
  * deploy all plugins that have been accepted
222
267
  */
@@ -39,6 +39,7 @@ import { PluginCliContribution } from './plugin-cli-contribution';
39
39
  import { PluginTheiaEnvironment } from '../common/plugin-theia-environment';
40
40
  import { PluginTheiaDeployerParticipant } from './plugin-theia-deployer-participant';
41
41
  import { WebviewBackendSecurityWarnings } from './webview-backend-security-warnings';
42
+ import { PluginUninstallationManager } from './plugin-uninstallation-manager';
42
43
 
43
44
  export function bindMainBackend(bind: interfaces.Bind): void {
44
45
  bind(PluginApiContribution).toSelf().inSingletonScope();
@@ -50,6 +51,8 @@ export function bindMainBackend(bind: interfaces.Bind): void {
50
51
  bind(PluginDeployerContribution).toSelf().inSingletonScope();
51
52
  bind(BackendApplicationContribution).toService(PluginDeployerContribution);
52
53
 
54
+ bind(PluginUninstallationManager).toSelf().inSingletonScope();
55
+
53
56
  bind(PluginDeployerResolver).to(LocalDirectoryPluginDeployerResolver).inSingletonScope();
54
57
  bind(PluginDeployerResolver).to(LocalFilePluginDeployerResolver).inSingletonScope();
55
58
  bind(PluginDeployerResolver).to(GithubPluginDeployerResolver).inSingletonScope();
@@ -18,7 +18,7 @@ import { injectable, inject } from '@theia/core/shared/inversify';
18
18
  import { CancellationToken } from '@theia/core/lib/common/cancellation';
19
19
  import { PluginDeployerImpl } from './plugin-deployer-impl';
20
20
  import { PluginsKeyValueStorage } from './plugins-key-value-storage';
21
- import { PluginServer, PluginDeployer, PluginStorageKind, PluginType, UnresolvedPluginEntry } from '../../common/plugin-protocol';
21
+ import { PluginServer, PluginDeployer, PluginStorageKind, PluginType, UnresolvedPluginEntry, PluginIdentifiers } from '../../common/plugin-protocol';
22
22
  import { KeysToAnyValues, KeysToKeysToAnyValue } from '../../common/types';
23
23
 
24
24
  @injectable()
@@ -42,7 +42,11 @@ export class PluginServerHandler implements PluginServer {
42
42
  return this.pluginDeployer.deploy(pluginEntry);
43
43
  }
44
44
 
45
- undeploy(pluginId: string): Promise<void> {
45
+ uninstall(pluginId: PluginIdentifiers.VersionedId): Promise<void> {
46
+ return this.pluginDeployer.uninstall(pluginId);
47
+ }
48
+
49
+ undeploy(pluginId: PluginIdentifiers.VersionedId): Promise<void> {
46
50
  return this.pluginDeployer.undeploy(pluginId);
47
51
  }
48
52
 
@@ -0,0 +1,60 @@
1
+ // *****************************************************************************
2
+ // Copyright (C) 2022 Ericsson and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { Emitter, Event } from '@theia/core';
18
+ import { injectable } from '@theia/core/shared/inversify';
19
+ import { PluginIdentifiers } from '../../common';
20
+
21
+ @injectable()
22
+ export class PluginUninstallationManager {
23
+ protected readonly onDidChangeUninstalledPluginsEmitter = new Emitter<readonly PluginIdentifiers.VersionedId[]>();
24
+
25
+ get onDidChangeUninstalledPlugins(): Event<readonly PluginIdentifiers.VersionedId[]> {
26
+ return this.onDidChangeUninstalledPluginsEmitter.event;
27
+ }
28
+
29
+ protected uninstalledPlugins: PluginIdentifiers.VersionedId[] = [];
30
+
31
+ markAsUninstalled(pluginId: PluginIdentifiers.VersionedId): boolean {
32
+ if (!this.uninstalledPlugins.includes(pluginId)) {
33
+ this.uninstalledPlugins.push(pluginId);
34
+ this.onDidChangeUninstalledPluginsEmitter.fire(Object.freeze(this.uninstalledPlugins.slice()));
35
+ return true;
36
+ }
37
+ return false;
38
+ }
39
+
40
+ markAsInstalled(pluginId: PluginIdentifiers.VersionedId): boolean {
41
+ let index: number;
42
+ let didChange = false;
43
+ while ((index = this.uninstalledPlugins.indexOf(pluginId)) !== -1) {
44
+ this.uninstalledPlugins.splice(index, 1);
45
+ didChange = true;
46
+ }
47
+ if (didChange) {
48
+ this.onDidChangeUninstalledPluginsEmitter.fire(Object.freeze(this.uninstalledPlugins.slice()));
49
+ }
50
+ return didChange;
51
+ }
52
+
53
+ isUninstalled(pluginId: PluginIdentifiers.VersionedId): boolean {
54
+ return this.uninstalledPlugins.includes(pluginId);
55
+ }
56
+
57
+ getUninstalledPluginIds(): readonly PluginIdentifiers.VersionedId[] {
58
+ return Object.freeze(this.uninstalledPlugins.slice());
59
+ }
60
+ }
@@ -29,7 +29,6 @@ import { WebviewImpl, WebviewsExtImpl } from './webviews';
29
29
  import { CancellationToken, CancellationTokenSource } from '@theia/core/lib/common/cancellation';
30
30
  import { DisposableCollection } from '@theia/core/lib/common/disposable';
31
31
  import { WorkspaceExtImpl } from './workspace';
32
- import { WidgetOpenerOptions } from '@theia/core/lib/browser';
33
32
 
34
33
  export class CustomEditorsExtImpl implements CustomEditorsExt {
35
34
  private readonly proxy: CustomEditorsMain;
@@ -116,12 +115,12 @@ export class CustomEditorsExtImpl implements CustomEditorsExt {
116
115
  document.dispose();
117
116
  }
118
117
 
119
- async $resolveWebviewEditor(
118
+ async $resolveWebviewEditor<T>(
120
119
  resource: UriComponents,
121
120
  handler: string,
122
121
  viewType: string,
123
122
  title: string,
124
- widgetOpenerOptions: WidgetOpenerOptions | undefined,
123
+ widgetOpenerOptions: T | undefined,
125
124
  options: theia.WebviewPanelOptions & theia.WebviewOptions,
126
125
  cancellation: CancellationToken
127
126
  ): Promise<void> {
@@ -24,9 +24,10 @@ export function serializeEnterRules(rules?: theia.OnEnterRule[]): SerializedOnEn
24
24
 
25
25
  return rules.map(r =>
26
26
  ({
27
- action: r.action,
28
27
  beforeText: serializeRegExp(r.beforeText),
29
- afterText: serializeRegExp(r.afterText)
28
+ afterText: serializeRegExp(r.afterText),
29
+ previousLineText: serializeRegExp(r.previousLineText),
30
+ action: r.action,
30
31
  } as SerializedOnEnterRule));
31
32
  }
32
33
 
@@ -17,7 +17,7 @@
17
17
  import { DebugAdapterSessionImpl } from '@theia/debug/lib/node/debug-adapter-session';
18
18
  import * as theia from '@theia/plugin';
19
19
  import { DebugAdapter } from '@theia/debug/lib/node/debug-model';
20
- import { Channel } from '@theia/debug/lib/common/debug-service';
20
+ import { DebugChannel } from '@theia/debug/lib/common/debug-service';
21
21
 
22
22
  /* eslint-disable @typescript-eslint/no-explicit-any */
23
23
 
@@ -43,7 +43,7 @@ export class PluginDebugAdapterSession extends DebugAdapterSessionImpl {
43
43
  this.configuration = theiaSession.configuration;
44
44
  }
45
45
 
46
- override async start(channel: Channel): Promise<void> {
46
+ override async start(channel: DebugChannel): Promise<void> {
47
47
  if (this.tracker.onWillStartSession) {
48
48
  this.tracker.onWillStartSession();
49
49
  }
@@ -991,7 +991,6 @@ export function createAPIFactory(
991
991
  TextDocumentSaveReason,
992
992
  CodeAction,
993
993
  TreeItem,
994
- TreeItem2: TreeItem,
995
994
  TreeItemCollapsibleState,
996
995
  SymbolKind,
997
996
  SymbolTag,
@@ -236,11 +236,11 @@ export class TextEditorExt implements theia.TextEditor {
236
236
 
237
237
  // prepare data for serialization
238
238
  const edits: SingleEditOperation[] = editData.edits.map(e =>
239
- ({
240
- range: Converter.fromRange(e.range)!,
241
- text: e.text,
242
- forceMoveMarkers: e.forceMoveMarkers
243
- }));
239
+ ({
240
+ range: Converter.fromRange(e.range)!,
241
+ text: e.text,
242
+ forceMoveMarkers: e.forceMoveMarkers
243
+ }));
244
244
 
245
245
  return this.proxy.$tryApplyEdits(this.id, editData.documentVersionId, edits, {
246
246
  setEndOfLine: editData.setEndOfLine,
@@ -263,6 +263,17 @@ export class TextEditorExt implements theia.TextEditor {
263
263
  return undefined;
264
264
  });
265
265
  }
266
+
267
+ show(column?: theia.ViewColumn): void {
268
+ this.proxy.$tryShowTextDocument(this.document.uri, {
269
+ viewColumn: column,
270
+ preview: true,
271
+ });
272
+ }
273
+
274
+ hide(): void {
275
+ this.proxy.$tryHideEditor(this.id);
276
+ }
266
277
  }
267
278
 
268
279
  export class TextEditorOptionsExt implements theia.TextEditorOptions {
@@ -18,7 +18,7 @@ import { ColorTheme, ColorThemeKind } from './types-impl';
18
18
  import { Emitter, Event } from '@theia/core/lib/common/event';
19
19
  import { ThemingExt } from '../common';
20
20
  import { RPCProtocol } from '../common/rpc-protocol';
21
- import { ThemeType } from '@theia/core/lib/browser/theming';
21
+ import { ThemeType } from '@theia/core/lib/common/theme';
22
22
 
23
23
  /*---------------------------------------------------------------------------------------------
24
24
  * Copyright (c) Microsoft Corporation. All rights reserved.
@@ -17,7 +17,7 @@
17
17
  /* eslint-disable @typescript-eslint/no-explicit-any */
18
18
 
19
19
  import {
20
- TreeDataProvider, TreeView, TreeViewExpansionEvent, TreeItem2, TreeItemLabel,
20
+ TreeDataProvider, TreeView, TreeViewExpansionEvent, TreeItem, TreeItemLabel,
21
21
  TreeViewSelectionChangeEvent, TreeViewVisibilityChangeEvent
22
22
  } from '@theia/plugin';
23
23
  // TODO: extract `@theia/util` for event, disposable, cancellation and common types
@@ -295,16 +295,17 @@ class TreeViewExtImpl<T> implements Disposable {
295
295
  return undefined;
296
296
  }
297
297
 
298
- private getTreeItemLabel(treeItem: TreeItem2): string | undefined {
298
+ private getTreeItemLabel(treeItem: TreeItem): string | undefined {
299
299
  const treeItemLabel: string | TreeItemLabel | undefined = treeItem.label;
300
- if (typeof treeItemLabel === 'object' && typeof treeItemLabel.label === 'string') {
301
- return treeItemLabel.label;
302
- } else {
303
- return treeItem.label;
304
- }
300
+ return typeof treeItemLabel === 'object' ? treeItemLabel.label : treeItemLabel;
301
+ }
302
+
303
+ private getTreeItemLabelHighlights(treeItem: TreeItem): [number, number][] | undefined {
304
+ const treeItemLabel: string | TreeItemLabel | undefined = treeItem.label;
305
+ return typeof treeItemLabel === 'object' ? treeItemLabel.highlights : undefined;
305
306
  }
306
307
 
307
- private getTreeItemIdLabel(treeItem: TreeItem2): string | undefined {
308
+ private getTreeItemIdLabel(treeItem: TreeItem): string | undefined {
308
309
  let idLabel = this.getTreeItemLabel(treeItem);
309
310
  // Use resource URI if label is not set
310
311
  if (idLabel === undefined && treeItem.resourceUri) {
@@ -341,10 +342,11 @@ class TreeViewExtImpl<T> implements Disposable {
341
342
 
342
343
  // Ask data provider for a tree item for the value
343
344
  // Data provider must return theia.TreeItem
344
- const treeItem: TreeItem2 = await this.treeDataProvider.getTreeItem(value);
345
+ const treeItem = await this.treeDataProvider.getTreeItem(value);
345
346
  // Convert theia.TreeItem to the TreeViewItem
346
347
 
347
348
  const label = this.getTreeItemLabel(treeItem);
349
+ const highlights = this.getTreeItemLabelHighlights(treeItem);
348
350
  const idLabel = this.getTreeItemIdLabel(treeItem);
349
351
 
350
352
  // Generate the ID
@@ -366,12 +368,12 @@ class TreeViewExtImpl<T> implements Disposable {
366
368
 
367
369
  let icon;
368
370
  let iconUrl;
369
- let themeIconId;
371
+ let themeIcon;
370
372
  const { iconPath } = treeItem;
371
373
  if (typeof iconPath === 'string' && iconPath.indexOf('fa-') !== -1) {
372
374
  icon = iconPath;
373
375
  } else if (ThemeIcon.is(iconPath)) {
374
- themeIconId = iconPath.id;
376
+ themeIcon = iconPath;
375
377
  } else {
376
378
  iconUrl = PluginIconPath.toUrl(<PluginIconPath | undefined>iconPath, this.plugin);
377
379
  }
@@ -379,9 +381,10 @@ class TreeViewExtImpl<T> implements Disposable {
379
381
  const treeViewItem = {
380
382
  id,
381
383
  label,
384
+ highlights,
382
385
  icon,
383
386
  iconUrl,
384
- themeIconId,
387
+ themeIcon,
385
388
  description: treeItem.description,
386
389
  resourceUri: treeItem.resourceUri,
387
390
  tooltip: treeItem.tooltip,
@@ -732,7 +732,7 @@ export class ThemeIcon {
732
732
 
733
733
  static readonly Folder: ThemeIcon = new ThemeIcon('folder');
734
734
 
735
- private constructor(public id: string) {
735
+ private constructor(public id: string, public color?: ThemeColor) {
736
736
  }
737
737
 
738
738
  }
@@ -1,51 +0,0 @@
1
- export interface IExpression {
2
- [pattern: string]: boolean | SiblingClause | any;
3
- }
4
- export interface IRelativePattern {
5
- base: string;
6
- pattern: string;
7
- pathToRelative(from: string, to: string): string;
8
- }
9
- export declare function getEmptyExpression(): IExpression;
10
- export interface SiblingClause {
11
- when: string;
12
- }
13
- export declare function splitGlobAware(pattern: string, splitChar: string): string[];
14
- export declare type ParsedPattern = (path: string, basename?: string) => boolean;
15
- export declare type ParsedExpression = (path: string, basename?: string, hasSibling?: (name: string) => boolean | Promise<boolean>) => string | Promise<string>;
16
- export interface IGlobOptions {
17
- /**
18
- * Simplify patterns for use as exclusion filters during tree traversal to skip entire subtrees. Cannot be used outside of a tree traversal.
19
- */
20
- trimForExclusions?: boolean;
21
- }
22
- /**
23
- * Simplified glob matching. Supports a subset of glob patterns:
24
- * - * matches anything inside a path segment
25
- * - ? matches 1 character inside a path segment
26
- * - ** matches anything including an empty path segment
27
- * - simple brace expansion ({js,ts} => js or ts)
28
- * - character ranges (using [...])
29
- */
30
- export declare function match(pattern: string | IRelativePattern, path: string): boolean;
31
- export declare function match(expression: IExpression, path: string, hasSibling?: (name: string) => boolean): string;
32
- /**
33
- * Simplified glob matching. Supports a subset of glob patterns:
34
- * - * matches anything inside a path segment
35
- * - ? matches 1 character inside a path segment
36
- * - ** matches anything including an empty path segment
37
- * - simple brace expansion ({js,ts} => js or ts)
38
- * - character ranges (using [...])
39
- */
40
- export declare function parse(pattern: string | IRelativePattern, options?: IGlobOptions): ParsedPattern;
41
- export declare function parse(expression: IExpression, options?: IGlobOptions): ParsedExpression;
42
- export declare function hasSiblingPromiseFn(siblingsFn?: () => Promise<string[]>): ((name: string) => Promise<boolean>) | undefined;
43
- export declare function hasSiblingFn(siblingsFn?: () => string[]): ((name: string) => boolean) | undefined;
44
- export declare function isRelativePattern(obj: any): obj is IRelativePattern;
45
- /**
46
- * Same as `parse`, but the ParsedExpression is guaranteed to return a Promise
47
- */
48
- export declare function parseToAsync(expression: IExpression, options?: IGlobOptions): ParsedExpression;
49
- export declare function getBasenameTerms(patternOrExpression: ParsedPattern | ParsedExpression): string[];
50
- export declare function getPathTerms(patternOrExpression: ParsedPattern | ParsedExpression): string[];
51
- //# sourceMappingURL=glob.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../../../src/main/browser/custom-editors/glob.ts"],"names":[],"mappings":"AA4BA,MAAM,WAAW,WAAW;IAExB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,GAAG,aAAa,GAAG,GAAG,CAAC;CACpD;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAC;CACpD;AAED,wBAAgB,kBAAkB,IAAI,WAAW,CAEhD;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;CAChB;AAsBD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CA+C3E;AA2JD,oBAAY,aAAa,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC;AAIzE,oBAAY,gBAAgB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAA4B;AAEnL,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC/B;AA+KD;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;AACjF,wBAAgB,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAA4B;AAUxI;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;AACjG,wBAAgB,KAAK,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAAC;AA+BzF,wBAAgB,mBAAmB,CAAC,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC,GAAG,SAAS,CAa1H;AAED,wBAAgB,YAAY,CAAC,UAAU,CAAC,EAAE,MAAM,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,SAAS,CAajG;AAWD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,GAAG,GAAG,GAAG,IAAI,gBAAgB,CAInE;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,UAAU,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,gBAAgB,CAO9F;AAED,wBAAgB,gBAAgB,CAAC,mBAAmB,EAAE,aAAa,GAAG,gBAAgB,GAAG,MAAM,EAAE,CAEhG;AAED,wBAAgB,YAAY,CAAC,mBAAmB,EAAE,aAAa,GAAG,gBAAgB,GAAG,MAAM,EAAE,CAE5F"}