@theia/plugin-ext 1.42.0 → 1.43.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.
- package/lib/common/arrays.d.ts +4 -0
- package/lib/common/arrays.d.ts.map +1 -1
- package/lib/common/arrays.js +15 -1
- package/lib/common/arrays.js.map +1 -1
- package/lib/common/commands.d.ts +4 -0
- package/lib/common/commands.d.ts.map +1 -0
- package/lib/common/commands.js +17 -0
- package/lib/common/commands.js.map +1 -0
- package/lib/common/plugin-api-rpc-model.d.ts +1 -0
- package/lib/common/plugin-api-rpc-model.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc-model.js.map +1 -1
- package/lib/common/plugin-api-rpc.d.ts +48 -6
- package/lib/common/plugin-api-rpc.d.ts.map +1 -1
- package/lib/common/plugin-api-rpc.js +3 -2
- package/lib/common/plugin-api-rpc.js.map +1 -1
- package/lib/common/plugin-protocol.d.ts +27 -3
- package/lib/common/plugin-protocol.d.ts.map +1 -1
- package/lib/common/plugin-protocol.js +8 -1
- package/lib/common/plugin-protocol.js.map +1 -1
- package/lib/common/test-types.d.ts +83 -0
- package/lib/common/test-types.d.ts.map +1 -0
- package/lib/common/test-types.js +40 -0
- package/lib/common/test-types.js.map +1 -0
- package/lib/hosted/browser/hosted-plugin.d.ts +4 -1
- package/lib/hosted/browser/hosted-plugin.d.ts.map +1 -1
- package/lib/hosted/browser/hosted-plugin.js +11 -0
- package/lib/hosted/browser/hosted-plugin.js.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.d.ts.map +1 -1
- package/lib/hosted/node/hosted-plugin-localization-service.js +71 -33
- package/lib/hosted/node/hosted-plugin-localization-service.js.map +1 -1
- package/lib/hosted/node/plugin-reader.d.ts.map +1 -1
- package/lib/hosted/node/plugin-reader.js +4 -2
- package/lib/hosted/node/plugin-reader.js.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.d.ts +5 -4
- package/lib/hosted/node/scanners/scanner-theia.d.ts.map +1 -1
- package/lib/hosted/node/scanners/scanner-theia.js +79 -19
- package/lib/hosted/node/scanners/scanner-theia.js.map +1 -1
- package/lib/main/browser/command-registry-main.d.ts +3 -0
- package/lib/main/browser/command-registry-main.d.ts.map +1 -1
- package/lib/main/browser/command-registry-main.js +11 -1
- package/lib/main/browser/command-registry-main.js.map +1 -1
- package/lib/main/browser/languages-main.d.ts.map +1 -1
- package/lib/main/browser/languages-main.js +7 -5
- package/lib/main/browser/languages-main.js.map +1 -1
- package/lib/main/browser/main-context.d.ts.map +1 -1
- package/lib/main/browser/main-context.js +3 -0
- package/lib/main/browser/main-context.js.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts +2 -2
- package/lib/main/browser/menus/vscode-theia-menu-mappings.d.ts.map +1 -1
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js +3 -0
- package/lib/main/browser/menus/vscode-theia-menu-mappings.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js +2 -2
- package/lib/main/browser/notebooks/notebook-documents-and-editors-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-documents-main.js +1 -1
- package/lib/main/browser/notebooks/notebook-documents-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-dto.js +2 -2
- package/lib/main/browser/notebooks/notebook-dto.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-kernels-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebook-kernels-main.js +4 -10
- package/lib/main/browser/notebooks/notebook-kernels-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebook-renderers-main.js +1 -1
- package/lib/main/browser/notebooks/notebook-renderers-main.js.map +1 -1
- package/lib/main/browser/notebooks/notebooks-main.d.ts +2 -2
- package/lib/main/browser/notebooks/notebooks-main.d.ts.map +1 -1
- package/lib/main/browser/notebooks/notebooks-main.js +5 -5
- package/lib/main/browser/notebooks/notebooks-main.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js +3 -0
- package/lib/main/browser/notebooks/renderers/cell-output-webview.js.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.d.ts.map +1 -1
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js +4 -2
- package/lib/main/browser/notebooks/renderers/output-webview-internal.js.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.d.ts +2 -0
- package/lib/main/browser/plugin-contribution-handler.d.ts.map +1 -1
- package/lib/main/browser/plugin-contribution-handler.js +19 -1
- package/lib/main/browser/plugin-contribution-handler.js.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.d.ts.map +1 -1
- package/lib/main/browser/plugin-ext-frontend-module.js +3 -0
- package/lib/main/browser/plugin-ext-frontend-module.js.map +1 -1
- package/lib/main/browser/plugin-icon-service.d.ts +20 -0
- package/lib/main/browser/plugin-icon-service.d.ts.map +1 -0
- package/lib/main/browser/plugin-icon-service.js +156 -0
- package/lib/main/browser/plugin-icon-service.js.map +1 -0
- package/lib/main/browser/terminal-main.d.ts +2 -2
- package/lib/main/browser/terminal-main.d.ts.map +1 -1
- package/lib/main/browser/terminal-main.js +5 -9
- package/lib/main/browser/terminal-main.js.map +1 -1
- package/lib/main/browser/test-main.d.ts +141 -0
- package/lib/main/browser/test-main.d.ts.map +1 -0
- package/lib/main/browser/test-main.js +560 -0
- package/lib/main/browser/test-main.js.map +1 -0
- package/lib/main/browser/view/plugin-view-registry.d.ts +14 -3
- package/lib/main/browser/view/plugin-view-registry.d.ts.map +1 -1
- package/lib/main/browser/view/plugin-view-registry.js +108 -56
- package/lib/main/browser/view/plugin-view-registry.js.map +1 -1
- package/lib/main/browser/webview-views/webview-views-main.d.ts.map +1 -1
- package/lib/main/browser/webview-views/webview-views-main.js +5 -2
- package/lib/main/browser/webview-views/webview-views-main.js.map +1 -1
- package/lib/main/browser/webview-views/webview-views.d.ts +1 -0
- package/lib/main/browser/webview-views/webview-views.d.ts.map +1 -1
- package/lib/main/node/plugin-service.d.ts +2 -0
- package/lib/main/node/plugin-service.d.ts.map +1 -1
- package/lib/main/node/plugin-service.js +14 -1
- package/lib/main/node/plugin-service.js.map +1 -1
- package/lib/plugin/command-registry.d.ts +1 -3
- package/lib/plugin/command-registry.d.ts.map +1 -1
- package/lib/plugin/command-registry.js.map +1 -1
- package/lib/plugin/notebook/notebook-kernels.d.ts.map +1 -1
- package/lib/plugin/notebook/notebook-kernels.js +1 -0
- package/lib/plugin/notebook/notebook-kernels.js.map +1 -1
- package/lib/plugin/notebook/notebooks.d.ts.map +1 -1
- package/lib/plugin/notebook/notebooks.js +2 -2
- package/lib/plugin/notebook/notebooks.js.map +1 -1
- package/lib/plugin/plugin-context.d.ts.map +1 -1
- package/lib/plugin/plugin-context.js +9 -18
- package/lib/plugin/plugin-context.js.map +1 -1
- package/lib/plugin/telemetry-ext.js +1 -1
- package/lib/plugin/telemetry-ext.js.map +1 -1
- package/lib/plugin/terminal-ext.d.ts +11 -9
- package/lib/plugin/terminal-ext.d.ts.map +1 -1
- package/lib/plugin/terminal-ext.js +37 -25
- package/lib/plugin/terminal-ext.js.map +1 -1
- package/lib/plugin/test-item.d.ts +47 -0
- package/lib/plugin/test-item.d.ts.map +1 -0
- package/lib/plugin/test-item.js +196 -0
- package/lib/plugin/test-item.js.map +1 -0
- package/lib/plugin/tests.d.ts +117 -0
- package/lib/plugin/tests.d.ts.map +1 -0
- package/lib/plugin/tests.js +402 -0
- package/lib/plugin/tests.js.map +1 -0
- package/lib/plugin/tree/tree-views.d.ts.map +1 -1
- package/lib/plugin/tree/tree-views.js +2 -1
- package/lib/plugin/tree/tree-views.js.map +1 -1
- package/lib/plugin/type-converters.d.ts +10 -1
- package/lib/plugin/type-converters.d.ts.map +1 -1
- package/lib/plugin/type-converters.js +74 -2
- package/lib/plugin/type-converters.js.map +1 -1
- package/lib/plugin/types-impl.d.ts +29 -4
- package/lib/plugin/types-impl.d.ts.map +1 -1
- package/lib/plugin/types-impl.js +30 -8
- package/lib/plugin/types-impl.js.map +1 -1
- package/package.json +30 -29
- package/src/common/arrays.ts +16 -0
- package/src/common/commands.ts +19 -0
- package/src/common/plugin-api-rpc-model.ts +1 -0
- package/src/common/plugin-api-rpc.ts +69 -7
- package/src/common/plugin-protocol.ts +31 -3
- package/src/common/test-types.ts +133 -0
- package/src/hosted/browser/hosted-plugin.ts +13 -1
- package/src/hosted/node/hosted-plugin-localization-service.ts +72 -37
- package/src/hosted/node/plugin-reader.ts +4 -2
- package/src/hosted/node/scanners/scanner-theia.ts +85 -20
- package/src/main/browser/command-registry-main.ts +14 -1
- package/src/main/browser/languages-main.ts +7 -5
- package/src/main/browser/main-context.ts +4 -0
- package/src/main/browser/menus/vscode-theia-menu-mappings.ts +3 -0
- package/src/main/browser/notebooks/notebook-documents-and-editors-main.ts +2 -2
- package/src/main/browser/notebooks/notebook-documents-main.ts +1 -1
- package/src/main/browser/notebooks/notebook-dto.ts +2 -2
- package/src/main/browser/notebooks/notebook-kernels-main.ts +6 -11
- package/src/main/browser/notebooks/notebook-renderers-main.ts +1 -1
- package/src/main/browser/notebooks/notebooks-main.ts +6 -6
- package/src/main/browser/notebooks/renderers/cell-output-webview.tsx +3 -0
- package/src/main/browser/notebooks/renderers/output-webview-internal.ts +3 -2
- package/src/main/browser/plugin-contribution-handler.ts +19 -2
- package/src/main/browser/plugin-ext-frontend-module.ts +4 -0
- package/src/main/browser/plugin-icon-service.ts +156 -0
- package/src/main/browser/terminal-main.ts +7 -11
- package/src/main/browser/test-main.ts +618 -0
- package/src/main/browser/view/plugin-view-registry.ts +114 -56
- package/src/main/browser/webview-views/webview-views-main.ts +5 -2
- package/src/main/browser/webview-views/webview-views.ts +1 -0
- package/src/main/node/plugin-service.ts +12 -1
- package/src/plugin/command-registry.ts +1 -5
- package/src/plugin/notebook/notebook-kernels.ts +3 -1
- package/src/plugin/notebook/notebooks.ts +1 -3
- package/src/plugin/plugin-context.ts +13 -32
- package/src/plugin/telemetry-ext.ts +1 -1
- package/src/plugin/terminal-ext.ts +40 -26
- package/src/plugin/test-item.ts +174 -0
- package/src/plugin/tests.ts +482 -0
- package/src/plugin/tree/tree-views.ts +2 -1
- package/src/plugin/type-converters.ts +87 -3
- package/src/plugin/types-impl.ts +36 -5
- package/lib/plugin/stubs/tests-api.d.ts +0 -25
- package/lib/plugin/stubs/tests-api.d.ts.map +0 -1
- package/lib/plugin/stubs/tests-api.js +0 -70
- package/lib/plugin/stubs/tests-api.js.map +0 -1
- package/src/plugin/stubs/tests-api.ts +0 -102
|
@@ -102,7 +102,6 @@ import {
|
|
|
102
102
|
import { DebuggerDescription } from '@theia/debug/lib/common/debug-service';
|
|
103
103
|
import { DebugProtocol } from '@vscode/debugprotocol';
|
|
104
104
|
import { SymbolInformation } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
105
|
-
import { ArgumentProcessor } from '../plugin/command-registry';
|
|
106
105
|
import * as files from '@theia/filesystem/lib/common/files';
|
|
107
106
|
import { BinaryBuffer } from '@theia/core/lib/common/buffer';
|
|
108
107
|
import { ResourceLabelFormatter } from '@theia/core/lib/common/label-protocol';
|
|
@@ -112,7 +111,7 @@ import type {
|
|
|
112
111
|
TimelineChangeEvent,
|
|
113
112
|
TimelineProviderDescriptor
|
|
114
113
|
} from '@theia/timeline/lib/common/timeline-model';
|
|
115
|
-
import { SerializableEnvironmentVariableCollection
|
|
114
|
+
import { SerializableEnvironmentVariableCollection } from '@theia/terminal/lib/common/shell-terminal-protocol';
|
|
116
115
|
import { ThemeType } from '@theia/core/lib/common/theme';
|
|
117
116
|
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
118
117
|
import { isString, isObject, PickOptions, QuickInputButtonHandle } from '@theia/core/lib/common';
|
|
@@ -123,6 +122,10 @@ import { CellExecutionUpdateType, CellRange, NotebookCellExecutionState } from '
|
|
|
123
122
|
import { LanguagePackBundle } from './language-pack-service';
|
|
124
123
|
import { AccessibilityInformation } from '@theia/core/lib/common/accessibility';
|
|
125
124
|
|
|
125
|
+
import { TreeDelta } from '@theia/test/lib/common/tree-delta';
|
|
126
|
+
import { TestItemDTO, TestOutputDTO, TestRunDTO, TestRunProfileDTO, TestRunRequestDTO, TestStateChangeDTO } from './test-types';
|
|
127
|
+
import { ArgumentProcessor } from './commands';
|
|
128
|
+
|
|
126
129
|
export interface PreferenceData {
|
|
127
130
|
[scope: number]: any;
|
|
128
131
|
}
|
|
@@ -270,6 +273,8 @@ export interface CommandRegistryMain {
|
|
|
270
273
|
$executeCommand<T>(id: string, ...args: any[]): PromiseLike<T | undefined>;
|
|
271
274
|
$getCommands(): PromiseLike<string[]>;
|
|
272
275
|
$getKeyBinding(commandId: string): PromiseLike<theia.CommandKeyBinding[] | undefined>;
|
|
276
|
+
|
|
277
|
+
registerArgumentProcessor(processor: ArgumentProcessor): void;
|
|
273
278
|
}
|
|
274
279
|
|
|
275
280
|
export interface CommandRegistryExt {
|
|
@@ -287,10 +292,10 @@ export interface TerminalServiceExt {
|
|
|
287
292
|
$terminalSizeChanged(id: string, cols: number, rows: number): void;
|
|
288
293
|
$currentTerminalChanged(id: string | undefined): void;
|
|
289
294
|
$terminalStateChanged(id: string): void;
|
|
290
|
-
$initEnvironmentVariableCollections(collections: [string, SerializableEnvironmentVariableCollection][]): void;
|
|
295
|
+
$initEnvironmentVariableCollections(collections: [string, string, boolean, SerializableEnvironmentVariableCollection][]): void;
|
|
291
296
|
$provideTerminalLinks(line: string, terminalId: string, token: theia.CancellationToken): Promise<ProvidedTerminalLink[]>;
|
|
292
297
|
$handleTerminalLink(link: ProvidedTerminalLink): Promise<void>;
|
|
293
|
-
getEnvironmentVariableCollection(extensionIdentifier: string): theia.
|
|
298
|
+
getEnvironmentVariableCollection(extensionIdentifier: string): theia.GlobalEnvironmentVariableCollection;
|
|
294
299
|
}
|
|
295
300
|
export interface OutputChannelRegistryExt {
|
|
296
301
|
createOutputChannel(name: string, pluginInfo: PluginInfo): theia.OutputChannel,
|
|
@@ -408,7 +413,7 @@ export interface TerminalServiceMain {
|
|
|
408
413
|
*/
|
|
409
414
|
$disposeByTerminalId(id: number, waitOnExit?: boolean | string): void;
|
|
410
415
|
|
|
411
|
-
$setEnvironmentVariableCollection(persistent: boolean, collection:
|
|
416
|
+
$setEnvironmentVariableCollection(persistent: boolean, extensionIdentifier: string, rootUri: string, collection: SerializableEnvironmentVariableCollection): void;
|
|
412
417
|
|
|
413
418
|
/**
|
|
414
419
|
* Set the terminal widget name.
|
|
@@ -2142,6 +2147,60 @@ export interface TelemetryExt {
|
|
|
2142
2147
|
|
|
2143
2148
|
// endregion
|
|
2144
2149
|
|
|
2150
|
+
// based from https://github.com/microsoft/vscode/blob/1.72.2/src/vs/workbench/api/common/extHostTesting.ts
|
|
2151
|
+
export const enum TestingResourceExt {
|
|
2152
|
+
Workspace,
|
|
2153
|
+
TextDocument
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
// based from https://github.com/microsoft/vscode/blob/1.72.2/src/vs/workbench/api/common/extHostTesting.ts
|
|
2157
|
+
export interface TestingExt {
|
|
2158
|
+
$onCancelTestRun(controllerId: string, runId: string): void;
|
|
2159
|
+
/** Configures a test run config. */
|
|
2160
|
+
$onConfigureRunProfile(controllerId: string, profileId: string): void;
|
|
2161
|
+
|
|
2162
|
+
$onRunControllerTests(reqs: TestRunRequestDTO[]): void;
|
|
2163
|
+
|
|
2164
|
+
/** Asks the controller to refresh its tests */
|
|
2165
|
+
$refreshTests(controllerId: string, token: CancellationToken): Promise<void>;
|
|
2166
|
+
|
|
2167
|
+
$onResolveChildren(controllerId: string, path: string[]): void;
|
|
2168
|
+
}
|
|
2169
|
+
|
|
2170
|
+
export interface TestControllerUpdate {
|
|
2171
|
+
label: string;
|
|
2172
|
+
canRefresh: boolean;
|
|
2173
|
+
canResolve: boolean;
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
// based from https://github.com/microsoft/vscode/blob/1.72.2/src/vs/workbench/api/common/extHostTesting.ts
|
|
2177
|
+
export interface TestingMain {
|
|
2178
|
+
// --- test lifecycle:
|
|
2179
|
+
|
|
2180
|
+
/** Registers that there's a test controller with the given ID */
|
|
2181
|
+
$registerTestController(controllerId: string, label: string): void;
|
|
2182
|
+
/** Updates the label of an existing test controller. */
|
|
2183
|
+
$updateController(controllerId: string, patch: Partial<TestControllerUpdate>): void;
|
|
2184
|
+
/** Disposes of the test controller with the given ID */
|
|
2185
|
+
$unregisterTestController(controllerId: string): void;
|
|
2186
|
+
$notifyDelta(controllerId: string, diff: TreeDelta<string, TestItemDTO>[]): void;
|
|
2187
|
+
|
|
2188
|
+
// --- test run configurations:
|
|
2189
|
+
|
|
2190
|
+
/** Called when a new test run profile is available */
|
|
2191
|
+
$notifyTestRunProfileCreated(controllerId: string, profile: TestRunProfileDTO): void;
|
|
2192
|
+
/** Updates an existing test run profile */
|
|
2193
|
+
$updateTestRunProfile(controllerId: string, profileId: string, update: Partial<TestRunProfileDTO>): void;
|
|
2194
|
+
/** Removes a previously-published test run profile */
|
|
2195
|
+
$removeTestRunProfile(controllerId: string, profileId: string): void;
|
|
2196
|
+
|
|
2197
|
+
// Test runs
|
|
2198
|
+
|
|
2199
|
+
$notifyTestRunCreated(controllerId: string, run: TestRunDTO): void;
|
|
2200
|
+
$notifyTestStateChanged(controllerId: string, runId: string, stateChanges: TestStateChangeDTO[], outputChanges: TestOutputDTO[]): void;
|
|
2201
|
+
$notifyTestRunEnded(controllerId: string, runId: string): void;
|
|
2202
|
+
}
|
|
2203
|
+
|
|
2145
2204
|
export const PLUGIN_RPC_CONTEXT = {
|
|
2146
2205
|
AUTHENTICATION_MAIN: <ProxyIdentifier<AuthenticationMain>>createProxyIdentifier<AuthenticationMain>('AuthenticationMain'),
|
|
2147
2206
|
COMMAND_REGISTRY_MAIN: <ProxyIdentifier<CommandRegistryMain>>createProxyIdentifier<CommandRegistryMain>('CommandRegistryMain'),
|
|
@@ -2185,6 +2244,7 @@ export const PLUGIN_RPC_CONTEXT = {
|
|
|
2185
2244
|
TABS_MAIN: <ProxyIdentifier<TabsMain>>createProxyIdentifier<TabsMain>('TabsMain'),
|
|
2186
2245
|
TELEMETRY_MAIN: <ProxyIdentifier<TelemetryMain>>createProxyIdentifier<TelemetryMain>('TelemetryMain'),
|
|
2187
2246
|
LOCALIZATION_MAIN: <ProxyIdentifier<LocalizationMain>>createProxyIdentifier<LocalizationMain>('LocalizationMain'),
|
|
2247
|
+
TESTING_MAIN: createProxyIdentifier<TestingMain>('TestingMain')
|
|
2188
2248
|
};
|
|
2189
2249
|
|
|
2190
2250
|
export const MAIN_RPC_CONTEXT = {
|
|
@@ -2225,7 +2285,8 @@ export const MAIN_RPC_CONTEXT = {
|
|
|
2225
2285
|
THEMING_EXT: createProxyIdentifier<ThemingExt>('ThemingExt'),
|
|
2226
2286
|
COMMENTS_EXT: createProxyIdentifier<CommentsExt>('CommentsExt'),
|
|
2227
2287
|
TABS_EXT: createProxyIdentifier<TabsExt>('TabsExt'),
|
|
2228
|
-
TELEMETRY_EXT: createProxyIdentifier<TelemetryExt>('TelemetryExt)')
|
|
2288
|
+
TELEMETRY_EXT: createProxyIdentifier<TelemetryExt>('TelemetryExt)'),
|
|
2289
|
+
TESTING_EXT: createProxyIdentifier<TestingExt>('TestingExt')
|
|
2229
2290
|
};
|
|
2230
2291
|
|
|
2231
2292
|
export interface TasksExt {
|
|
@@ -2423,6 +2484,7 @@ export interface CellExecuteOutputEditDto {
|
|
|
2423
2484
|
export interface CellExecuteOutputItemEditDto {
|
|
2424
2485
|
editType: CellExecutionUpdateType.OutputItems;
|
|
2425
2486
|
append?: boolean;
|
|
2487
|
+
outputId: string;
|
|
2426
2488
|
items: NotebookOutputItemDto[];
|
|
2427
2489
|
}
|
|
2428
2490
|
|
|
@@ -2464,7 +2526,7 @@ export interface NotebooksExt extends NotebookDocumentsAndEditorsExt {
|
|
|
2464
2526
|
}
|
|
2465
2527
|
|
|
2466
2528
|
export interface NotebooksMain extends Disposable {
|
|
2467
|
-
$registerNotebookSerializer(handle: number,
|
|
2529
|
+
$registerNotebookSerializer(handle: number, viewType: string, options: notebookCommon.TransientOptions): void;
|
|
2468
2530
|
$unregisterNotebookSerializer(handle: number): void;
|
|
2469
2531
|
|
|
2470
2532
|
$registerNotebookCellStatusBarItemProvider(handle: number, eventHandle: number | undefined, viewType: string): Promise<void>;
|
|
@@ -17,7 +17,7 @@ import { RpcServer } from '@theia/core/lib/common/messaging/proxy-factory';
|
|
|
17
17
|
import { RPCProtocol } from './rpc-protocol';
|
|
18
18
|
import { Disposable } from '@theia/core/lib/common/disposable';
|
|
19
19
|
import { LogPart, KeysToAnyValues, KeysToKeysToAnyValue } from './types';
|
|
20
|
-
import { CharacterPair, CommentRule, PluginAPIFactory, Plugin } from './plugin-api-rpc';
|
|
20
|
+
import { CharacterPair, CommentRule, PluginAPIFactory, Plugin, ThemeIcon } from './plugin-api-rpc';
|
|
21
21
|
import { ExtPluginApi } from './plugin-ext-api-contribution';
|
|
22
22
|
import { IJSONSchema, IJSONSchemaSnippet } from '@theia/core/lib/common/json-schema';
|
|
23
23
|
import { RecursivePartial } from '@theia/core/lib/common/types';
|
|
@@ -90,6 +90,7 @@ export interface PluginPackageContribution {
|
|
|
90
90
|
snippets?: PluginPackageSnippetsContribution[];
|
|
91
91
|
themes?: PluginThemeContribution[];
|
|
92
92
|
iconThemes?: PluginIconThemeContribution[];
|
|
93
|
+
icons?: PluginIconContribution[];
|
|
93
94
|
colors?: PluginColorContribution[];
|
|
94
95
|
taskDefinitions?: PluginTaskDefinitionContribution[];
|
|
95
96
|
problemMatchers?: PluginProblemMatcherContribution[];
|
|
@@ -262,6 +263,13 @@ export interface PluginIconThemeContribution {
|
|
|
262
263
|
uiTheme?: PluginUiTheme;
|
|
263
264
|
}
|
|
264
265
|
|
|
266
|
+
export interface PluginIconContribution {
|
|
267
|
+
[id: string]: {
|
|
268
|
+
description: string;
|
|
269
|
+
default: { fontPath: string; fontCharacter: string } | string;
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
|
|
265
273
|
export interface PlatformSpecificAdapterContribution {
|
|
266
274
|
program?: string;
|
|
267
275
|
args?: string[];
|
|
@@ -586,6 +594,7 @@ export interface PluginContribution {
|
|
|
586
594
|
snippets?: SnippetContribution[];
|
|
587
595
|
themes?: ThemeContribution[];
|
|
588
596
|
iconThemes?: IconThemeContribution[];
|
|
597
|
+
icons?: IconContribution[];
|
|
589
598
|
colors?: ColorDefinition[];
|
|
590
599
|
taskDefinitions?: TaskDefinition[];
|
|
591
600
|
problemMatchers?: ProblemMatcherContribution[];
|
|
@@ -634,8 +643,7 @@ export interface Localization {
|
|
|
634
643
|
export interface Translation {
|
|
635
644
|
id: string;
|
|
636
645
|
path: string;
|
|
637
|
-
|
|
638
|
-
contents: { [scope: string]: { [key: string]: string } }
|
|
646
|
+
cachedContents?: { [scope: string]: { [key: string]: string } };
|
|
639
647
|
}
|
|
640
648
|
|
|
641
649
|
export interface SnippetContribution {
|
|
@@ -662,6 +670,26 @@ export interface IconThemeContribution {
|
|
|
662
670
|
uiTheme?: UiTheme;
|
|
663
671
|
}
|
|
664
672
|
|
|
673
|
+
export interface IconDefinition {
|
|
674
|
+
fontCharacter: string;
|
|
675
|
+
location: string;
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
export type IconDefaults = ThemeIcon | IconDefinition;
|
|
679
|
+
|
|
680
|
+
export interface IconContribution {
|
|
681
|
+
id: string;
|
|
682
|
+
extensionId: string;
|
|
683
|
+
description: string | undefined;
|
|
684
|
+
defaults: IconDefaults;
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
export namespace IconContribution {
|
|
688
|
+
export function isIconDefinition(defaults: IconDefaults): defaults is IconDefinition {
|
|
689
|
+
return 'fontCharacter' in defaults;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
|
|
665
693
|
export interface GrammarsContribution {
|
|
666
694
|
format: 'json' | 'plist';
|
|
667
695
|
language?: string;
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2023 Mathieu Bussieres 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
/*---------------------------------------------------------------------------------------------
|
|
18
|
+
* Copyright (c) Microsoft Corporation and others. All rights reserved.
|
|
19
|
+
* Licensed under the MIT License. See https://github.com/Microsoft/vscode/blob/master/LICENSE.txt for license information.
|
|
20
|
+
*--------------------------------------------------------------------------------------------*/
|
|
21
|
+
|
|
22
|
+
// Based on https://github.com/microsoft/vscode/blob/1.72.2/src/vs/workbench/contrib/testing/common/testTypes.ts
|
|
23
|
+
|
|
24
|
+
/* eslint-disable import/no-extraneous-dependencies */
|
|
25
|
+
|
|
26
|
+
import { MarkdownString } from '@theia/core/lib/common/markdown-rendering';
|
|
27
|
+
import { UriComponents } from './uri-components';
|
|
28
|
+
import { Location, Range } from './plugin-api-rpc-model';
|
|
29
|
+
import { isObject } from '@theia/core';
|
|
30
|
+
|
|
31
|
+
export enum TestRunProfileKind {
|
|
32
|
+
Run = 1,
|
|
33
|
+
Debug = 2,
|
|
34
|
+
Coverage = 3
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface TestRunProfileDTO {
|
|
38
|
+
readonly id: string;
|
|
39
|
+
readonly label: string;
|
|
40
|
+
readonly kind: TestRunProfileKind;
|
|
41
|
+
readonly isDefault: boolean;
|
|
42
|
+
readonly tag: string;
|
|
43
|
+
readonly canConfigure: boolean;
|
|
44
|
+
}
|
|
45
|
+
export interface TestRunDTO {
|
|
46
|
+
readonly id: string;
|
|
47
|
+
readonly name: string;
|
|
48
|
+
readonly isRunning: boolean;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export interface TestOutputDTO {
|
|
52
|
+
readonly output: string;
|
|
53
|
+
readonly location?: Location;
|
|
54
|
+
readonly itemPath?: string[];
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export enum TestExecutionState {
|
|
58
|
+
Queued = 1,
|
|
59
|
+
Running = 2,
|
|
60
|
+
Passed = 3,
|
|
61
|
+
Failed = 4,
|
|
62
|
+
Skipped = 5,
|
|
63
|
+
Errored = 6
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface TestStateChangeDTO {
|
|
67
|
+
readonly state: TestExecutionState;
|
|
68
|
+
readonly itemPath: string[];
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export interface TestFailureDTO extends TestStateChangeDTO {
|
|
72
|
+
readonly state: TestExecutionState.Failed | TestExecutionState.Errored;
|
|
73
|
+
readonly messages: TestMessageDTO[];
|
|
74
|
+
readonly duration?: number;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface TestSuccessDTO extends TestStateChangeDTO {
|
|
78
|
+
readonly state: TestExecutionState.Passed;
|
|
79
|
+
readonly duration?: number;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface TestMessageDTO {
|
|
83
|
+
readonly expected?: string;
|
|
84
|
+
readonly actual?: string;
|
|
85
|
+
readonly location?: Location;
|
|
86
|
+
readonly message: string | MarkdownString;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface TestItemDTO {
|
|
90
|
+
readonly id: string;
|
|
91
|
+
readonly label: string;
|
|
92
|
+
readonly range?: Range;
|
|
93
|
+
readonly sortKey?: string;
|
|
94
|
+
readonly tags: string[];
|
|
95
|
+
readonly uri?: UriComponents;
|
|
96
|
+
readonly busy: boolean;
|
|
97
|
+
readonly canResolveChildren: boolean;
|
|
98
|
+
readonly description?: string;
|
|
99
|
+
readonly error?: string | MarkdownString
|
|
100
|
+
readonly children?: TestItemDTO[];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface TestRunRequestDTO {
|
|
104
|
+
controllerId: string;
|
|
105
|
+
profileId: string;
|
|
106
|
+
name: string;
|
|
107
|
+
includedTests: string[][]; // array of paths
|
|
108
|
+
excludedTests: string[][]; // array of paths
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
export interface TestItemReference {
|
|
112
|
+
typeTag: '$type_test_item_reference',
|
|
113
|
+
controllerId: string;
|
|
114
|
+
testPath: string[];
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export namespace TestItemReference {
|
|
118
|
+
export function is(ref: unknown): ref is TestItemReference {
|
|
119
|
+
return isObject<TestItemReference>(ref)
|
|
120
|
+
&& ref.typeTag === '$type_test_item_reference'
|
|
121
|
+
&& typeof ref.controllerId === 'string'
|
|
122
|
+
&& Array.isArray(ref.testPath);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export function create(controllerId: string, testPath: string[]): TestItemReference {
|
|
126
|
+
return {
|
|
127
|
+
typeTag: '$type_test_item_reference',
|
|
128
|
+
controllerId,
|
|
129
|
+
testPath
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
@@ -69,7 +69,7 @@ import { LanguageService } from '@theia/monaco-editor-core/esm/vs/editor/common/
|
|
|
69
69
|
import { Measurement, Stopwatch } from '@theia/core/lib/common';
|
|
70
70
|
import { Uint8ArrayReadBuffer, Uint8ArrayWriteBuffer } from '@theia/core/lib/common/message-rpc/uint8-array-message-buffer';
|
|
71
71
|
import { BasicChannel } from '@theia/core/lib/common/message-rpc/channel';
|
|
72
|
-
import { NotebookTypeRegistry, NotebookService } from '@theia/notebook/lib/browser';
|
|
72
|
+
import { NotebookTypeRegistry, NotebookService, NotebookRendererMessagingService } from '@theia/notebook/lib/browser';
|
|
73
73
|
|
|
74
74
|
export type PluginHost = 'frontend' | string;
|
|
75
75
|
export type DebugActivationEvent = 'onDebugResolve' | 'onDebugInitialConfigurations' | 'onDebugAdapterProtocolTracker' | 'onDebugDynamicConfigurations';
|
|
@@ -118,6 +118,9 @@ export class HostedPluginSupport {
|
|
|
118
118
|
@inject(NotebookService)
|
|
119
119
|
protected readonly notebookService: NotebookService;
|
|
120
120
|
|
|
121
|
+
@inject(NotebookRendererMessagingService)
|
|
122
|
+
protected readonly notebookRendererMessagingService: NotebookRendererMessagingService;
|
|
123
|
+
|
|
121
124
|
@inject(CommandRegistry)
|
|
122
125
|
protected readonly commands: CommandRegistry;
|
|
123
126
|
|
|
@@ -224,6 +227,7 @@ export class HostedPluginSupport {
|
|
|
224
227
|
this.fileService.onWillActivateFileSystemProvider(event => this.ensureFileSystemActivation(event));
|
|
225
228
|
this.customEditorRegistry.onWillOpenCustomEditor(event => this.activateByCustomEditor(event));
|
|
226
229
|
this.notebookService.onWillOpenNotebook(async event => this.activateByNotebook(event));
|
|
230
|
+
this.notebookRendererMessagingService.onWillActivateRenderer(rendererId => this.activateByNotebookRenderer(rendererId));
|
|
227
231
|
|
|
228
232
|
this.widgets.onDidCreateWidget(({ factoryId, widget }) => {
|
|
229
233
|
if ((factoryId === WebviewWidget.FACTORY_ID || factoryId === CustomEditorWidget.FACTORY_ID) && widget instanceof WebviewWidget) {
|
|
@@ -633,6 +637,14 @@ export class HostedPluginSupport {
|
|
|
633
637
|
await this.activateByEvent(`onNotebook:${viewType}`);
|
|
634
638
|
}
|
|
635
639
|
|
|
640
|
+
async activateByNotebookSerializer(viewType: string): Promise<void> {
|
|
641
|
+
await this.activateByEvent(`onNotebookSerializer:${viewType}`);
|
|
642
|
+
}
|
|
643
|
+
|
|
644
|
+
async activateByNotebookRenderer(rendererId: string): Promise<void> {
|
|
645
|
+
await this.activateByEvent(`onRenderer:${rendererId}`);
|
|
646
|
+
}
|
|
647
|
+
|
|
636
648
|
activateByFileSystem(event: FileSystemProviderActivationEvent): Promise<void> {
|
|
637
649
|
return this.activateByEvent(`onFileSystem:${event.scheme}`);
|
|
638
650
|
}
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
|
|
17
17
|
import * as path from 'path';
|
|
18
18
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
19
|
-
import { LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
|
|
19
|
+
import { LazyLocalization, LocalizationProvider } from '@theia/core/lib/node/i18n/localization-provider';
|
|
20
20
|
import { Localization } from '@theia/core/lib/common/i18n/localization';
|
|
21
21
|
import { inject, injectable } from '@theia/core/shared/inversify';
|
|
22
22
|
import { DeployedPlugin, Localization as PluginLocalization, PluginIdentifiers, Translation } from '../../common';
|
|
23
23
|
import { EnvVariablesServer } from '@theia/core/lib/common/env-variables';
|
|
24
24
|
import { BackendApplicationContribution } from '@theia/core/lib/node';
|
|
25
|
-
import { Disposable, DisposableCollection, isObject, MaybePromise, nls, URI } from '@theia/core';
|
|
25
|
+
import { Disposable, DisposableCollection, isObject, MaybePromise, nls, Path, URI } from '@theia/core';
|
|
26
26
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
27
27
|
import { LanguagePackBundle, LanguagePackService } from '../../common/language-pack-service';
|
|
28
28
|
|
|
@@ -70,11 +70,8 @@ export class HostedPluginLocalizationService implements BackendApplicationContri
|
|
|
70
70
|
if (plugin.contributes?.localizations) {
|
|
71
71
|
// Indicator that this plugin is a vscode language pack
|
|
72
72
|
// Language packs translate Theia and some builtin vscode extensions
|
|
73
|
-
const localizations = buildLocalizations(plugin.contributes.localizations);
|
|
74
|
-
disposable.push(
|
|
75
|
-
this.localizationProvider.removeLocalizations(...localizations);
|
|
76
|
-
}));
|
|
77
|
-
this.localizationProvider.addLocalizations(...localizations);
|
|
73
|
+
const localizations = buildLocalizations(plugin.metadata.model.packageUri, plugin.contributes.localizations);
|
|
74
|
+
disposable.push(this.localizationProvider.addLocalizations(...localizations));
|
|
78
75
|
}
|
|
79
76
|
if (plugin.metadata.model.l10n || plugin.contributes?.localizations) {
|
|
80
77
|
// Indicator that this plugin is a vscode language pack or has its own localization bundles
|
|
@@ -100,26 +97,29 @@ export class HostedPluginLocalizationService implements BackendApplicationContri
|
|
|
100
97
|
const pluginId = plugin.metadata.model.id;
|
|
101
98
|
const packageUri = new URI(plugin.metadata.model.packageUri);
|
|
102
99
|
if (plugin.contributes?.localizations) {
|
|
100
|
+
const l10nPromises: Promise<void>[] = [];
|
|
103
101
|
for (const localization of plugin.contributes.localizations) {
|
|
104
102
|
for (const translation of localization.translations) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
103
|
+
l10nPromises.push(getL10nTranslation(plugin.metadata.model.packageUri, translation).then(l10n => {
|
|
104
|
+
if (l10n) {
|
|
105
|
+
const translatedPluginId = translation.id;
|
|
106
|
+
const translationUri = packageUri.resolve(translation.path);
|
|
107
|
+
const locale = localization.languageId;
|
|
108
|
+
// We store a bundle for another extension in here
|
|
109
|
+
// Hence we use `translatedPluginId` instead of `pluginId`
|
|
110
|
+
this.languagePackService.storeBundle(translatedPluginId, locale, {
|
|
111
|
+
contents: processL10nBundle(l10n),
|
|
112
|
+
uri: translationUri.toString()
|
|
113
|
+
});
|
|
114
|
+
disposable.push(Disposable.create(() => {
|
|
115
|
+
// Only dispose the deleted locale for the specific plugin
|
|
116
|
+
this.languagePackService.deleteBundle(translatedPluginId, locale);
|
|
117
|
+
}));
|
|
118
|
+
}
|
|
119
|
+
}));
|
|
121
120
|
}
|
|
122
121
|
}
|
|
122
|
+
await Promise.all(l10nPromises);
|
|
123
123
|
}
|
|
124
124
|
// The `l10n` field of the plugin model points to a relative directory path within the plugin
|
|
125
125
|
// It is supposed to contain localization bundles that contain translations of the plugin strings into different languages
|
|
@@ -150,11 +150,13 @@ export class HostedPluginLocalizationService implements BackendApplicationContri
|
|
|
150
150
|
*/
|
|
151
151
|
async localizePlugin(plugin: DeployedPlugin): Promise<DeployedPlugin> {
|
|
152
152
|
const currentLanguage = this.localizationProvider.getCurrentLanguage();
|
|
153
|
-
const localization = this.localizationProvider.loadLocalization(currentLanguage);
|
|
154
153
|
const pluginPath = new URI(plugin.metadata.model.packageUri).path.fsPath();
|
|
155
154
|
const pluginId = plugin.metadata.model.id;
|
|
156
155
|
try {
|
|
157
|
-
const translations = await
|
|
156
|
+
const [localization, translations] = await Promise.all([
|
|
157
|
+
this.localizationProvider.loadLocalization(currentLanguage),
|
|
158
|
+
loadPackageTranslations(pluginPath, currentLanguage),
|
|
159
|
+
]);
|
|
158
160
|
plugin = localizePackage(plugin, translations, (key, original) => {
|
|
159
161
|
const fullKey = `${pluginId}/package/${key}`;
|
|
160
162
|
return Localization.localize(localization, fullKey, original);
|
|
@@ -218,10 +220,24 @@ export class HostedPluginLocalizationService implements BackendApplicationContri
|
|
|
218
220
|
|
|
219
221
|
// New plugin localization logic using vscode.l10n
|
|
220
222
|
|
|
221
|
-
function getL10nTranslation(translation: Translation): UnprocessedL10nBundle | undefined {
|
|
223
|
+
async function getL10nTranslation(packageUri: string, translation: Translation): Promise<UnprocessedL10nBundle | undefined> {
|
|
222
224
|
// 'bundle' is a special key that contains all translations for the l10n vscode API
|
|
223
225
|
// If that doesn't exist, we can assume that the language pack is using the old vscode-nls API
|
|
224
|
-
|
|
226
|
+
if (translation.cachedContents) {
|
|
227
|
+
return translation.cachedContents.bundle;
|
|
228
|
+
} else {
|
|
229
|
+
const translationPath = new URI(packageUri).path.join(translation.path).fsPath();
|
|
230
|
+
try {
|
|
231
|
+
const translationJson = await fs.readJson(translationPath);
|
|
232
|
+
translation.cachedContents = translationJson?.contents;
|
|
233
|
+
return translationJson?.contents?.bundle;
|
|
234
|
+
} catch (err) {
|
|
235
|
+
console.error('Failed reading translation file from: ' + translationPath, err);
|
|
236
|
+
// Store an empty object, so we don't reattempt to load the file
|
|
237
|
+
translation.cachedContents = {};
|
|
238
|
+
return undefined;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
225
241
|
}
|
|
226
242
|
|
|
227
243
|
async function loadPluginBundles(l10nUri: URI): Promise<Record<string, LanguagePackBundle> | undefined> {
|
|
@@ -262,28 +278,47 @@ function processL10nBundle(bundle: UnprocessedL10nBundle): Record<string, string
|
|
|
262
278
|
|
|
263
279
|
// Old plugin localization logic for vscode-nls
|
|
264
280
|
// vscode-nls was used until version 1.73 of VSCode to translate extensions
|
|
281
|
+
// This style of localization is still used by vscode language packs
|
|
265
282
|
|
|
266
|
-
function buildLocalizations(localizations: PluginLocalization[]):
|
|
267
|
-
const theiaLocalizations:
|
|
283
|
+
function buildLocalizations(packageUri: string, localizations: PluginLocalization[]): LazyLocalization[] {
|
|
284
|
+
const theiaLocalizations: LazyLocalization[] = [];
|
|
285
|
+
const packagePath = new URI(packageUri).path;
|
|
268
286
|
for (const localization of localizations) {
|
|
269
|
-
|
|
287
|
+
let cachedLocalization: Promise<Record<string, string>> | undefined;
|
|
288
|
+
const theiaLocalization: LazyLocalization = {
|
|
270
289
|
languageId: localization.languageId,
|
|
271
290
|
languageName: localization.languageName,
|
|
272
291
|
localizedLanguageName: localization.localizedLanguageName,
|
|
273
292
|
languagePack: true,
|
|
274
|
-
|
|
293
|
+
async getTranslations(): Promise<Record<string, string>> {
|
|
294
|
+
cachedLocalization ??= loadTranslations(packagePath, localization.translations);
|
|
295
|
+
return cachedLocalization;
|
|
296
|
+
},
|
|
275
297
|
};
|
|
276
|
-
|
|
277
|
-
|
|
298
|
+
theiaLocalizations.push(theiaLocalization);
|
|
299
|
+
}
|
|
300
|
+
return theiaLocalizations;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
async function loadTranslations(packagePath: Path, translations: Translation[]): Promise<Record<string, string>> {
|
|
304
|
+
const allTranslations = await Promise.all(translations.map(async translation => {
|
|
305
|
+
const values: Record<string, string> = {};
|
|
306
|
+
const translationPath = packagePath.join(translation.path).fsPath();
|
|
307
|
+
try {
|
|
308
|
+
const translationJson = await fs.readJson(translationPath);
|
|
309
|
+
const translationContents: Record<string, Record<string, string>> = translationJson?.contents;
|
|
310
|
+
for (const [scope, value] of Object.entries(translationContents ?? {})) {
|
|
278
311
|
for (const [key, item] of Object.entries(value)) {
|
|
279
312
|
const translationKey = buildTranslationKey(translation.id, scope, key);
|
|
280
|
-
|
|
313
|
+
values[translationKey] = item;
|
|
281
314
|
}
|
|
282
315
|
}
|
|
316
|
+
} catch (err) {
|
|
317
|
+
console.error('Failed to load translation from: ' + translationPath, err);
|
|
283
318
|
}
|
|
284
|
-
|
|
285
|
-
}
|
|
286
|
-
return
|
|
319
|
+
return values;
|
|
320
|
+
}));
|
|
321
|
+
return Object.assign({}, ...allTranslations);
|
|
287
322
|
}
|
|
288
323
|
|
|
289
324
|
function buildTranslationKey(pluginId: string, scope: string, key: string): string {
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
import * as path from 'path';
|
|
18
18
|
import * as express from '@theia/core/shared/express';
|
|
19
19
|
import * as escape_html from 'escape-html';
|
|
20
|
+
import { realpath } from 'fs/promises';
|
|
20
21
|
import { ILogger } from '@theia/core';
|
|
21
22
|
import { inject, injectable, optional, multiInject } from '@theia/core/shared/inversify';
|
|
22
23
|
import { BackendApplicationContribution } from '@theia/core/lib/node/backend-application';
|
|
@@ -93,11 +94,12 @@ export class HostedPluginReader implements BackendApplicationContribution {
|
|
|
93
94
|
if (!pluginPath) {
|
|
94
95
|
return undefined;
|
|
95
96
|
}
|
|
96
|
-
const
|
|
97
|
+
const resolvedPluginPath = await realpath(pluginPath);
|
|
98
|
+
const manifest = await loadManifest(resolvedPluginPath);
|
|
97
99
|
if (!manifest) {
|
|
98
100
|
return undefined;
|
|
99
101
|
}
|
|
100
|
-
manifest.packagePath =
|
|
102
|
+
manifest.packagePath = resolvedPluginPath;
|
|
101
103
|
return manifest;
|
|
102
104
|
}
|
|
103
105
|
|