@theia/plugin-ext 1.18.0-next.de7b81be → 1.20.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 (258) hide show
  1. package/LICENSE +642 -0
  2. package/README.md +5 -0
  3. package/lib/common/connection.d.ts +1 -2
  4. package/lib/common/connection.d.ts.map +1 -1
  5. package/lib/common/connection.js.map +1 -1
  6. package/lib/common/plugin-api-rpc-model.d.ts +4 -0
  7. package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
  8. package/lib/common/plugin-api-rpc-model.js.map +1 -1
  9. package/lib/common/plugin-api-rpc.d.ts +30 -10
  10. package/lib/common/plugin-api-rpc.d.ts.map +1 -1
  11. package/lib/common/plugin-api-rpc.js +21 -1
  12. package/lib/common/plugin-api-rpc.js.map +1 -1
  13. package/lib/common/plugin-protocol.d.ts +2 -1
  14. package/lib/common/plugin-protocol.d.ts.map +1 -1
  15. package/lib/common/plugin-protocol.js.map +1 -1
  16. package/lib/hosted/browser/hosted-plugin.d.ts +5 -6
  17. package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
  18. package/lib/hosted/browser/hosted-plugin.js +19 -13
  19. package/lib/hosted/browser/hosted-plugin.js.map +1 -1
  20. package/lib/hosted/browser/worker/debug-stub.d.ts.map +1 -1
  21. package/lib/hosted/browser/worker/debug-stub.js +1 -0
  22. package/lib/hosted/browser/worker/debug-stub.js.map +1 -1
  23. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts +1 -1
  24. package/lib/hosted/node/hosted-plugin-deployer-handler.d.ts.map +1 -1
  25. package/lib/hosted/node/hosted-plugin-deployer-handler.js +14 -38
  26. package/lib/hosted/node/hosted-plugin-deployer-handler.js.map +1 -1
  27. package/lib/hosted/node/hosted-plugin-localization-service.d.ts +37 -0
  28. package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -0
  29. package/lib/hosted/node/hosted-plugin-localization-service.js +197 -0
  30. package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -0
  31. package/lib/hosted/node/hosted-plugin-process.d.ts +2 -2
  32. package/lib/hosted/node/hosted-plugin-process.d.ts.map +1 -1
  33. package/lib/hosted/node/hosted-plugin-process.js +5 -7
  34. package/lib/hosted/node/hosted-plugin-process.js.map +1 -1
  35. package/lib/hosted/node/plugin-ext-hosted-backend-module.d.ts.map +1 -1
  36. package/lib/hosted/node/plugin-ext-hosted-backend-module.js +2 -0
  37. package/lib/hosted/node/plugin-ext-hosted-backend-module.js.map +1 -1
  38. package/lib/hosted/node/plugin-manifest-loader.d.ts +1 -1
  39. package/lib/hosted/node/plugin-manifest-loader.d.ts.map +1 -1
  40. package/lib/hosted/node/plugin-manifest-loader.js +4 -52
  41. package/lib/hosted/node/plugin-manifest-loader.js.map +1 -1
  42. package/lib/hosted/node/plugin-service.d.ts +3 -6
  43. package/lib/hosted/node/plugin-service.d.ts.map +1 -1
  44. package/lib/hosted/node/plugin-service.js +7 -40
  45. package/lib/hosted/node/plugin-service.js.map +1 -1
  46. package/lib/hosted/node/scanners/scanner-theia.d.ts +1 -1
  47. package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
  48. package/lib/hosted/node/scanners/scanner-theia.js +2 -1
  49. package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
  50. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.d.ts.map +1 -1
  51. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js +6 -2
  52. package/lib/main/browser/callhierarchy/callhierarchy-type-converters.js.map +1 -1
  53. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts +1 -2
  54. package/lib/main/browser/custom-editors/custom-editor-opener.d.ts.map +1 -1
  55. package/lib/main/browser/custom-editors/custom-editor-opener.js +2 -1
  56. package/lib/main/browser/custom-editors/custom-editor-opener.js.map +1 -1
  57. package/lib/main/browser/custom-editors/custom-editors-main.d.ts.map +1 -1
  58. package/lib/main/browser/custom-editors/custom-editors-main.js +1 -2
  59. package/lib/main/browser/custom-editors/custom-editors-main.js.map +1 -1
  60. package/lib/main/browser/debug/debug-main.js +1 -1
  61. package/lib/main/browser/debug/debug-main.js.map +1 -1
  62. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts +1 -1
  63. package/lib/main/browser/debug/plugin-debug-adapter-contribution.d.ts.map +1 -1
  64. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js +2 -2
  65. package/lib/main/browser/debug/plugin-debug-adapter-contribution.js.map +1 -1
  66. package/lib/main/browser/debug/plugin-debug-service.d.ts +8 -0
  67. package/lib/main/browser/debug/plugin-debug-service.d.ts.map +1 -1
  68. package/lib/main/browser/debug/plugin-debug-service.js +15 -0
  69. package/lib/main/browser/debug/plugin-debug-service.js.map +1 -1
  70. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts +2 -2
  71. package/lib/main/browser/debug/plugin-debug-session-factory.d.ts.map +1 -1
  72. package/lib/main/browser/debug/plugin-debug-session-factory.js.map +1 -1
  73. package/lib/main/browser/dialogs/modal-notification.d.ts +3 -3
  74. package/lib/main/browser/dialogs/modal-notification.d.ts.map +1 -1
  75. package/lib/main/browser/dialogs/modal-notification.js +17 -6
  76. package/lib/main/browser/dialogs/modal-notification.js.map +1 -1
  77. package/lib/main/browser/editors-and-documents-main.d.ts.map +1 -1
  78. package/lib/main/browser/editors-and-documents-main.js +3 -4
  79. package/lib/main/browser/editors-and-documents-main.js.map +1 -1
  80. package/lib/main/browser/languages-main.js +1 -1
  81. package/lib/main/browser/languages-main.js.map +1 -1
  82. package/lib/main/browser/message-registry-main.js +1 -1
  83. package/lib/main/browser/message-registry-main.js.map +1 -1
  84. package/lib/main/browser/quick-open-main.d.ts +1 -1
  85. package/lib/main/browser/quick-open-main.d.ts.map +1 -1
  86. package/lib/main/browser/quick-open-main.js.map +1 -1
  87. package/lib/main/browser/tasks-main.d.ts.map +1 -1
  88. package/lib/main/browser/tasks-main.js +6 -0
  89. package/lib/main/browser/tasks-main.js.map +1 -1
  90. package/lib/main/browser/timeline-main.d.ts.map +1 -1
  91. package/lib/main/browser/timeline-main.js +1 -1
  92. package/lib/main/browser/timeline-main.js.map +1 -1
  93. package/lib/main/browser/view/plugin-view-registry.d.ts +3 -2
  94. package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
  95. package/lib/main/browser/view/plugin-view-registry.js +63 -23
  96. package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
  97. package/lib/main/browser/view/plugin-view-widget.d.ts +2 -0
  98. package/lib/main/browser/view/plugin-view-widget.d.ts.map +1 -1
  99. package/lib/main/browser/view/plugin-view-widget.js +3 -1
  100. package/lib/main/browser/view/plugin-view-widget.js.map +1 -1
  101. package/lib/main/browser/view/tree-view-widget.d.ts +3 -7
  102. package/lib/main/browser/view/tree-view-widget.d.ts.map +1 -1
  103. package/lib/main/browser/view/tree-view-widget.js +26 -39
  104. package/lib/main/browser/view/tree-view-widget.js.map +1 -1
  105. package/lib/main/browser/webview/webview-frontend-security-warnings.d.ts.map +1 -1
  106. package/lib/main/browser/webview/webview-frontend-security-warnings.js +8 -5
  107. package/lib/main/browser/webview/webview-frontend-security-warnings.js.map +1 -1
  108. package/lib/main/browser/webview/webview-preferences.d.ts.map +1 -1
  109. package/lib/main/browser/webview/webview-preferences.js +3 -2
  110. package/lib/main/browser/webview/webview-preferences.js.map +1 -1
  111. package/lib/main/browser/webview/webview.d.ts +1 -1
  112. package/lib/main/browser/webview/webview.d.ts.map +1 -1
  113. package/lib/main/browser/webview/webview.js +1 -1
  114. package/lib/main/browser/webview/webview.js.map +1 -1
  115. package/lib/plugin/comments.d.ts.map +1 -1
  116. package/lib/plugin/comments.js +2 -3
  117. package/lib/plugin/comments.js.map +1 -1
  118. package/lib/plugin/custom-editors.d.ts +1 -2
  119. package/lib/plugin/custom-editors.d.ts.map +1 -1
  120. package/lib/plugin/custom-editors.js +2 -3
  121. package/lib/plugin/custom-editors.js.map +1 -1
  122. package/lib/plugin/decorations.d.ts.map +1 -1
  123. package/lib/plugin/decorations.js +2 -3
  124. package/lib/plugin/decorations.js.map +1 -1
  125. package/lib/plugin/document-data.d.ts.map +1 -1
  126. package/lib/plugin/document-data.js +1 -1
  127. package/lib/plugin/document-data.js.map +1 -1
  128. package/lib/plugin/documents.d.ts.map +1 -1
  129. package/lib/plugin/documents.js +1 -2
  130. package/lib/plugin/documents.js.map +1 -1
  131. package/lib/plugin/file-system-event-service-ext-impl.d.ts.map +1 -1
  132. package/lib/plugin/file-system-event-service-ext-impl.js +2 -3
  133. package/lib/plugin/file-system-event-service-ext-impl.js.map +1 -1
  134. package/lib/plugin/file-system-ext-impl.d.ts.map +1 -1
  135. package/lib/plugin/file-system-ext-impl.js +12 -13
  136. package/lib/plugin/file-system-ext-impl.js.map +1 -1
  137. package/lib/plugin/known-commands.spec.js +1 -2
  138. package/lib/plugin/known-commands.spec.js.map +1 -1
  139. package/lib/plugin/languages/call-hierarchy.d.ts +1 -1
  140. package/lib/plugin/languages/call-hierarchy.d.ts.map +1 -1
  141. package/lib/plugin/languages/call-hierarchy.js +8 -3
  142. package/lib/plugin/languages/call-hierarchy.js.map +1 -1
  143. package/lib/plugin/languages/rename.d.ts +1 -2
  144. package/lib/plugin/languages/rename.d.ts.map +1 -1
  145. package/lib/plugin/languages/rename.js.map +1 -1
  146. package/lib/plugin/languages.d.ts +1 -1
  147. package/lib/plugin/languages.d.ts.map +1 -1
  148. package/lib/plugin/languages.js.map +1 -1
  149. package/lib/plugin/message-registry.d.ts.map +1 -1
  150. package/lib/plugin/message-registry.js +3 -0
  151. package/lib/plugin/message-registry.js.map +1 -1
  152. package/lib/plugin/node/debug/debug.d.ts +4 -3
  153. package/lib/plugin/node/debug/debug.d.ts.map +1 -1
  154. package/lib/plugin/node/debug/debug.js +34 -15
  155. package/lib/plugin/node/debug/debug.js.map +1 -1
  156. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts +3 -3
  157. package/lib/plugin/node/debug/plugin-debug-adapter-session.d.ts.map +1 -1
  158. package/lib/plugin/node/debug/plugin-debug-adapter-session.js.map +1 -1
  159. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts +6 -4
  160. package/lib/plugin/node/debug/plugin-debug-adapter-starter.d.ts.map +1 -1
  161. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js +23 -13
  162. package/lib/plugin/node/debug/plugin-debug-adapter-starter.js.map +1 -1
  163. package/lib/plugin/plugin-context.d.ts.map +1 -1
  164. package/lib/plugin/plugin-context.js +8 -3
  165. package/lib/plugin/plugin-context.js.map +1 -1
  166. package/lib/plugin/plugin-manager.d.ts +2 -0
  167. package/lib/plugin/plugin-manager.d.ts.map +1 -1
  168. package/lib/plugin/plugin-manager.js +24 -3
  169. package/lib/plugin/plugin-manager.js.map +1 -1
  170. package/lib/plugin/plugin-storage.d.ts +4 -0
  171. package/lib/plugin/plugin-storage.d.ts.map +1 -1
  172. package/lib/plugin/plugin-storage.js +6 -1
  173. package/lib/plugin/plugin-storage.js.map +1 -1
  174. package/lib/plugin/preference-registry.spec.js.map +1 -1
  175. package/lib/plugin/quick-open.d.ts +1 -1
  176. package/lib/plugin/quick-open.d.ts.map +1 -1
  177. package/lib/plugin/quick-open.js +11 -6
  178. package/lib/plugin/quick-open.js.map +1 -1
  179. package/lib/plugin/tasks/tasks.d.ts +1 -3
  180. package/lib/plugin/tasks/tasks.d.ts.map +1 -1
  181. package/lib/plugin/tasks/tasks.js +3 -17
  182. package/lib/plugin/tasks/tasks.js.map +1 -1
  183. package/lib/plugin/timeline.d.ts.map +1 -1
  184. package/lib/plugin/timeline.js +1 -2
  185. package/lib/plugin/timeline.js.map +1 -1
  186. package/lib/plugin/type-converters.d.ts.map +1 -1
  187. package/lib/plugin/type-converters.js +12 -10
  188. package/lib/plugin/type-converters.js.map +1 -1
  189. package/lib/plugin/types-impl.d.ts +52 -0
  190. package/lib/plugin/types-impl.d.ts.map +1 -1
  191. package/lib/plugin/types-impl.js +79 -1
  192. package/lib/plugin/types-impl.js.map +1 -1
  193. package/lib/plugin/webviews.d.ts +1 -2
  194. package/lib/plugin/webviews.d.ts.map +1 -1
  195. package/lib/plugin/webviews.js.map +1 -1
  196. package/package.json +31 -27
  197. package/src/common/connection.ts +1 -2
  198. package/src/common/plugin-api-rpc-model.ts +4 -0
  199. package/src/common/plugin-api-rpc.ts +31 -9
  200. package/src/common/plugin-protocol.ts +2 -1
  201. package/src/hosted/browser/hosted-plugin.ts +19 -12
  202. package/src/hosted/browser/worker/debug-stub.ts +1 -0
  203. package/src/hosted/node/hosted-plugin-deployer-handler.ts +13 -40
  204. package/src/hosted/node/hosted-plugin-localization-service.ts +201 -0
  205. package/src/hosted/node/hosted-plugin-process.ts +4 -6
  206. package/src/hosted/node/plugin-ext-hosted-backend-module.ts +2 -0
  207. package/src/hosted/node/plugin-manifest-loader.ts +4 -56
  208. package/src/hosted/node/plugin-service.ts +7 -40
  209. package/src/hosted/node/scanners/scanner-theia.ts +3 -2
  210. package/src/main/browser/callhierarchy/callhierarchy-type-converters.ts +6 -2
  211. package/src/main/browser/custom-editors/custom-editor-opener.tsx +3 -3
  212. package/src/main/browser/custom-editors/custom-editors-main.ts +1 -2
  213. package/src/main/browser/debug/debug-main.ts +1 -1
  214. package/src/main/browser/debug/plugin-debug-adapter-contribution.ts +3 -3
  215. package/src/main/browser/debug/plugin-debug-service.ts +23 -0
  216. package/src/main/browser/debug/plugin-debug-session-factory.ts +3 -3
  217. package/src/main/browser/dialogs/modal-notification.ts +18 -7
  218. package/src/main/browser/dialogs/style/modal-notification.css +17 -2
  219. package/src/main/browser/editors-and-documents-main.ts +1 -2
  220. package/src/main/browser/languages-main.ts +1 -1
  221. package/src/main/browser/message-registry-main.ts +1 -1
  222. package/src/main/browser/quick-open-main.ts +1 -1
  223. package/src/main/browser/style/tree.css +4 -0
  224. package/src/main/browser/tasks-main.ts +7 -0
  225. package/src/main/browser/timeline-main.ts +1 -2
  226. package/src/main/browser/view/plugin-view-registry.ts +67 -25
  227. package/src/main/browser/view/plugin-view-widget.ts +7 -2
  228. package/src/main/browser/view/tree-view-widget.tsx +43 -65
  229. package/src/main/browser/webview/pre/host.js +20 -12
  230. package/src/main/browser/webview/pre/main.js +0 -1
  231. package/src/main/browser/webview/webview-frontend-security-warnings.ts +8 -7
  232. package/src/main/browser/webview/webview-preferences.ts +3 -2
  233. package/src/main/browser/webview/webview.ts +1 -1
  234. package/src/plugin/comments.ts +1 -2
  235. package/src/plugin/custom-editors.ts +2 -4
  236. package/src/plugin/decorations.ts +1 -2
  237. package/src/plugin/document-data.ts +1 -2
  238. package/src/plugin/documents.ts +1 -2
  239. package/src/plugin/file-system-event-service-ext-impl.ts +1 -2
  240. package/src/plugin/file-system-ext-impl.ts +1 -2
  241. package/src/plugin/known-commands.spec.ts +1 -2
  242. package/src/plugin/languages/call-hierarchy.ts +14 -5
  243. package/src/plugin/languages/rename.ts +1 -2
  244. package/src/plugin/languages.ts +3 -1
  245. package/src/plugin/message-registry.ts +3 -1
  246. package/src/plugin/node/debug/debug.ts +40 -19
  247. package/src/plugin/node/debug/plugin-debug-adapter-session.ts +3 -3
  248. package/src/plugin/node/debug/plugin-debug-adapter-starter.ts +24 -14
  249. package/src/plugin/plugin-context.ts +21 -10
  250. package/src/plugin/plugin-manager.ts +26 -4
  251. package/src/plugin/plugin-storage.ts +7 -2
  252. package/src/plugin/preference-registry.spec.ts +1 -2
  253. package/src/plugin/quick-open.ts +14 -10
  254. package/src/plugin/tasks/tasks.ts +4 -18
  255. package/src/plugin/timeline.ts +1 -2
  256. package/src/plugin/type-converters.ts +14 -12
  257. package/src/plugin/types-impl.ts +74 -0
  258. package/src/plugin/webviews.ts +1 -2
