@theia/plugin-ext-vscode 1.77.0-next.0 → 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.
Files changed (69) hide show
  1. package/lib/browser/plugin-vscode-commands-contribution.d.ts +6 -0
  2. package/lib/browser/plugin-vscode-commands-contribution.d.ts.map +1 -1
  3. package/lib/browser/plugin-vscode-commands-contribution.js +273 -258
  4. package/lib/browser/plugin-vscode-commands-contribution.js.map +1 -1
  5. package/lib/browser/plugin-vscode-commands-contribution.spec.js +210 -15
  6. package/lib/browser/plugin-vscode-commands-contribution.spec.js.map +1 -1
  7. package/lib/browser/plugin-vscode-contribution.js +11 -14
  8. package/lib/browser/plugin-vscode-contribution.js.map +1 -1
  9. package/lib/browser/plugin-vscode-frontend-module.js +12 -14
  10. package/lib/browser/plugin-vscode-frontend-module.js.map +1 -1
  11. package/lib/common/plugin-vscode-environment.js +12 -16
  12. package/lib/common/plugin-vscode-environment.js.map +1 -1
  13. package/lib/common/plugin-vscode-types.js +3 -6
  14. package/lib/common/plugin-vscode-types.js.map +1 -1
  15. package/lib/common/plugin-vscode-uri.js +5 -8
  16. package/lib/common/plugin-vscode-uri.js.map +1 -1
  17. package/lib/node/context/plugin-vscode-init-fe.d.ts +1 -2
  18. package/lib/node/context/plugin-vscode-init-fe.d.ts.map +1 -1
  19. package/lib/node/context/plugin-vscode-init-fe.js +3 -1
  20. package/lib/node/context/plugin-vscode-init-fe.js.map +1 -1
  21. package/lib/node/local-vsix-file-plugin-deployer-resolver.d.ts +1 -1
  22. package/lib/node/local-vsix-file-plugin-deployer-resolver.d.ts.map +1 -1
  23. package/lib/node/local-vsix-file-plugin-deployer-resolver.js +27 -34
  24. package/lib/node/local-vsix-file-plugin-deployer-resolver.js.map +1 -1
  25. package/lib/node/package.spec.d.ts +1 -0
  26. package/lib/node/package.spec.js +1 -0
  27. package/lib/node/plugin-vscode-backend-module.js +22 -24
  28. package/lib/node/plugin-vscode-backend-module.js.map +1 -1
  29. package/lib/node/plugin-vscode-cli-contribution.js +10 -13
  30. package/lib/node/plugin-vscode-cli-contribution.js.map +1 -1
  31. package/lib/node/plugin-vscode-deployer-participant.d.ts +1 -1
  32. package/lib/node/plugin-vscode-deployer-participant.d.ts.map +1 -1
  33. package/lib/node/plugin-vscode-deployer-participant.js +17 -22
  34. package/lib/node/plugin-vscode-deployer-participant.js.map +1 -1
  35. package/lib/node/plugin-vscode-directory-handler.js +23 -28
  36. package/lib/node/plugin-vscode-directory-handler.js.map +1 -1
  37. package/lib/node/plugin-vscode-file-handler.d.ts +1 -1
  38. package/lib/node/plugin-vscode-file-handler.d.ts.map +1 -1
  39. package/lib/node/plugin-vscode-file-handler.js +21 -27
  40. package/lib/node/plugin-vscode-file-handler.js.map +1 -1
  41. package/lib/node/plugin-vscode-init.d.ts.map +1 -1
  42. package/lib/node/plugin-vscode-init.js +12 -16
  43. package/lib/node/plugin-vscode-init.js.map +1 -1
  44. package/lib/node/plugin-vscode-init.spec.js +8 -10
  45. package/lib/node/plugin-vscode-init.spec.js.map +1 -1
  46. package/lib/node/plugin-vscode-utils.d.ts +1 -1
  47. package/lib/node/plugin-vscode-utils.d.ts.map +1 -1
  48. package/lib/node/plugin-vscode-utils.js +15 -24
  49. package/lib/node/plugin-vscode-utils.js.map +1 -1
  50. package/lib/node/scanner-vscode.js +19 -22
  51. package/lib/node/scanner-vscode.js.map +1 -1
  52. package/lib/node/scanner-vscode.spec.js +12 -14
  53. package/lib/node/scanner-vscode.spec.js.map +1 -1
  54. package/package.json +25 -17
  55. package/src/browser/plugin-vscode-commands-contribution.spec.ts +224 -1
  56. package/src/browser/plugin-vscode-commands-contribution.ts +97 -45
  57. package/src/browser/plugin-vscode-frontend-module.ts +3 -3
  58. package/src/node/context/plugin-vscode-init-fe.ts +2 -1
  59. package/src/node/local-vsix-file-plugin-deployer-resolver.ts +5 -9
  60. package/src/node/plugin-vscode-backend-module.ts +7 -7
  61. package/src/node/plugin-vscode-cli-contribution.ts +1 -1
  62. package/src/node/plugin-vscode-deployer-participant.ts +2 -2
  63. package/src/node/plugin-vscode-directory-handler.ts +1 -1
  64. package/src/node/plugin-vscode-file-handler.ts +3 -3
  65. package/src/node/plugin-vscode-init.spec.ts +1 -1
  66. package/src/node/plugin-vscode-init.ts +4 -3
  67. package/src/node/plugin-vscode-utils.ts +3 -3
  68. package/src/node/scanner-vscode.spec.ts +1 -1
  69. package/src/node/scanner-vscode.ts +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"scanner-vscode.js","sourceRoot":"","sources":["../../src/node/scanner-vscode.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,wCAAwC;AACxC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,6BAA6B;AAC7B,4DAA0D;AAC1D,kDAAwI;AACxI,4FAA8F;AAC9F,+FAA4F;AAC5F,mEAAiE;AACjE,8EAAkG;AAElG,MAAM,MAAM,GAAG,yBAAW,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,mBAAM,CAAC,OAAO,CAAC,CAAC,CAAC,mBAAM,CAAC,GAAG,CAAC;AAGhE,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,kCAAkB;IAApD;;QAEc,gBAAW,GAAiB,QAAQ,CAAC;IAyC1D,CAAC;IAvCG,IAAa,OAAO;QAChB,OAAO,IAAI,CAAC,WAAW,CAAC;IAC5B,CAAC;IAEQ,QAAQ,CAAC,MAAqB;QACnC,MAAM,MAAM,GAAG,IAAA,kCAAmB,EAAC;YAC/B,GAAG,MAAM;YACT,SAAS,EAAE,MAAM,CAAC,SAAS,IAAI,8BAAiB,CAAC,WAAW;YAC5D,UAAU,EAAE,IAAI,CAAC,gBAAgB,CA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EAAE,oBAAoB,CAAC;SACxE,CAAC;IACN,CAAC;CAEJ,CAAA;AA3CY,mBAAmB;IAD/B,UAAU,EAAE;GACA,mBAAmB,CA2C/B"}
