@theia/plugin-ext-vscode 1.77.0-next.1 → 1.77.0-next.101
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/browser/plugin-vscode-commands-contribution.d.ts +6 -0
- package/lib/browser/plugin-vscode-commands-contribution.d.ts.map +1 -1
- package/lib/browser/plugin-vscode-commands-contribution.js +273 -258
- package/lib/browser/plugin-vscode-commands-contribution.js.map +1 -1
- package/lib/browser/plugin-vscode-commands-contribution.spec.js +210 -15
- package/lib/browser/plugin-vscode-commands-contribution.spec.js.map +1 -1
- package/lib/browser/plugin-vscode-contribution.js +11 -14
- package/lib/browser/plugin-vscode-contribution.js.map +1 -1
- package/lib/browser/plugin-vscode-frontend-module.js +12 -14
- package/lib/browser/plugin-vscode-frontend-module.js.map +1 -1
- package/lib/common/plugin-vscode-environment.js +12 -16
- package/lib/common/plugin-vscode-environment.js.map +1 -1
- package/lib/common/plugin-vscode-types.js +3 -6
- package/lib/common/plugin-vscode-types.js.map +1 -1
- package/lib/common/plugin-vscode-uri.js +5 -8
- package/lib/common/plugin-vscode-uri.js.map +1 -1
- package/lib/node/context/plugin-vscode-init-fe.d.ts +1 -2
- package/lib/node/context/plugin-vscode-init-fe.d.ts.map +1 -1
- package/lib/node/context/plugin-vscode-init-fe.js +3 -1
- package/lib/node/context/plugin-vscode-init-fe.js.map +1 -1
- package/lib/node/local-vsix-file-plugin-deployer-resolver.d.ts +1 -1
- package/lib/node/local-vsix-file-plugin-deployer-resolver.d.ts.map +1 -1
- package/lib/node/local-vsix-file-plugin-deployer-resolver.js +27 -34
- package/lib/node/local-vsix-file-plugin-deployer-resolver.js.map +1 -1
- package/lib/node/package.spec.d.ts +1 -0
- package/lib/node/package.spec.js +1 -0
- package/lib/node/plugin-vscode-backend-module.js +22 -24
- package/lib/node/plugin-vscode-backend-module.js.map +1 -1
- package/lib/node/plugin-vscode-cli-contribution.js +10 -13
- package/lib/node/plugin-vscode-cli-contribution.js.map +1 -1
- package/lib/node/plugin-vscode-deployer-participant.d.ts +1 -1
- package/lib/node/plugin-vscode-deployer-participant.d.ts.map +1 -1
- package/lib/node/plugin-vscode-deployer-participant.js +17 -22
- package/lib/node/plugin-vscode-deployer-participant.js.map +1 -1
- package/lib/node/plugin-vscode-directory-handler.js +23 -28
- package/lib/node/plugin-vscode-directory-handler.js.map +1 -1
- package/lib/node/plugin-vscode-file-handler.d.ts +1 -1
- package/lib/node/plugin-vscode-file-handler.d.ts.map +1 -1
- package/lib/node/plugin-vscode-file-handler.js +21 -27
- package/lib/node/plugin-vscode-file-handler.js.map +1 -1
- package/lib/node/plugin-vscode-init.d.ts.map +1 -1
- package/lib/node/plugin-vscode-init.js +12 -16
- package/lib/node/plugin-vscode-init.js.map +1 -1
- package/lib/node/plugin-vscode-init.spec.js +8 -10
- package/lib/node/plugin-vscode-init.spec.js.map +1 -1
- package/lib/node/plugin-vscode-utils.d.ts +1 -1
- package/lib/node/plugin-vscode-utils.d.ts.map +1 -1
- package/lib/node/plugin-vscode-utils.js +15 -24
- package/lib/node/plugin-vscode-utils.js.map +1 -1
- package/lib/node/scanner-vscode.js +19 -22
- package/lib/node/scanner-vscode.js.map +1 -1
- package/lib/node/scanner-vscode.spec.js +12 -14
- package/lib/node/scanner-vscode.spec.js.map +1 -1
- package/package.json +25 -17
- package/src/browser/plugin-vscode-commands-contribution.spec.ts +224 -1
- package/src/browser/plugin-vscode-commands-contribution.ts +97 -45
- package/src/browser/plugin-vscode-frontend-module.ts +3 -3
- package/src/node/context/plugin-vscode-init-fe.ts +2 -1
- package/src/node/local-vsix-file-plugin-deployer-resolver.ts +5 -9
- package/src/node/plugin-vscode-backend-module.ts +7 -7
- package/src/node/plugin-vscode-cli-contribution.ts +1 -1
- package/src/node/plugin-vscode-deployer-participant.ts +2 -2
- package/src/node/plugin-vscode-directory-handler.ts +1 -1
- package/src/node/plugin-vscode-file-handler.ts +3 -3
- package/src/node/plugin-vscode-init.spec.ts +1 -1
- package/src/node/plugin-vscode-init.ts +4 -3
- package/src/node/plugin-vscode-utils.ts +3 -3
- package/src/node/scanner-vscode.spec.ts +1 -1
- package/src/node/scanner-vscode.ts +2 -2
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import { Command, CommandContribution, CommandRegistry, environment, isOSX, CancellationTokenSource, MessageService, isArray, ILogger } from '@theia/core';
|
|
17
|
+
import { Command, CommandContribution, CommandRegistry, environment, isOSX, CancellationTokenSource, MessageService, isArray, ILogger, MEMORY_TEXT_READONLY } from '@theia/core';
|
|
18
18
|
import {
|
|
19
19
|
ApplicationShell,
|
|
20
20
|
CommonCommands,
|
|
@@ -53,7 +53,7 @@ import { DiffService } from '@theia/workspace/lib/browser/diff-service';
|
|
|
53
53
|
import { inject, injectable, optional, named } from '@theia/core/shared/inversify';
|
|
54
54
|
import { Position } from '@theia/plugin-ext/lib/common/plugin-api-rpc';
|
|
55
55
|
import { URI } from '@theia/core/shared/vscode-uri';
|
|
56
|
-
import { PluginDeployOptions, PluginIdentifiers, PluginServer } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
56
|
+
import { DuplicateExtensionError, PluginDeployOptions, PluginIdentifiers, PluginServer } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
57
57
|
import { TerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
|
|
58
58
|
import { QuickOpenWorkspace } from '@theia/workspace/lib/browser/quick-open-workspace';
|
|
59
59
|
import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
|
|
@@ -78,13 +78,31 @@ import { CustomEditorOpener } from '@theia/plugin-ext/lib/main/browser/custom-ed
|
|
|
78
78
|
import { nls } from '@theia/core/lib/common/nls';
|
|
79
79
|
import { WindowService } from '@theia/core/lib/browser/window/window-service';
|
|
80
80
|
import * as monaco from '@theia/monaco-editor-core';
|
|
81
|
-
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri';
|
|
81
|
+
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri.js';
|
|
82
82
|
import { CodeEditorWidgetUtil } from '@theia/plugin-ext/lib/main/browser/menus/vscode-theia-menu-mappings';
|
|
83
83
|
import { OutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution';
|
|
84
84
|
import { CompletionList, Range, Position as PluginPosition } from '@theia/plugin';
|
|
85
85
|
import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages';
|
|
86
86
|
import { ScmContribution } from '@theia/scm/lib/browser/scm-contribution';
|
|
87
|
+
import { ScmService } from '@theia/scm/lib/browser/scm-service';
|
|
87
88
|
import { MergeEditorOpenerOptions, MergeEditorUri } from '@theia/scm/lib/browser/merge-editor/merge-editor';
|
|
89
|
+
import { MultiDiffEditorOpenerOptions, MultiDiffEditorUri } from '@theia/scm/lib/browser/multi-diff-editor/multi-diff-editor';
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Convert a VS Code {@link UriComponents} or a string URI into a Theia {@link TheiaURI}.
|
|
93
|
+
* Returns `undefined` when given `undefined`.
|
|
94
|
+
*/
|
|
95
|
+
function toTheiaUri(value: UriComponents | string): TheiaURI;
|
|
96
|
+
function toTheiaUri(value: UriComponents | string | undefined): TheiaURI | undefined;
|
|
97
|
+
function toTheiaUri(value: UriComponents | string | undefined): TheiaURI | undefined {
|
|
98
|
+
if (value === undefined) {
|
|
99
|
+
return undefined;
|
|
100
|
+
}
|
|
101
|
+
if (typeof value === 'string') {
|
|
102
|
+
return new TheiaURI(value);
|
|
103
|
+
}
|
|
104
|
+
return TheiaURI.fromComponents(value);
|
|
105
|
+
}
|
|
88
106
|
|
|
89
107
|
export namespace VscodeCommands {
|
|
90
108
|
|
|
@@ -287,6 +305,8 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
287
305
|
protected monacoLanguages: MonacoLanguages;
|
|
288
306
|
@inject(ScmContribution)
|
|
289
307
|
protected scmContribution: ScmContribution;
|
|
308
|
+
@inject(ScmService)
|
|
309
|
+
protected readonly scmService: ScmService;
|
|
290
310
|
|
|
291
311
|
@inject(ILogger) @named('plugin-ext-vscode:PluginVscodeCommandsContribution')
|
|
292
312
|
protected readonly logger: ILogger;
|
|
@@ -578,14 +598,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
578
598
|
commands.registerCommand(VscodeCommands.INSTALL_EXTENSION_FROM_ID_OR_URI, {
|
|
579
599
|
execute: async (vsixUriOrExtensionId: TheiaURI | UriComponents | string) => {
|
|
580
600
|
if (typeof vsixUriOrExtensionId === 'string') {
|
|
581
|
-
|
|
582
|
-
let opts: PluginDeployOptions | undefined;
|
|
583
|
-
const versionedId = PluginIdentifiers.idAndVersionFromVersionedId(vsixUriOrExtensionId);
|
|
584
|
-
if (versionedId) {
|
|
585
|
-
extensionId = versionedId.id;
|
|
586
|
-
opts = { version: versionedId.version, ignoreOtherVersions: true };
|
|
587
|
-
}
|
|
588
|
-
await this.pluginServer.install(VSCodeExtensionUri.fromId(extensionId).toString(), undefined, opts);
|
|
601
|
+
await this.installExtensionFromId(vsixUriOrExtensionId);
|
|
589
602
|
} else {
|
|
590
603
|
await this.deployPlugin(vsixUriOrExtensionId);
|
|
591
604
|
}
|
|
@@ -647,7 +660,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
647
660
|
return (resourceUri && resourceUri.toString()) === uriString;
|
|
648
661
|
});
|
|
649
662
|
}
|
|
650
|
-
const toClose = this.shell.widgets.filter(widget => widget !== editor && CodeEditorWidgetUtil.is(widget));
|
|
663
|
+
const toClose = this.shell.widgets.filter(widget => widget !== editor && CodeEditorWidgetUtil.is(widget) && widget.title.closable);
|
|
651
664
|
await this.shell.closeMany(toClose);
|
|
652
665
|
}
|
|
653
666
|
});
|
|
@@ -655,7 +668,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
655
668
|
const performActionOnGroup = (
|
|
656
669
|
cb: (
|
|
657
670
|
tabBarOrArea: TabBar<Widget> | ApplicationShell.Area,
|
|
658
|
-
filter
|
|
671
|
+
filter: (title: Title<Widget>, index: number) => boolean
|
|
659
672
|
) => void,
|
|
660
673
|
uri?: monaco.Uri
|
|
661
674
|
): void => {
|
|
@@ -679,13 +692,16 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
679
692
|
id: 'workbench.action.closeEditorsInGroup',
|
|
680
693
|
label: nls.localizeByDefault('Close All Editors in Group')
|
|
681
694
|
}, {
|
|
682
|
-
execute: (uri?: monaco.Uri) => performActionOnGroup(
|
|
695
|
+
execute: (uri?: monaco.Uri) => performActionOnGroup(
|
|
696
|
+
(tabBar, filter) => this.shell.closeTabs(tabBar, (title, index) => title.closable && filter(title, index)),
|
|
697
|
+
uri
|
|
698
|
+
)
|
|
683
699
|
});
|
|
684
700
|
commands.registerCommand({
|
|
685
701
|
id: 'workbench.files.saveAllInGroup',
|
|
686
702
|
label: nls.localizeByDefault('Save All in Group')
|
|
687
703
|
}, {
|
|
688
|
-
execute: (uri?: monaco.Uri) => performActionOnGroup(this.shell.saveTabs, uri)
|
|
704
|
+
execute: (uri?: monaco.Uri) => performActionOnGroup((tabBar, filter) => this.shell.saveTabs(tabBar, filter), uri)
|
|
689
705
|
});
|
|
690
706
|
commands.registerCommand({ id: 'workbench.action.closeEditorsInOtherGroups' }, {
|
|
691
707
|
execute: () => {
|
|
@@ -695,7 +711,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
695
711
|
for (const tabBar of this.shell.allTabBars) {
|
|
696
712
|
if (tabBar !== editorTabBar) {
|
|
697
713
|
this.shell.closeTabs(tabBar,
|
|
698
|
-
({ owner }) => CodeEditorWidgetUtil.is(owner)
|
|
714
|
+
({ owner, closable }) => closable && CodeEditorWidgetUtil.is(owner)
|
|
699
715
|
);
|
|
700
716
|
}
|
|
701
717
|
}
|
|
@@ -710,12 +726,12 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
710
726
|
if (tabBar) {
|
|
711
727
|
let left = true;
|
|
712
728
|
this.shell.closeTabs(tabBar,
|
|
713
|
-
({ owner }) => {
|
|
729
|
+
({ owner, closable }) => {
|
|
714
730
|
if (owner === editor) {
|
|
715
731
|
left = false;
|
|
716
732
|
return false;
|
|
717
733
|
}
|
|
718
|
-
return left && CodeEditorWidgetUtil.is(owner);
|
|
734
|
+
return left && closable && CodeEditorWidgetUtil.is(owner);
|
|
719
735
|
}
|
|
720
736
|
);
|
|
721
737
|
}
|
|
@@ -730,12 +746,12 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
730
746
|
if (tabBar) {
|
|
731
747
|
let left = true;
|
|
732
748
|
this.shell.closeTabs(tabBar,
|
|
733
|
-
({ owner }) => {
|
|
749
|
+
({ owner, closable }) => {
|
|
734
750
|
if (owner === editor) {
|
|
735
751
|
left = false;
|
|
736
752
|
return false;
|
|
737
753
|
}
|
|
738
|
-
return !left && CodeEditorWidgetUtil.is(owner);
|
|
754
|
+
return !left && closable && CodeEditorWidgetUtil.is(owner);
|
|
739
755
|
}
|
|
740
756
|
);
|
|
741
757
|
}
|
|
@@ -744,7 +760,7 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
744
760
|
});
|
|
745
761
|
commands.registerCommand({ id: 'workbench.action.closeAllEditors' }, {
|
|
746
762
|
execute: async () => {
|
|
747
|
-
const toClose = this.shell.widgets.filter(widget => CodeEditorWidgetUtil.is(widget));
|
|
763
|
+
const toClose = this.shell.widgets.filter(widget => CodeEditorWidgetUtil.is(widget) && widget.title.closable);
|
|
748
764
|
await this.shell.closeMany(toClose);
|
|
749
765
|
}
|
|
750
766
|
});
|
|
@@ -1283,13 +1299,6 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
1283
1299
|
|
|
1284
1300
|
commands.registerCommand({ id: '_open.mergeEditor' }, {
|
|
1285
1301
|
execute: async (arg: OpenMergeEditorCommandArg): Promise<void> => {
|
|
1286
|
-
const toTheiaUri = (o: UriComponents | string): TheiaURI => {
|
|
1287
|
-
if (typeof o === 'string') {
|
|
1288
|
-
return new TheiaURI(o);
|
|
1289
|
-
}
|
|
1290
|
-
return TheiaURI.fromComponents(o);
|
|
1291
|
-
};
|
|
1292
|
-
|
|
1293
1302
|
const baseUri = toTheiaUri(arg.base);
|
|
1294
1303
|
const resultUri = toTheiaUri(arg.output);
|
|
1295
1304
|
const side1Uri = typeof arg.input1 === 'string' ? toTheiaUri(arg.input1) : toTheiaUri(arg.input1.uri);
|
|
@@ -1312,36 +1321,79 @@ export class PluginVscodeCommandsContribution implements CommandContribution {
|
|
|
1312
1321
|
}
|
|
1313
1322
|
});
|
|
1314
1323
|
|
|
1315
|
-
|
|
1316
|
-
|
|
1324
|
+
commands.registerCommand({ id: '_workbench.openScmMultiDiffEditor' }, {
|
|
1325
|
+
execute: async (options: { title: string; repositoryUri: UriComponents; resourceGroupId: string }): Promise<void> => {
|
|
1326
|
+
const repositoryUri = toTheiaUri(options.repositoryUri);
|
|
1327
|
+
if (!repositoryUri) {
|
|
1328
|
+
return;
|
|
1329
|
+
}
|
|
1330
|
+
const repository = this.scmService.repositories.find(repo => new TheiaURI(repo.provider.rootUri).isEqual(repositoryUri));
|
|
1331
|
+
const group = repository?.provider.groups.find(candidate => candidate.id === options.resourceGroupId);
|
|
1332
|
+
if (!group) {
|
|
1333
|
+
return;
|
|
1334
|
+
}
|
|
1335
|
+
await commands.executeCommand('_workbench.openMultiDiffEditor', {
|
|
1336
|
+
title: options.title,
|
|
1337
|
+
resources: group.resources.map(resource => ({
|
|
1338
|
+
originalUri: resource.multiDiffEditorOriginalUri?.toComponents(),
|
|
1339
|
+
modifiedUri: resource.multiDiffEditorModifiedUri?.toComponents()
|
|
1340
|
+
}))
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
});
|
|
1344
|
+
|
|
1317
1345
|
commands.registerCommand({ id: '_workbench.openMultiDiffEditor' }, {
|
|
1318
1346
|
execute: async (options: {
|
|
1319
1347
|
title: string;
|
|
1320
|
-
resources?: { originalUri
|
|
1348
|
+
resources?: { originalUri?: UriComponents; modifiedUri?: UriComponents }[];
|
|
1321
1349
|
reveal?: { modifiedUri: UriComponents };
|
|
1322
1350
|
}): Promise<void> => {
|
|
1323
1351
|
if (!options.resources?.length) {
|
|
1324
1352
|
return;
|
|
1325
1353
|
}
|
|
1326
|
-
const
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1354
|
+
const resources = options.resources
|
|
1355
|
+
.map(r => {
|
|
1356
|
+
const originalUri = toTheiaUri(r.originalUri);
|
|
1357
|
+
const modifiedUri = toTheiaUri(r.modifiedUri);
|
|
1358
|
+
const resourceUri = modifiedUri ?? originalUri;
|
|
1359
|
+
if (!resourceUri) {
|
|
1360
|
+
return undefined;
|
|
1361
|
+
}
|
|
1362
|
+
const emptyUri = new TheiaURI().withScheme(MEMORY_TEXT_READONLY).withPath(resourceUri.path);
|
|
1363
|
+
return { originalUri: originalUri ?? emptyUri, modifiedUri: modifiedUri ?? emptyUri };
|
|
1364
|
+
})
|
|
1365
|
+
.filter((r): r is { originalUri: TheiaURI; modifiedUri: TheiaURI } => r !== undefined);
|
|
1366
|
+
if (!resources.length) {
|
|
1367
|
+
return;
|
|
1340
1368
|
}
|
|
1369
|
+
const uri = MultiDiffEditorUri.encode({ title: options.title, resources });
|
|
1370
|
+
const reveal = toTheiaUri(options.reveal?.modifiedUri);
|
|
1371
|
+
const openerOptions: MultiDiffEditorOpenerOptions = { reveal };
|
|
1372
|
+
await open(this.openerService, uri, openerOptions);
|
|
1341
1373
|
},
|
|
1342
1374
|
});
|
|
1343
1375
|
}
|
|
1344
1376
|
|
|
1377
|
+
/**
|
|
1378
|
+
* Installs an extension by its (optionally versioned) ID. Installing an extension that is already installed is a noop.
|
|
1379
|
+
*/
|
|
1380
|
+
protected async installExtensionFromId(extensionIdOrVersionedId: string): Promise<void> {
|
|
1381
|
+
let extensionId = extensionIdOrVersionedId;
|
|
1382
|
+
let opts: PluginDeployOptions | undefined;
|
|
1383
|
+
const versionedId = PluginIdentifiers.idAndVersionFromVersionedId(extensionIdOrVersionedId);
|
|
1384
|
+
if (versionedId) {
|
|
1385
|
+
extensionId = versionedId.id;
|
|
1386
|
+
opts = { version: versionedId.version, ignoreOtherVersions: true };
|
|
1387
|
+
}
|
|
1388
|
+
try {
|
|
1389
|
+
await this.pluginServer.install(VSCodeExtensionUri.fromId(extensionId).toString(), undefined, opts);
|
|
1390
|
+
} catch (e) {
|
|
1391
|
+
if (!DuplicateExtensionError.is(e)) {
|
|
1392
|
+
throw e;
|
|
1393
|
+
}
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
|
|
1345
1397
|
private async deployPlugin(uri: TheiaURI | UriComponents): Promise<void> {
|
|
1346
1398
|
const uriPath = isUriComponents(uri) ? URI.revive(uri).fsPath : await this.fileService.fsPath(uri);
|
|
1347
1399
|
return this.pluginServer.install(`local-file:${uriPath}`);
|
|
@@ -16,9 +16,9 @@
|
|
|
16
16
|
|
|
17
17
|
import { ContainerModule } from '@theia/core/shared/inversify';
|
|
18
18
|
import { CommandContribution } from '@theia/core';
|
|
19
|
-
import { PluginVscodeCommandsContribution } from './plugin-vscode-commands-contribution';
|
|
20
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
21
|
-
import { PluginVSCodeContribution } from './plugin-vscode-contribution';
|
|
19
|
+
import { PluginVscodeCommandsContribution } from './plugin-vscode-commands-contribution.js';
|
|
20
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
21
|
+
import { PluginVSCodeContribution } from './plugin-vscode-contribution.js';
|
|
22
22
|
import { FileServiceContribution } from '@theia/filesystem/lib/browser/file-service';
|
|
23
23
|
|
|
24
24
|
export default new ContainerModule(bind => {
|
|
@@ -14,8 +14,9 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
+
// The scope of the plugin worker, which loads this script with `importScripts`.
|
|
17
18
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
-
const _scope = (
|
|
19
|
+
const _scope = (self as any);
|
|
19
20
|
_scope.exports = {};
|
|
20
21
|
|
|
21
22
|
const _getModule = () => {
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
import * as path from 'path';
|
|
18
18
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
19
|
-
import { PluginDeployerResolverContext, PluginIdentifiers } from '@theia/plugin-ext';
|
|
19
|
+
import { DuplicateExtensionError, PluginDeployerResolverContext, PluginIdentifiers } from '@theia/plugin-ext';
|
|
20
20
|
import { LocalPluginDeployerResolver } from '@theia/plugin-ext/lib/main/node/resolvers/local-plugin-deployer-resolver';
|
|
21
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
22
|
-
import { isVSCodePluginFile } from './plugin-vscode-file-handler';
|
|
23
|
-
import { existsInDeploymentDir, unpackToDeploymentDir, extractExtensionIdentityFromVsix } from './plugin-vscode-utils';
|
|
21
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
22
|
+
import { isVSCodePluginFile } from './plugin-vscode-file-handler.js';
|
|
23
|
+
import { existsInDeploymentDir, unpackToDeploymentDir, extractExtensionIdentityFromVsix } from './plugin-vscode-utils.js';
|
|
24
24
|
import { ILogger } from '@theia/core';
|
|
25
25
|
|
|
26
26
|
@injectable()
|
|
@@ -68,11 +68,7 @@ export class LocalVSIXFilePluginDeployerResolver extends LocalPluginDeployerReso
|
|
|
68
68
|
// Check if the deployment directory already exists on disk
|
|
69
69
|
if (await existsInDeploymentDir(this.environment, versionedId)) {
|
|
70
70
|
const unversionedId = PluginIdentifiers.componentsToUnversionedId(components);
|
|
71
|
-
|
|
72
|
-
`Extension ${unversionedId} is already installed (version: ${components.version}).`
|
|
73
|
-
);
|
|
74
|
-
error.name = 'DuplicateExtensionError';
|
|
75
|
-
throw error;
|
|
71
|
+
throw DuplicateExtensionError.create(`Extension ${unversionedId} is already installed (version: ${components.version}).`);
|
|
76
72
|
}
|
|
77
73
|
|
|
78
74
|
const extensionDeploymentDir = await unpackToDeploymentDir(this.environment, localPath, versionedId);
|
|
@@ -18,15 +18,15 @@ import { ContainerModule } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import {
|
|
19
19
|
PluginDeployerFileHandler, PluginDeployerDirectoryHandler, PluginScanner, PluginDeployerParticipant, PluginDeployerResolver
|
|
20
20
|
} from '@theia/plugin-ext';
|
|
21
|
-
import { PluginVsCodeFileHandler } from './plugin-vscode-file-handler';
|
|
22
|
-
import { PluginVsCodeDirectoryHandler } from './plugin-vscode-directory-handler';
|
|
23
|
-
import { VsCodePluginScanner } from './scanner-vscode';
|
|
24
|
-
import { PluginVsCodeCliContribution } from './plugin-vscode-cli-contribution';
|
|
21
|
+
import { PluginVsCodeFileHandler } from './plugin-vscode-file-handler.js';
|
|
22
|
+
import { PluginVsCodeDirectoryHandler } from './plugin-vscode-directory-handler.js';
|
|
23
|
+
import { VsCodePluginScanner } from './scanner-vscode.js';
|
|
24
|
+
import { PluginVsCodeCliContribution } from './plugin-vscode-cli-contribution.js';
|
|
25
25
|
import { CliContribution } from '@theia/core/lib/node';
|
|
26
26
|
import { PluginHostEnvironmentVariable } from '@theia/plugin-ext/lib/common';
|
|
27
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
28
|
-
import { PluginVSCodeDeployerParticipant } from './plugin-vscode-deployer-participant';
|
|
29
|
-
import { LocalVSIXFilePluginDeployerResolver } from './local-vsix-file-plugin-deployer-resolver';
|
|
27
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
28
|
+
import { PluginVSCodeDeployerParticipant } from './plugin-vscode-deployer-participant.js';
|
|
29
|
+
import { LocalVSIXFilePluginDeployerResolver } from './local-vsix-file-plugin-deployer-resolver.js';
|
|
30
30
|
|
|
31
31
|
export default new ContainerModule(bind => {
|
|
32
32
|
bind(PluginVSCodeEnvironment).toSelf().inSingletonScope();
|
|
@@ -18,7 +18,7 @@ import { injectable } from '@theia/core/shared/inversify';
|
|
|
18
18
|
import { Argv, Arguments } from '@theia/core/shared/yargs';
|
|
19
19
|
import { CliContribution } from '@theia/core/lib/node/cli';
|
|
20
20
|
import { PluginHostEnvironmentVariable } from '@theia/plugin-ext/lib/common';
|
|
21
|
-
import { VSCODE_DEFAULT_API_VERSION } from '../common/plugin-vscode-types';
|
|
21
|
+
import { VSCODE_DEFAULT_API_VERSION } from '../common/plugin-vscode-types.js';
|
|
22
22
|
import { Deferred } from '@theia/core/lib/common/promise-util';
|
|
23
23
|
|
|
24
24
|
/**
|
|
@@ -17,9 +17,9 @@
|
|
|
17
17
|
import { injectable, inject, named } from '@theia/core/shared/inversify';
|
|
18
18
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
19
19
|
import { FileUri } from '@theia/core/lib/node';
|
|
20
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
20
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
21
21
|
import { PluginDeployerParticipant, PluginDeployerStartContext } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
22
|
-
import { LocalVSIXFilePluginDeployerResolver } from './local-vsix-file-plugin-deployer-resolver';
|
|
22
|
+
import { LocalVSIXFilePluginDeployerResolver } from './local-vsix-file-plugin-deployer-resolver.js';
|
|
23
23
|
import { ILogger } from '@theia/core';
|
|
24
24
|
|
|
25
25
|
@injectable()
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
PluginDeployerEntryType, PluginPackage, PluginIdentifiers
|
|
25
25
|
} from '@theia/plugin-ext';
|
|
26
26
|
import { PluginCliContribution } from '@theia/plugin-ext/lib/main/node/plugin-cli-contribution';
|
|
27
|
-
import { TMP_DIR_PREFIX } from './plugin-vscode-utils';
|
|
27
|
+
import { TMP_DIR_PREFIX } from './plugin-vscode-utils.js';
|
|
28
28
|
|
|
29
29
|
/** Fields read while resolving a VS Code extension directory */
|
|
30
30
|
type PluginPackageResolveInput = Partial<Pick<PluginPackage, 'name' | 'version' | 'publisher' | 'engines'>>;
|
|
@@ -15,12 +15,12 @@
|
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
17
|
import { PluginDeployerFileHandler, PluginDeployerEntry, PluginDeployerFileHandlerContext } from '@theia/plugin-ext';
|
|
18
|
-
import
|
|
18
|
+
import filenamify from 'filenamify';
|
|
19
19
|
import { inject, injectable, named } from '@theia/core/shared/inversify';
|
|
20
20
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
21
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
21
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
22
22
|
import { FileUri } from '@theia/core/lib/common/file-uri';
|
|
23
|
-
import { unpackToDeploymentDir } from './plugin-vscode-utils';
|
|
23
|
+
import { unpackToDeploymentDir } from './plugin-vscode-utils.js';
|
|
24
24
|
import { ILogger } from '@theia/core';
|
|
25
25
|
|
|
26
26
|
export const isVSCodePluginFile = (pluginPath?: string) => Boolean(pluginPath && (pluginPath.endsWith('.vsix') || pluginPath.endsWith('.tgz')));
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
import { expect } from 'chai';
|
|
20
20
|
import * as path from 'path';
|
|
21
21
|
import { Plugin } from '@theia/plugin-ext';
|
|
22
|
-
import { findPlugin } from './plugin-vscode-init';
|
|
22
|
+
import { findPlugin } from './plugin-vscode-init.js';
|
|
23
23
|
|
|
24
24
|
const PLUGIN_A_FOLDER = path.join(path.sep, 'p', 'sample-namespace.plugin-esm');
|
|
25
25
|
const PLUGIN_B_FOLDER = path.join(path.sep, 'p', 'sample-namespace.plugin-esm-mjs');
|
|
@@ -16,11 +16,11 @@
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
18
18
|
|
|
19
|
-
import { register } from 'node:module';
|
|
19
|
+
import Module, { register } from 'node:module';
|
|
20
20
|
import * as theia from '@theia/plugin';
|
|
21
21
|
import { isEqualOrParent } from '@theia/core/lib/common/paths';
|
|
22
22
|
import { BackendInitializationFn, PluginAPIFactory, Plugin, emptyPlugin } from '@theia/plugin-ext';
|
|
23
|
-
import { VSCODE_DEFAULT_API_VERSION } from '../common/plugin-vscode-types';
|
|
23
|
+
import { VSCODE_DEFAULT_API_VERSION } from '../common/plugin-vscode-types.js';
|
|
24
24
|
|
|
25
25
|
process.env['VSCODE_PID'] = process.env['THEIA_PARENT_PID'];
|
|
26
26
|
|
|
@@ -50,7 +50,8 @@ function createVSCodeAPI(apiFactory: PluginAPIFactory, plugin: Plugin): typeof t
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
function overrideInternalLoad(): void {
|
|
53
|
-
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
+
const module: any = Module;
|
|
54
55
|
const vscodeModuleName = 'vscode';
|
|
55
56
|
// save original load method
|
|
56
57
|
const internalLoad = module._load;
|
|
@@ -14,12 +14,12 @@
|
|
|
14
14
|
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
15
|
// *****************************************************************************
|
|
16
16
|
|
|
17
|
-
import
|
|
17
|
+
import decompress from 'decompress';
|
|
18
18
|
import * as path from 'path';
|
|
19
|
-
import
|
|
19
|
+
import filenamify from 'filenamify';
|
|
20
20
|
import { FileUri } from '@theia/core/lib/node';
|
|
21
21
|
import * as fs from '@theia/core/shared/fs-extra';
|
|
22
|
-
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment';
|
|
22
|
+
import { PluginVSCodeEnvironment } from '../common/plugin-vscode-environment.js';
|
|
23
23
|
import { PluginIdentifiers, PluginPackage } from '@theia/plugin-ext/lib/common/plugin-protocol';
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -20,7 +20,7 @@ import { expect } from 'chai';
|
|
|
20
20
|
import * as os from 'os';
|
|
21
21
|
import * as path from 'path';
|
|
22
22
|
import * as fs from 'fs';
|
|
23
|
-
import { VsCodePluginScanner } from './scanner-vscode';
|
|
23
|
+
import { VsCodePluginScanner } from './scanner-vscode.js';
|
|
24
24
|
import { PluginPackage } from '@theia/plugin-ext';
|
|
25
25
|
import URI from '@theia/core/lib/common/uri';
|
|
26
26
|
|
|
@@ -19,7 +19,7 @@ import { injectable } from '@theia/core/shared/inversify';
|
|
|
19
19
|
import { PluginScanner, PluginEngine, PluginPackage, PluginModel, PluginLifecycle, PluginIdentifiers, UIKind } from '@theia/plugin-ext';
|
|
20
20
|
import { TheiaPluginScanner } from '@theia/plugin-ext/lib/hosted/node/scanners/scanner-theia';
|
|
21
21
|
import { environment } from '@theia/core/shared/@theia/application-package/lib/environment';
|
|
22
|
-
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri';
|
|
22
|
+
import { VSCodeExtensionUri } from '../common/plugin-vscode-uri.js';
|
|
23
23
|
import { buildLifecycle, buildModelForVsCode } from '@theia/plugin-utils/lib/common/plugin-model';
|
|
24
24
|
|
|
25
25
|
const uiKind = environment.electron.is() ? UIKind.Desktop : UIKind.Web;
|
|
@@ -64,7 +64,7 @@ export class VsCodePluginScanner extends TheiaPluginScanner implements PluginSca
|
|
|
64
64
|
override getLifecycle(plugin: PluginPackage): PluginLifecycle {
|
|
65
65
|
return {
|
|
66
66
|
...buildLifecycle(plugin, 'vscode'),
|
|
67
|
-
backendInitPath: path.join(
|
|
67
|
+
backendInitPath: path.join(import.meta.dirname, 'plugin-vscode-init'),
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
|