@@ -22,6 +22,7 @@ import { PluginLifecycle, PluginModel, PluginMetadata, PluginPackage, IconUrl, P
22
22
  import { QueryParameters } from './env';
23
23
  import { TextEditorCursorStyle } from './editor-options';
24
24
  import {
25
+ ConfigurationTarget,
25
26
  TextEditorLineNumbersStyle,
26
27
  EndOfLine,
27
28
  OverviewRulerLane,
@@ -29,7 +30,6 @@ import {
29
30
  FileOperationOptions
30
31
  } from '../plugin/types-impl';
31
32
  import { UriComponents } from './uri-components';
32
- import { ConfigurationTarget } from '../plugin/types-impl';
33
33
  import {
34
34
  SerializedDocumentFilter,
35
35
  CompletionContext,
@@ -91,7 +91,7 @@ import type {
91
91
  TimelineProviderDescriptor
92
92
  } from '@theia/timeline/lib/common/timeline-model';
93
93
  import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/base-terminal-protocol';
94
- import { ThemeType } from '@theia/core/lib/browser/theming';
94
+ import { ThemeType } from '@theia/core/lib/common/theme';
95
95
  import { Disposable } from '@theia/core/lib/common/disposable';
96
96
  import { PickOptions, QuickInputButtonHandle, QuickPickItem } from '@theia/core/lib/browser';
97
97
 
@@ -382,6 +382,7 @@ export enum MainMessageType {
382
382
  }
383
383
 
384
384
  export interface MainMessageOptions {
385
+ detail?: string;
385
386
  modal?: boolean
386
387
  onCloseActionHandle?: number
387
388
  }
@@ -554,7 +555,7 @@ export interface TransferQuickInputButton extends theia.QuickInputButton {
554
555
  handle?: number;
555
556
  }
556
557
 
557
- export type TransferQuickInput<T extends theia.QuickPickItem> = TransferQuickPick<T> | TransferInputBox;
558
+ export type TransferQuickInput = TransferQuickPick | TransferInputBox;
558
559
 
559
560
  export interface BaseTransferQuickInput {
560
561
  [key: string]: any;
@@ -565,14 +566,14 @@ export interface BaseTransferQuickInput {
565
566
  visible?: boolean;
566
567
  }
567
568
 
568
- export interface TransferQuickPick<T extends theia.QuickPickItem> extends BaseTransferQuickInput {
569
+ export interface TransferQuickPick extends BaseTransferQuickInput {
569
570
  type?: 'quickPick';
570
571
  value?: string;
571
572
  placeholder?: string;
572
573
  buttons?: TransferQuickInputButton[];
573
574
  items?: TransferQuickPickItems[];
574
- activeItems?: ReadonlyArray<T>;
575
- selectedItems?: ReadonlyArray<T>;
575
+ activeItems?: ReadonlyArray<theia.QuickPickItem>;
576
+ selectedItems?: ReadonlyArray<theia.QuickPickItem>;
576
577
  canSelectMany?: boolean;
577
578
  ignoreFocusOut?: boolean;
578
579
  matchOnDescription?: boolean;
@@ -604,7 +605,7 @@ export interface QuickOpenMain {
604
605
  $setItems(instance: number, items: TransferQuickPickItems[]): Promise<any>;
605
606
  $setError(instance: number, error: Error): Promise<void>;
606
607
  $input(options: theia.InputBoxOptions, validateInput: boolean, token: CancellationToken): Promise<string | undefined>;
607
- $createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput<T>): Promise<void>;
608
+ $createOrUpdate<T extends theia.QuickPickItem>(params: TransferQuickInput): Promise<void>;
608
609
  $dispose(id: number): Promise<void>;
609
610
 
610
611
  $hide(): void;
@@ -1457,7 +1458,7 @@ export interface LanguagesExt {
1457
1458
  $provideDocumentSemanticTokens(handle: number, resource: UriComponents, previousResultId: number, token: CancellationToken): Promise<BinaryBuffer | null>;
1458
1459
  $releaseDocumentSemanticTokens(handle: number, semanticColoringResultId: number): void;
1459
1460
  $provideDocumentRangeSemanticTokens(handle: number, resource: UriComponents, range: Range, token: CancellationToken): Promise<BinaryBuffer | null>;
1460
- $provideRootDefinition(handle: number, resource: UriComponents, location: Position, token: CancellationToken): Promise<CallHierarchyDefinition | undefined>;
1461
+ $provideRootDefinition(handle: number, resource: UriComponents, location: Position, token: CancellationToken): Promise<CallHierarchyDefinition | CallHierarchyDefinition[] | undefined>;
1461
1462
  $provideCallers(handle: number, definition: CallHierarchyDefinition, token: CancellationToken): Promise<CallHierarchyReference[] | undefined>;
1462
1463
  $provideCallees(handle: number, definition: CallHierarchyDefinition, token: CancellationToken): Promise<CallHierarchyReference[] | undefined>;
1463
1464
  }
@@ -1594,13 +1595,33 @@ export interface StorageExt {
1594
1595
  $updatePluginsWorkspaceData(data: KeysToKeysToAnyValue): void;
1595
1596
  }
1596
1597
 
1598
+ /**
1599
+ * A DebugConfigurationProviderTriggerKind specifies when the `provideDebugConfigurations` method of a `DebugConfigurationProvider` should be called.
1600
+ * Currently there are two situations:
1601
+ * (1) providing debug configurations to populate a newly created `launch.json`
1602
+ * (2) providing dynamically generated configurations when the user asks for them through the UI (e.g. via the "Select and Start Debugging" command).
1603
+ * A trigger kind is used when registering a `DebugConfigurationProvider` with {@link debug.registerDebugConfigurationProvider}.
1604
+ */
1605
+ export enum DebugConfigurationProviderTriggerKind {
1606
+ /**
1607
+ * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide the initial debug
1608
+ * configurations for a newly created launch.json.
1609
+ */
1610
+ Initial = 1,
1611
+ /**
1612
+ * `DebugConfigurationProvider.provideDebugConfigurations` is called to provide dynamically generated debug configurations when the user asks for them through the UI
1613
+ * (e.g. via the "Select and Start Debugging" command).
1614
+ */
1615
+ Dynamic = 2
1616
+ }
1617
+
1597
1618
  export interface DebugExt {
1598
1619
  $onSessionCustomEvent(sessionId: string, event: string, body?: any): void;
1599
1620
  $breakpointsDidChange(added: Breakpoint[], removed: string[], changed: Breakpoint[]): void;
1600
1621
  $sessionDidCreate(sessionId: string): void;
1601
1622
  $sessionDidDestroy(sessionId: string): void;
1602
1623
  $sessionDidChange(sessionId: string | undefined): void;
1603
- $provideDebugConfigurations(debugType: string, workspaceFolder: string | undefined): Promise<theia.DebugConfiguration[]>;
1624
+ $provideDebugConfigurations(debugType: string, workspaceFolder: string | undefined, dynamic?: boolean): Promise<theia.DebugConfiguration[]>;
1604
1625
  $resolveDebugConfigurations(debugConfiguration: theia.DebugConfiguration, workspaceFolder: string | undefined): Promise<theia.DebugConfiguration | undefined>;
1605
1626
  $resolveDebugConfigurationWithSubstitutedVariables(debugConfiguration: theia.DebugConfiguration, workspaceFolder: string | undefined):
1606
1627
  Promise<theia.DebugConfiguration | undefined>;
@@ -1772,6 +1793,7 @@ export const MAIN_RPC_CONTEXT = {
1772
1793
  };
1773
1794
 
1774
1795
  export interface TasksExt {
1796
+ $initLoadedTasks(executions: TaskExecutionDto[]): Promise<void>;
1775
1797
  $provideTasks(handle: number): Promise<TaskDto[] | undefined>;
1776
1798
  $resolveTask(handle: number, task: TaskDto, token?: CancellationToken): Promise<TaskDto | undefined>;
1777
1799
  $onDidStartTask(execution: TaskExecutionDto, terminalId: number): void;
@@ -23,7 +23,7 @@ import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-sch
23
23
  import { RecursivePartial } from '@theia/core/lib/common/types';
24
24
  import { PreferenceSchema, PreferenceSchemaProperties } from '@theia/core/lib/common/preferences/preference-schema';
25
25
  import { ProblemMatcherContribution, ProblemPatternContribution, TaskDefinition } from '@theia/task/lib/common';
26
- import { ColorDefinition } from '@theia/core/lib/browser/color-registry';
26
+ import { ColorDefinition } from '@theia/core/lib/common/color';
27
27
  import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
28
28
 
29
29
  export const hostedServicePath = '/services/hostedPlugin';
@@ -554,6 +554,7 @@ export interface Localization {
554
554
 
555
555
  export interface Translation {
556
556
  id: string;
557
+ path: string;
557
558
  version: string;
558
559
  contents: { [scope: string]: { [key: string]: string } }
559
560
  }
@@ -25,13 +25,13 @@ import debounce = require('@theia/core/shared/lodash.debounce');
25
25
  import { UUID } from '@theia/core/shared/@phosphor/coreutils';
26
26
  import { injectable, inject, interfaces, named, postConstruct } from '@theia/core/shared/inversify';
27
27
  import { PluginWorker } from './plugin-worker';
28
- import { PluginMetadata, getPluginId, HostedPluginServer, DeployedPlugin } from '../../common/plugin-protocol';
28
+ import { PluginMetadata, getPluginId, HostedPluginServer, DeployedPlugin, PluginServer } from '../../common/plugin-protocol';
29
29
  import { HostedPluginWatcher } from './hosted-plugin-watcher';
30
30
  import { MAIN_RPC_CONTEXT, PluginManagerExt, ConfigStorage, UIKind } from '../../common/plugin-api-rpc';
31
31
  import { setUpPluginApi } from '../../main/browser/main-context';
32
32
  import { RPCProtocol, RPCProtocolImpl } from '../../common/rpc-protocol';
33
33
  import {
34
- Disposable, DisposableCollection,
34
+ Disposable, DisposableCollection, Emitter, isCancelled,
35
35
  ILogger, ContributionProvider, CommandRegistry, WillExecuteCommandEvent,
36
36
  CancellationTokenSource, JsonRpcProxy, ProgressService
37
37
  } from '@theia/core';
@@ -42,13 +42,11 @@ import { getQueryParameters } from '../../main/browser/env-main';
42
42
  import { MainPluginApiProvider } from '../../common/plugin-ext-api-contribution';
43
43
  import { PluginPathsService } from '../../main/common/plugin-paths-protocol';
44
44
  import { getPreferences } from '../../main/browser/preference-registry-main';
45
- import { PluginServer } from '../../common/plugin-protocol';
46
45
  import { Deferred } from '@theia/core/lib/common/promise-util';
47
46
  import { DebugSessionManager } from '@theia/debug/lib/browser/debug-session-manager';
48
47
  import { DebugConfigurationManager } from '@theia/debug/lib/browser/debug-configuration-manager';
49
48
  import { WaitUntilEvent } from '@theia/core/lib/common/event';
50
49
  import { FileSearchService } from '@theia/file-search/lib/common/file-search-service';
51
- import { Emitter, isCancelled } from '@theia/core';
52
50
  import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
53
51
  import { PluginViewRegistry } from '../../main/browser/view/plugin-view-registry';
54
52
  import { TaskProviderRegistry, TaskResolverRegistry } from '@theia/task/lib/browser/task-contribution';
@@ -66,7 +64,7 @@ import { PluginCustomEditorRegistry } from '../../main/browser/custom-editors/pl
66
64
  import { CustomEditorWidget } from '../../main/browser/custom-editors/custom-editor-widget';
67
65
 
68
66
  export type PluginHost = 'frontend' | string;
69
- export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker';
67
+ export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker' | 'onDebugDynamicConfigurations';
70
68
 
71
69
  export const PluginProgressLocation = 'plugin';
72
70
 
@@ -198,6 +196,8 @@ export class HostedPluginSupport {
198
196
  this.debugSessionManager.onWillStartDebugSession(event => this.ensureDebugActivation(event));
199
197
  this.debugSessionManager.onWillResolveDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugResolve', event.debugType));
200
198
  this.debugConfigurationManager.onWillProvideDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugInitialConfigurations'));
199
+ // Activate all providers of dynamic configurations, i.e. Let the user pick a configuration from all the available ones.
200
+ this.debugConfigurationManager.onWillProvideDynamicDebugConfiguration(event => this.ensureDebugActivation(event, 'onDebugDynamicConfigurations', '*'));
201
201
  this.viewRegistry.onDidExpandView(id => this.activateByView(id));
202
202
  this.taskProviderRegistry.onWillProvideTaskProvider(event => this.ensureTaskActivation(event));
203
203
  this.taskResolverRegistry.onWillProvideTaskResolver(event => this.ensureTaskActivation(event));
@@ -302,12 +302,15 @@ export class HostedPluginSupport {
302
302
  */
303
303
  protected async syncPlugins(): Promise<void> {
304
304
  let initialized = 0;
305
- const syncPluginsMeasurement = this.createMeasurement('syncPlugins');
305
+ const waitPluginsMeasurement = this.createMeasurement('waitForDeployment');
306
+ let syncPluginsMeasurement: () => number;
306
307
 
307
308
  const toUnload = new Set(this.contributions.keys());
308
309
  try {
309
310
  const pluginIds: string[] = [];
310
311
  const deployedPluginIds = await this.server.getDeployedPluginIds();
312
+ this.logMeasurement('Waiting for backend deployment', waitPluginsMeasurement);
313
+ syncPluginsMeasurement = this.createMeasurement('syncPlugins');
311
314
  for (const pluginId of deployedPluginIds) {
312
315
  toUnload.delete(pluginId);
313
316
  if (!this.contributions.has(pluginId)) {
@@ -336,7 +339,7 @@ export class HostedPluginSupport {
336
339
  }
337
340
  }
338
341
 
339
- this.logMeasurement('Sync', initialized, syncPluginsMeasurement);
342
+ this.logMeasurement(`Sync of ${this.getPluginCount(initialized)}`, syncPluginsMeasurement);
340
343
  }
341
344
 
342
345
  /**
@@ -374,7 +377,7 @@ export class HostedPluginSupport {
374
377
  }
375
378
  }
376
379
 
377
- this.logMeasurement('Load contributions', loaded, loadPluginsMeasurement);
380
+ this.logMeasurement(`Load contributions of ${this.getPluginCount(loaded)}`, loadPluginsMeasurement);
378
381
 
379
382
  return hostContributions;
380
383
  }
@@ -444,7 +447,7 @@ export class HostedPluginSupport {
444
447
  return;
445
448
  }
446
449
 
447
- this.logMeasurement('Start', started, startPluginsMeasurement);
450
+ this.logMeasurement(`Start of ${this.getPluginCount(started)}`, startPluginsMeasurement);
448
451
  }
449
452
 
450
453
  protected async obtainManager(host: string, hostContributions: PluginContributions[], toDisconnect: DisposableCollection): Promise<PluginManagerExt | undefined> {
@@ -712,15 +715,19 @@ export class HostedPluginSupport {
712
715
  };
713
716
  }
714
717
 
715
- protected logMeasurement(prefix: string, count: number, measurement: () => number): void {
718
+ protected logMeasurement(measurementName: string, measurement: () => number): void {
716
719
  const duration = measurement();
717
720
  if (duration === Number.NaN) {
718
721
  // Measurement was prevented by native API, do not log NaN duration
719
722
  return;
720
723
  }
721
724
 
722
- const pluginCount = `${count} plugin${count === 1 ? '' : 's'}`;
723
- console.log(`[${this.clientId}] ${prefix} of ${pluginCount} took: ${duration.toFixed(1)} ms`);
725
+ const timeFromFrontendStart = `Finished ${(performance.now() / 1000).toFixed(3)} s after frontend start`;
726
+ console.log(`[${this.clientId}] ${measurementName} took: ${duration.toFixed(1)} ms [${timeFromFrontendStart}]`);
727
+ }
728
+
729
+ protected getPluginCount(plugins: number): string {
730
+ return `${plugins} plugin${plugins === 1 ? '' : 's'}`;
724
731
  }
725
732
 
726
733
  protected readonly webviewsToRestore = new Set<WebviewWidget>();
@@ -14,6 +14,7 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
+ // eslint-disable-next-line @theia/runtime-import-check
17
18
  import { DebugExtImpl } from '../../../plugin/node/debug/debug';
18
19
  import { RPCProtocol } from '../../../common/rpc-protocol';
19
20
 
@@ -17,11 +17,11 @@
17
17
  import * as fs from '@theia/core/shared/fs-extra';
18
18
  import { injectable, inject } from '@theia/core/shared/inversify';
19
19
  import { ILogger } from '@theia/core';
20
- import { PluginDeployerHandler, PluginDeployerEntry, PluginEntryPoint, DeployedPlugin, PluginDependencies, Localization } from '../../common/plugin-protocol';
20
+ import { PluginDeployerHandler, PluginDeployerEntry, PluginEntryPoint, DeployedPlugin, PluginDependencies, PluginType } from '../../common/plugin-protocol';
21
21
  import { HostedPluginReader } from './plugin-reader';
22
22
  import { Deferred } from '@theia/core/lib/common/promise-util';
23
- import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
24
- import { Localization as TheiaLocalization } from '@theia/core/lib/common/i18n/localization';
23
+ import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
24
+ import { BackendApplicationConfigProvider } from '@theia/core/lib/node/backend-application-config-provider';
25
25
 
26
26
  @injectable()
27
27
  export class HostedPluginDeployerHandler implements PluginDeployerHandler {
@@ -32,8 +32,8 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
32
32
  @inject(HostedPluginReader)
33
33
  private readonly reader: HostedPluginReader;
34
34
 
35
- @inject(LocalizationProvider)
36
- private readonly localizationProvider: LocalizationProvider;
35
+ @inject(HostedPluginLocalizationService)
36
+ private readonly localizationService: HostedPluginLocalizationService;
37
37
 
38
38
  private readonly deployedLocations = new Map<string, Set<string>>();
39
39
 
@@ -85,7 +85,11 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
85
85
  }
86
86
  const metadata = this.reader.readMetadata(manifest);
87
87
  const dependencies: PluginDependencies = { metadata };
88
- dependencies.mapping = this.reader.readDependencies(manifest);
88
+ // Do not resolve system (aka builtin) plugins because it should be done statically at build time.
89
+ const { resolveSystemPlugins = true } = BackendApplicationConfigProvider.get();
90
+ if (resolveSystemPlugins || entry.type !== PluginType.System) {
91
+ dependencies.mapping = this.reader.readDependencies(manifest);
92
+ }
89
93
  return dependencies;
90
94
  } catch (e) {
91
95
  console.error(`Failed to load plugin dependencies from '${pluginPath}' path`, e);
@@ -105,6 +109,8 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
105
109
  for (const plugin of backendPlugins) {
106
110
  await this.deployPlugin(plugin, 'backend');
107
111
  }
112
+ // rebuild translation config after deployment
113
+ this.localizationService.buildTranslationConfig([...this.deployedBackendPlugins.values()]);
108
114
  // resolve on first deploy
109
115
  this.backendPluginsMetadataDeferred.resolve(undefined);
110
116
  }
@@ -134,9 +140,7 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
134
140
  const { type } = entry;
135
141
  const deployed: DeployedPlugin = { metadata, type };
136
142
  deployed.contributes = this.reader.readContribution(manifest);
137
- if (deployed.contributes?.localizations) {
138
- this.localizationProvider.addLocalizations(...buildTheiaLocalizations(deployed.contributes.localizations));
139
- }
143
+ this.localizationService.deployLocalizations(deployed);
140
144
  deployedPlugins.set(metadata.model.id, deployed);
141
145
  this.logger.info(`Deploying ${entryPoint} plugin "${metadata.model.name}@${metadata.model.version}" from "${metadata.model.entryPoint[entryPoint] || pluginPath}"`);
142
146
  } catch (e) {
@@ -162,34 +166,3 @@ export class HostedPluginDeployerHandler implements PluginDeployerHandler {
162
166
  return true;
163
167
  }
164
168
  }
165
-
166
- function buildTheiaLocalizations(localizations: Localization[]): TheiaLocalization[] {
167
- const theiaLocalizations: TheiaLocalization[] = [];
168
- for (const localization of localizations) {
169
- const theiaLocalization: TheiaLocalization = {
170
- languageId: localization.languageId,
171
- languageName: localization.languageName,
172
- localizedLanguageName: localization.localizedLanguageName,
173
- languagePack: true,
174
- translations: {}
175
- };
176
- for (const translation of localization.translations) {
177
- for (const [scope, value] of Object.entries(translation.contents)) {
178
- for (const [key, item] of Object.entries(value)) {
179
- const translationKey = buildTheiaTranslationKey(translation.id, scope, key);
180
- theiaLocalization.translations[translationKey] = item;
181
- }
182
- }
183
- }
184
- theiaLocalizations.push(theiaLocalization);
185
- }
186
- return theiaLocalizations;
187
- }
188
-
189
- function buildTheiaTranslationKey(pluginId: string, scope: string, key: string): string {
190
- const scopeSlashIndex = scope.lastIndexOf('/');
191
- if (scopeSlashIndex >= 0) {
192
- scope = scope.substring(scopeSlashIndex + 1);
193
- }
194
- return `${pluginId}/${scope}/${key}`;
195
- }
@@ -0,0 +1,201 @@
1
+ /********************************************************************************
2
+ * Copyright (C) 2021 TypeFox 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 * as path from 'path';
18
+ import * as fs from '@theia/core/shared/fs-extra';
19
+ import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
20
+ import { Localization } from '@theia/core/lib/common/i18n/localization';
21
+ import { inject, injectable } from '@theia/core/shared/inversify';
22
+ import { DeployedPlugin, Localization as PluginLocalization, PluginContribution } from '../../common';
23
+ import { URI } from '@theia/core/shared/vscode-uri';
24
+ import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
25
+
26
+ export interface VSCodeNlsConfig {
27
+ locale: string
28
+ availableLanguages: Record<string, string>
29
+ _languagePackSupport?: boolean
30
+ _languagePackId?: string
31
+ _translationsConfigFile?: string
32
+ _cacheRoot?: string
33
+ _corruptedFile?: string
34
+ }
35
+
36
+ @injectable()
37
+ export class HostedPluginLocalizationService {
38
+
39
+ @inject(LocalizationProvider)
40
+ protected readonly localizationProvider: LocalizationProvider;
41
+
42
+ @inject(EnvVariablesServer)
43
+ protected readonly envVariables: EnvVariablesServer;
44
+
45
+ protected translationConfigFiles: Map<string, string> = new Map();
46
+
47
+ deployLocalizations(plugin: DeployedPlugin): void {
48
+ if (plugin.contributes?.localizations) {
49
+ this.localizationProvider.addLocalizations(...buildLocalizations(plugin.contributes.localizations));
50
+ }
51
+ }
52
+
53
+ async localizePlugin(plugin: DeployedPlugin): Promise<DeployedPlugin> {
54
+ const currentLanguage = this.localizationProvider.getCurrentLanguage();
55
+ const localization = this.localizationProvider.loadLocalization(currentLanguage);
56
+ const pluginPath = URI.parse(plugin.metadata.model.packageUri).fsPath;
57
+ const pluginId = plugin.metadata.model.id;
58
+ // create a shallow copy to not override the original plugin's contributes property.
59
+ const shallowCopy = { ...plugin };
60
+ try {
61
+ const translations = await loadPackageTranslations(pluginPath, currentLanguage);
62
+ shallowCopy.contributes = localizePackage(shallowCopy.contributes, translations, (key, original) => {
63
+ const fullKey = `${pluginId}/package/${key}`;
64
+ return Localization.localize(localization, fullKey, original);
65
+ }) as PluginContribution;
66
+ } catch (err) {
67
+ console.error(`Failed to localize plugin '${pluginId}'.`, err);
68
+ }
69
+ return shallowCopy;
70
+ }
71
+
72
+ getNlsConfig(): VSCodeNlsConfig {
73
+ const locale = this.localizationProvider.getCurrentLanguage();
74
+ const configFile = this.translationConfigFiles.get(locale);
75
+ if (locale === 'en' || !configFile) {
76
+ return { locale, availableLanguages: {} };
77
+ }
78
+ const cache = path.dirname(configFile);
79
+ return {
80
+ locale,
81
+ availableLanguages: { '*': locale },
82
+ _languagePackSupport: true,
83
+ _cacheRoot: cache,
84
+ _languagePackId: locale,
85
+ _translationsConfigFile: configFile
86
+ };
87
+ }
88
+
89
+ async buildTranslationConfig(plugins: DeployedPlugin[]): Promise<void> {
90
+ const configDir = URI.parse(await this.envVariables.getConfigDirUri()).fsPath;
91
+ const cacheDir = path.join(configDir, 'localization-cache');
92
+ const configs = new Map<string, Record<string, string>>();
93
+ for (const plugin of plugins) {
94
+ if (plugin.contributes?.localizations) {
95
+ const pluginPath = URI.parse(plugin.metadata.model.packageUri).fsPath;
96
+ for (const localization of plugin.contributes.localizations) {
97
+ const config = configs.get(localization.languageId) || {};
98
+ for (const translation of localization.translations) {
99
+ const fullPath = path.join(pluginPath, translation.path);
100
+ config[translation.id] = fullPath;
101
+ }
102
+ configs.set(localization.languageId, config);
103
+ }
104
+ }
105
+ }
106
+
107
+ for (const [language, config] of configs.entries()) {
108
+ const languageConfigDir = path.join(cacheDir, language);
109
+ await fs.mkdirs(languageConfigDir);
110
+ const configFile = path.join(languageConfigDir, `nls.config.${language}.json`);
111
+ this.translationConfigFiles.set(language, configFile);
112
+ await fs.writeJson(configFile, config);
113
+ }
114
+ }
115
+ }
116
+
117
+ function buildLocalizations(localizations: PluginLocalization[]): Localization[] {
118
+ const theiaLocalizations: Localization[] = [];
119
+ for (const localization of localizations) {
120
+ const theiaLocalization: Localization = {
121
+ languageId: localization.languageId,
122
+ languageName: localization.languageName,
123
+ localizedLanguageName: localization.localizedLanguageName,
124
+ languagePack: true,
125
+ translations: {}
126
+ };
127
+ for (const translation of localization.translations) {
128
+ for (const [scope, value] of Object.entries(translation.contents)) {
129
+ for (const [key, item] of Object.entries(value)) {
130
+ const translationKey = buildTranslationKey(translation.id, scope, key);
131
+ theiaLocalization.translations[translationKey] = item;
132
+ }
133
+ }
134
+ }
135
+ theiaLocalizations.push(theiaLocalization);
136
+ }
137
+ return theiaLocalizations;
138
+ }
139
+
140
+ function buildTranslationKey(pluginId: string, scope: string, key: string): string {
141
+ return `${pluginId}/${Localization.transformKey(scope)}/${key}`;
142
+ }
143
+
144
+ interface PackageTranslation {
145
+ translation?: Record<string, string>
146
+ default?: Record<string, string>
147
+ }
148
+
149
+ async function loadPackageTranslations(pluginPath: string, locale: string): Promise<PackageTranslation> {
150
+ const localizedPluginPath = path.join(pluginPath, `package.nls.${locale}.json`);
151
+ try {
152
+ const defaultValue = await fs.readJson(path.join(pluginPath, 'package.nls.json'));
153
+ if (await fs.pathExists(localizedPluginPath)) {
154
+ return {
155
+ translation: await fs.readJson(localizedPluginPath),
156
+ default: defaultValue
157
+ };
158
+ }
159
+ return {
160
+ default: defaultValue
161
+ };
162
+ } catch (e) {
163
+ if (e.code !== 'ENOENT') {
164
+ throw e;
165
+ }
166
+ return {};
167
+ }
168
+ }
169
+
170
+ const NLS_REGEX = /^%([\w\d.-]+)%$/i;
171
+
172
+ function localizePackage(value: unknown, translations: PackageTranslation, callback: (key: string, defaultValue: string) => string): unknown {
173
+ if (typeof value === 'string') {
174
+ const match = NLS_REGEX.exec(value);
175
+ let result = value;
176
+ if (match) {
177
+ const key = match[1];
178
+ if (translations.translation) {
179
+ result = translations.translation[key];
180
+ } else if (translations.default) {
181
+ result = callback(key, translations.default[key]);
182
+ }
183
+ }
184
+ return result;
185
+ }
186
+ if (Array.isArray(value)) {
187
+ const result = [];
188
+ for (const item of value) {
189
+ result.push(localizePackage(item, translations, callback));
190
+ }
191
+ return result;
192
+ }
193
+ if (typeof value === 'object' && value) {
194
+ const result: Record<string, unknown> = {};
195
+ for (const [name, item] of Object.entries(value)) {
196
+ result[name] = localizePackage(item, translations, callback);
197
+ }
198
+ return result;
199
+ }
200
+ return value;
201
+ }
@@ -23,7 +23,7 @@ import { MessageType } from '../../common/rpc-protocol';
23
23
  import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
24
24
  import * as psTree from 'ps-tree';
25
25
  import { Deferred } from '@theia/core/lib/common/promise-util';
26
- import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
26
+ import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
27
27
 
28
28
  export interface IPCConnectionOptions {
29
29
  readonly serverName: string;
@@ -56,8 +56,8 @@ export class HostedPluginProcess implements ServerPluginRunner {
56
56
  @inject(MessageService)
57
57
  protected readonly messageService: MessageService;
58
58
 
59
- @inject(LocalizationProvider)
60
- protected readonly localizationProvider: LocalizationProvider;
59
+ @inject(HostedPluginLocalizationService)
60
+ protected readonly localizationService: HostedPluginLocalizationService;
61
61
 
62
62
  private childProcess: cp.ChildProcess | undefined;
63
63
  private client: HostedPluginClient;
@@ -173,9 +173,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
173
173
  delete env[key];
174
174
  }
175
175
  }
176
- const availableLanguages = ['en', ...this.localizationProvider.getAvailableLanguages()];
177
- const locale = this.localizationProvider.getCurrentLanguage();
178
- env['VSCODE_NLS_CONFIG'] = JSON.stringify({ locale, availableLanguages });
176
+ env['VSCODE_NLS_CONFIG'] = JSON.stringify(this.localizationService.getNlsConfig());
179
177
  // apply external env variables
180
178
  this.pluginHostEnvironmentVariables.getContributions().forEach(envVar => envVar.process(env));
181
179
  if (this.cli.extensionTestsPath) {
@@ -33,6 +33,7 @@ import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
33
33
  import { HostedPluginDeployerHandler } from './hosted-plugin-deployer-handler';
34
34
  import { PluginUriFactory } from './scanners/plugin-uri-factory';
35
35
  import { FilePluginUriFactory } from './scanners/file-plugin-uri-factory';
36
+ import { HostedPluginLocalizationService } from './hosted-plugin-localization-service';
36
37
 
37
38
  const commonHostedConnectionModule = ConnectionContainerModule.create(({ bind, bindBackendService }) => {
38
39
  bind(HostedPluginProcess).toSelf().inSingletonScope();
@@ -58,6 +59,7 @@ export function bindCommonHostedBackend(bind: interfaces.Bind): void {
58
59
  bind(HostedPluginReader).toSelf().inSingletonScope();
59
60
  bind(BackendApplicationContribution).toService(HostedPluginReader);
60
61
 
62
+ bind(HostedPluginLocalizationService).toSelf().inSingletonScope();
61
63
  bind(HostedPluginDeployerHandler).toSelf().inSingletonScope();
62
64
  bind(PluginDeployerHandler).toService(HostedPluginDeployerHandler);
63
65