@@ -1,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2026 EclipseSource and others.
4
3
  //
@@ -14,14 +13,13 @@
14
13
  //
15
14
  // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16
15
  // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
16
  /* eslint-disable @typescript-eslint/no-explicit-any */
19
- const chai_1 = require("chai");
20
- const os = require("os");
21
- const path = require("path");
22
- const fs = require("fs");
23
- const scanner_vscode_1 = require("./scanner-vscode");
24
- const uri_1 = require("@theia/core/lib/common/uri");
17
+ import { expect } from 'chai';
18
+ import * as os from 'os';
19
+ import * as path from 'path';
20
+ import * as fs from 'fs';
21
+ import { VsCodePluginScanner } from './scanner-vscode.js';
22
+ import URI from '@theia/core/lib/common/uri';
25
23
  function createVsCodePluginPackage(capabilities, packagePath) {
26
24
  return {
27
25
  name: 'test-vscode-plugin',
@@ -39,10 +37,10 @@ describe('VsCodePluginScanner', () => {
39
37
  let scanner;
40
38
  let tmpDir;
41
39
  before(() => {
42
- scanner = new scanner_vscode_1.VsCodePluginScanner();
40
+ scanner = new VsCodePluginScanner();
43
41
  // Inject a mock pluginUriFactory
44
42
  scanner.pluginUriFactory = {
45
- createUri: (_pkg, _relativePath) => new uri_1.default('file:///dummy')
43
+ createUri: (_pkg, _relativePath) => new URI('file:///dummy')
46
44
  };
47
45
  // Create a real temp directory so readdirSync in getLicenseUrl/getReadmeUrl works
48
46
  tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), 'scanner-vscode-test-'));
@@ -55,26 +53,26 @@ describe('VsCodePluginScanner', () => {
55
53
  untrustedWorkspaces: { supported: true }
56
54
  }, tmpDir);
57
55
  const model = scanner.getModel(pkg);
58
- (0, chai_1.expect)(model.untrustedWorkspacesSupport).to.equal(true);
56
+ expect(model.untrustedWorkspacesSupport).to.equal(true);
59
57
  });
60
58
  it('should set untrustedWorkspacesSupport to false when capabilities.untrustedWorkspaces.supported is false', () => {
61
59
  const pkg = createVsCodePluginPackage({
62
60
  untrustedWorkspaces: { supported: false }
63
61
  }, tmpDir);
64
62
  const model = scanner.getModel(pkg);
65
- (0, chai_1.expect)(model.untrustedWorkspacesSupport).to.equal(false);
63
+ expect(model.untrustedWorkspacesSupport).to.equal(false);
66
64
  });
67
65
  it('should set untrustedWorkspacesSupport to "limited" when capabilities.untrustedWorkspaces.supported is "limited"', () => {
68
66
  const pkg = createVsCodePluginPackage({
69
67
  untrustedWorkspaces: { supported: 'limited' }
70
68
  }, tmpDir);
71
69
  const model = scanner.getModel(pkg);
72
- (0, chai_1.expect)(model.untrustedWorkspacesSupport).to.equal('limited');
70
+ expect(model.untrustedWorkspacesSupport).to.equal('limited');
73
71
  });
74
72
  it('should leave untrustedWorkspacesSupport undefined when no capabilities field is present', () => {
75
73
  const pkg = createVsCodePluginPackage(undefined, tmpDir);
76
74
  const model = scanner.getModel(pkg);
77
- (0, chai_1.expect)(model.untrustedWorkspacesSupport).to.equal(undefined);
75
+ expect(model.untrustedWorkspacesSupport).to.equal(undefined);
78
76
  });
79
77
  });
80
78
  //# sourceMappingURL=scanner-vscode.spec.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"scanner-vscode.spec.js","sourceRoot":"","sources":["../../src/node/scanner-vscode.spec.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;AAEhF,uDAAuD;AAEvD,+BAA8B;AAC9B,yBAAyB;AACzB,6BAA6B;AAC7B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QAAQ,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yFAAyF,EAAE,GAAG,EAAE;QAC/F,MAAM,GAAG,GAAG,yBAAyB,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAEzD,MAAM,KAAK,GAAG,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,24 +1,25 @@
1
1
  {
2
2
  "name": "@theia/plugin-ext-vscode",
3
- "version": "1.77.0-next.0+d8106d7ff",
3
+ "version": "1.77.0-next.101+8308c936b",
4
4
  "description": "Theia - Plugin Extension for VsCode",
5
+ "type": "module",
5
6
  "dependencies": {
6
- "@theia/callhierarchy": "1.77.0-next.0+d8106d7ff",
7
- "@theia/core": "1.77.0-next.0+d8106d7ff",
8
- "@theia/editor": "1.77.0-next.0+d8106d7ff",
9
- "@theia/filesystem": "1.77.0-next.0+d8106d7ff",
10
- "@theia/monaco": "1.77.0-next.0+d8106d7ff",
7
+ "@theia/callhierarchy": "1.77.0-next.101+8308c936b",
8
+ "@theia/core": "1.77.0-next.101+8308c936b",
9
+ "@theia/editor": "1.77.0-next.101+8308c936b",
10
+ "@theia/filesystem": "1.77.0-next.101+8308c936b",
11
+ "@theia/monaco": "1.77.0-next.101+8308c936b",
11
12
  "@theia/monaco-editor-core": "1.108.201",
12
- "@theia/navigator": "1.77.0-next.0+d8106d7ff",
13
- "@theia/outline-view": "1.77.0-next.0+d8106d7ff",
14
- "@theia/plugin": "1.77.0-next.0+d8106d7ff",
15
- "@theia/plugin-ext": "1.77.0-next.0+d8106d7ff",
16
- "@theia/plugin-utils": "1.77.0-next.0+d8106d7ff",
17
- "@theia/scm": "1.77.0-next.0+d8106d7ff",
18
- "@theia/terminal": "1.77.0-next.0+d8106d7ff",
19
- "@theia/typehierarchy": "1.77.0-next.0+d8106d7ff",
20
- "@theia/userstorage": "1.77.0-next.0+d8106d7ff",
21
- "@theia/workspace": "1.77.0-next.0+d8106d7ff",
13
+ "@theia/navigator": "1.77.0-next.101+8308c936b",
14
+ "@theia/outline-view": "1.77.0-next.101+8308c936b",
15
+ "@theia/plugin": "1.77.0-next.101+8308c936b",
16
+ "@theia/plugin-ext": "1.77.0-next.101+8308c936b",
17
+ "@theia/plugin-utils": "1.77.0-next.101+8308c936b",
18
+ "@theia/scm": "1.77.0-next.101+8308c936b",
19
+ "@theia/terminal": "1.77.0-next.101+8308c936b",
20
+ "@theia/typehierarchy": "1.77.0-next.101+8308c936b",
21
+ "@theia/userstorage": "1.77.0-next.101+8308c936b",
22
+ "@theia/workspace": "1.77.0-next.101+8308c936b",
22
23
  "decompress": "^4.2.1",
23
24
  "filenamify": "^4.3.0",
24
25
  "tslib": "^2.8.1"
@@ -62,5 +63,12 @@
62
63
  "nyc": {
63
64
  "extends": "../../configs/nyc.json"
64
65
  },
65
- "gitHead": "d8106d7ffa62b3413ff1ca5b63a0e6c2fe0b0649"
66
+ "gitHead": "8308c936be596c357a51fc815ef30022aa62b3d5",
67
+ "exports": {
68
+ "./package.json": "./package.json",
69
+ "./lib/*.json": "./lib/*.json",
70
+ "./lib/*.js": "./lib/*.js",
71
+ "./lib/*": "./lib/*.js",
72
+ "./*": "./*"
73
+ }
66
74
  }
@@ -28,7 +28,15 @@ import { FrontendApplicationConfigProvider } from '@theia/core/lib/browser/front
28
28
  FrontendApplicationConfigProvider.set({});
29
29
 
30
30
  import { expect } from 'chai';
31
- import { EditorGroupNavigationRect, PluginVscodeCommandsContribution } from './plugin-vscode-commands-contribution';
31
+ import * as sinon from 'sinon';
32
+ import { CommandRegistry, InMemoryTextResource, URI } from '@theia/core';
33
+ import { MultiDiffEditorUri } from '@theia/scm/lib/browser/multi-diff-editor/multi-diff-editor-uri';
34
+ import { ScmService } from '@theia/scm/lib/browser/scm-service';
35
+ import { DuplicateExtensionError } from '@theia/plugin-ext/lib/common/plugin-protocol';
36
+ import { Title, Widget } from '@theia/core/lib/browser';
37
+ import { EditorWidget } from '@theia/editor/lib/browser';
38
+ import { VSCodeExtensionUri } from '../common/plugin-vscode-uri.js';
39
+ import { EditorGroupNavigationRect, PluginVscodeCommandsContribution } from './plugin-vscode-commands-contribution.js';
32
40
 
33
41
  after(() => disableJSDOM());
34
42
 
@@ -39,6 +47,108 @@ function rect(left: number, top: number, width: number, height: number): EditorG
39
47
  describe('PluginVscodeCommandsContribution', () => {
40
48
  const contribution = new PluginVscodeCommandsContribution();
41
49
 
50
+ describe('_workbench.openMultiDiffEditor', () => {
51
+ it('should keep modified, added and deleted resources and supply empty missing sides', async () => {
52
+ const open = sinon.stub().resolves();
53
+ Object.assign(contribution, { openerService: { getOpener: async () => ({ open }) } });
54
+ const commands = new CommandRegistry({ getContributions: () => [] });
55
+ contribution.registerCommands(commands);
56
+ const originalUri = new URI('git:///workspace/file.ts?HEAD~1').toComponents();
57
+ const modifiedUri = new URI('file:///workspace/file.ts').toComponents();
58
+ await commands.executeCommand('_workbench.openMultiDiffEditor', {
59
+ title: 'Commit Changes',
60
+ resources: [{ originalUri, modifiedUri }, { modifiedUri }, { originalUri }, {}],
61
+ reveal: { modifiedUri }
62
+ });
63
+ expect(open.calledOnce).to.be.true;
64
+ const data = MultiDiffEditorUri.decode(open.firstCall.args[0]);
65
+ expect(data.title).to.equal('Commit Changes');
66
+ expect(data.resources).to.have.length(3);
67
+ expect(data.resources[0].originalUri.toString()).to.equal(URI.fromComponents(originalUri).toString());
68
+ expect(data.resources[0].modifiedUri.toString()).to.equal(URI.fromComponents(modifiedUri).toString());
69
+ for (const emptyUri of [data.resources[1].originalUri, data.resources[2].modifiedUri]) {
70
+ const resource = new InMemoryTextResource(emptyUri);
71
+ expect(resource.readOnly).to.be.true;
72
+ expect(await resource.readContents()).to.equal('');
73
+ expect(emptyUri.path.toString()).to.equal('/workspace/file.ts');
74
+ }
75
+ expect(data.resources[1].modifiedUri.toString()).to.equal(URI.fromComponents(modifiedUri).toString());
76
+ expect(data.resources[2].originalUri.toString()).to.equal(URI.fromComponents(originalUri).toString());
77
+ expect(open.firstCall.args[1].reveal.toString()).to.equal(URI.fromComponents(modifiedUri).toString());
78
+ });
79
+ });
80
+
81
+ describe('_workbench.openScmMultiDiffEditor', () => {
82
+ const repositoryUri = new URI('file:///workspace/repository');
83
+ const originalUri = new URI('git:///workspace/repository/file.ts?HEAD');
84
+ const modifiedUri = new URI('file:///workspace/repository/file.ts');
85
+ let commands: CommandRegistry;
86
+ let open: sinon.SinonStub;
87
+ let resources: { multiDiffEditorOriginalUri?: URI; multiDiffEditorModifiedUri?: URI }[];
88
+
89
+ beforeEach(() => {
90
+ open = sinon.stub().resolves();
91
+ resources = [
92
+ { multiDiffEditorOriginalUri: originalUri, multiDiffEditorModifiedUri: modifiedUri },
93
+ { multiDiffEditorModifiedUri: modifiedUri },
94
+ { multiDiffEditorOriginalUri: originalUri },
95
+ {}
96
+ ];
97
+ Object.assign(contribution, {
98
+ openerService: { getOpener: async () => ({ open }) },
99
+ scmService: {
100
+ repositories: [{
101
+ provider: {
102
+ rootUri: repositoryUri.toString(),
103
+ groups: [{ id: 'workingTree', resources }]
104
+ }
105
+ }]
106
+ } as unknown as ScmService
107
+ });
108
+ commands = new CommandRegistry({ getContributions: () => [] });
109
+ contribution.registerCommands(commands);
110
+ });
111
+
112
+ it('should open Git resource-group changes, including added and deleted files', async () => {
113
+ await commands.executeCommand('_workbench.openScmMultiDiffEditor', {
114
+ title: 'Git: Changes', repositoryUri: repositoryUri.toComponents(), resourceGroupId: 'workingTree'
115
+ });
116
+ expect(open.calledOnce).to.be.true;
117
+ const data = MultiDiffEditorUri.decode(open.firstCall.args[0]);
118
+ expect(data.title).to.equal('Git: Changes');
119
+ expect(data.resources).to.have.length(3);
120
+ expect(data.resources[0].originalUri.toString()).to.equal(originalUri.toString());
121
+ expect(data.resources[0].modifiedUri.toString()).to.equal(modifiedUri.toString());
122
+ for (const emptyUri of [data.resources[1].originalUri, data.resources[2].modifiedUri]) {
123
+ expect(await new InMemoryTextResource(emptyUri).readContents()).to.equal('');
124
+ expect(emptyUri.path.toString()).to.equal('/workspace/repository/file.ts');
125
+ }
126
+ });
127
+
128
+ it('should use the current resource-group state on each invocation', async () => {
129
+ const options = { title: 'Git: Changes', repositoryUri: repositoryUri.toComponents(), resourceGroupId: 'workingTree' };
130
+ await commands.executeCommand('_workbench.openScmMultiDiffEditor', options);
131
+ resources.splice(0, resources.length, { multiDiffEditorModifiedUri: modifiedUri });
132
+ await commands.executeCommand('_workbench.openScmMultiDiffEditor', options);
133
+ expect(open.calledTwice).to.be.true;
134
+ expect(MultiDiffEditorUri.decode(open.secondCall.args[0]).resources).to.have.length(1);
135
+ });
136
+
137
+ it('should ignore missing repositories, groups, and empty resource groups', async () => {
138
+ await commands.executeCommand('_workbench.openScmMultiDiffEditor', {
139
+ title: 'Git: Changes', repositoryUri: new URI('file:///workspace/repository/nested').toComponents(), resourceGroupId: 'workingTree'
140
+ });
141
+ await commands.executeCommand('_workbench.openScmMultiDiffEditor', {
142
+ title: 'Git: Changes', repositoryUri: repositoryUri.toComponents(), resourceGroupId: 'missing'
143
+ });
144
+ resources.length = 0;
145
+ await commands.executeCommand('_workbench.openScmMultiDiffEditor', {
146
+ title: 'Git: Changes', repositoryUri: repositoryUri.toComponents(), resourceGroupId: 'workingTree'
147
+ });
148
+ expect(open.called).to.be.false;
149
+ });
150
+ });
151
+
42
152
  describe('findClosestEditorGroup', () => {
43
153
  it('prefers the orthogonally-overlapping group when navigating up out of a split column', () => {
44
154
  const left = rect(0, 0, 50, 100);
@@ -65,4 +175,117 @@ describe('PluginVscodeCommandsContribution', () => {
65
175
  expect(contribution['findClosestEditorGroup'](left, [], 'right')).to.equal(-1);
66
176
  });
67
177
  });
178
+
179
+ describe('installExtensionFromId', () => {
180
+ function withInstall(install: (...args: unknown[]) => Promise<void>): PluginVscodeCommandsContribution {
181
+ const instance = new PluginVscodeCommandsContribution();
182
+ (instance as unknown as { pluginServer: unknown }).pluginServer = { install };
183
+ return instance;
184
+ }
185
+
186
+ it('is a noop when the extension is already installed', async () => {
187
+ const instance = withInstall(async () => { throw DuplicateExtensionError.create('Extension ms-python.python is already installed.'); });
188
+ await instance['installExtensionFromId']('ms-python.python');
189
+ });
190
+
191
+ it('rethrows other installation errors', async () => {
192
+ const instance = withInstall(async () => { throw new Error('Deployment failed.'); });
193
+ let error: unknown;
194
+ try {
195
+ await instance['installExtensionFromId']('ms-python.python');
196
+ } catch (e) {
197
+ error = e;
198
+ }
199
+ expect(error).to.be.instanceOf(Error).with.property('message', 'Deployment failed.');
200
+ });
201
+
202
+ it('installs the requested version of a versioned ID', async () => {
203
+ const calls: unknown[][] = [];
204
+ const instance = withInstall(async (...args) => { calls.push(args); });
205
+ await instance['installExtensionFromId']('ms-python.python@1.2.3');
206
+ expect(calls).to.have.lengthOf(1);
207
+ expect(calls[0][0]).to.equal(VSCodeExtensionUri.fromId('ms-python.python').toString());
208
+ expect(calls[0][2]).to.deep.equal({ version: '1.2.3', ignoreOtherVersions: true });
209
+ });
210
+ });
211
+
212
+ describe('editor close commands', () => {
213
+ /** A shell with one tab bar whose `closeTabs` relies on `this`, like `ApplicationShell`. */
214
+ class FakeShell {
215
+ readonly closed: string[] = [];
216
+ readonly saved: string[] = [];
217
+ readonly tabBar: { titles: Title<Widget>[] };
218
+ readonly otherTabBar: { titles: Title<Widget>[] };
219
+
220
+ constructor(readonly widgets: Widget[], readonly currentWidget: Widget, otherGroup: Widget[]) {
221
+ this.tabBar = { titles: widgets.map(widget => widget.title) };
222
+ this.otherTabBar = { titles: otherGroup.map(widget => widget.title) };
223
+ }
224
+
225
+ get allTabBars(): unknown[] {
226
+ return [this.tabBar, this.otherTabBar];
227
+ }
228
+
229
+ getTabBarFor(): unknown {
230
+ return this.tabBar;
231
+ }
232
+
233
+ async closeMany(targets: Widget[]): Promise<Widget[]> {
234
+ this.closed.push(...targets.map(target => target.id));
235
+ return targets;
236
+ }
237
+
238
+ async closeTabs(tabBar: { titles: Title<Widget>[] }, filter?: (title: Title<Widget>, index: number) => boolean): Promise<void> {
239
+ await this.closeMany(this.getWidgetTitles(tabBar, filter).map(title => title.owner));
240
+ }
241
+
242
+ saveTabs(tabBar: { titles: Title<Widget>[] }, filter?: (title: Title<Widget>, index: number) => boolean): void {
243
+ this.saved.push(...this.getWidgetTitles(tabBar, filter).map(title => title.owner.id));
244
+ }
245
+
246
+ getWidgetTitles(tabBar: { titles: Title<Widget>[] }, filter?: (title: Title<Widget>, index: number) => boolean): Title<Widget>[] {
247
+ return filter ? tabBar.titles.filter(filter) : tabBar.titles;
248
+ }
249
+ }
250
+
251
+ function editor(id: string, pinned = false): EditorWidget {
252
+ const widget: EditorWidget = Object.create(EditorWidget.prototype);
253
+ Object.defineProperties(widget, { id: { value: id }, title: { value: { owner: widget, closable: !pinned } } });
254
+ return widget;
255
+ }
256
+
257
+ let shell: FakeShell;
258
+ let commands: CommandRegistry;
259
+
260
+ beforeEach(() => {
261
+ const widgets = [editor('a', true), editor('b'), editor('c'), editor('d', true), editor('e')];
262
+ shell = new FakeShell(widgets, widgets[2], [editor('f', true), editor('g')]);
263
+ Object.assign(contribution, { shell, editorManager: { currentEditor: widgets[2], all: widgets } });
264
+ commands = new CommandRegistry({ getContributions: () => [] });
265
+ contribution.registerCommands(commands);
266
+ });
267
+
268
+ const expectations: [string, string[]][] = [
269
+ ['workbench.action.closeAllEditors', ['b', 'c', 'e']],
270
+ ['workbench.action.closeOtherEditors', ['b', 'e']],
271
+ ['workbench.action.closeEditorsInGroup', ['b', 'c', 'e']],
272
+ ['workbench.action.closeEditorsToTheLeft', ['b']],
273
+ ['workbench.action.closeEditorsToTheRight', ['e']],
274
+ ['workbench.action.closeEditorsInOtherGroups', ['g']]
275
+ ];
276
+ for (const [command, closed] of expectations) {
277
+ it(`${command} should leave pinned editors open`, async () => {
278
+ await commands.executeCommand(command);
279
+ await new Promise(resolve => setTimeout(resolve));
280
+
281
+ expect(shell.closed).to.deep.equal(closed);
282
+ });
283
+ }
284
+
285
+ it('workbench.files.saveAllInGroup should save every editor in the group, pinned ones included', async () => {
286
+ await commands.executeCommand('workbench.files.saveAllInGroup');
287
+
288
+ expect(shell.saved).to.deep.equal(['a', 'b', 'c', 'd', 'e']);
289
+ });
290
+ });
68
291
  });