@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.
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,4 +1,3 @@
1
- "use strict";
2
1
  // *****************************************************************************
3
2
  // Copyright (C) 2018 Red Hat, Inc. and others.
4
3
  //
@@ -14,46 +13,55 @@
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
- exports.PluginVscodeCommandsContribution = exports.VscodeCommands = void 0;
19
- const tslib_1 = require("tslib");
20
- const core_1 = require("@theia/core");
21
- const browser_1 = require("@theia/core/lib/browser");
22
- const context_key_service_1 = require("@theia/core/lib/browser/context-key-service");
23
- const application_shell_mouse_tracker_1 = require("@theia/core/lib/browser/shell/application-shell-mouse-tracker");
24
- const command_1 = require("@theia/core/lib/common/command");
25
- const uri_1 = require("@theia/core/lib/common/uri");
26
- const browser_2 = require("@theia/editor/lib/browser");
27
- const documents_main_1 = require("@theia/plugin-ext/lib/main/browser/documents-main");
28
- const type_converters_1 = require("@theia/plugin-ext/lib/plugin/type-converters");
29
- const browser_3 = require("@theia/workspace/lib/browser");
30
- const workspace_service_1 = require("@theia/workspace/lib/browser/workspace-service");
31
- const diff_service_1 = require("@theia/workspace/lib/browser/diff-service");
32
- const inversify_1 = require("@theia/core/shared/inversify");
33
- const vscode_uri_1 = require("@theia/core/shared/vscode-uri");
34
- const plugin_protocol_1 = require("@theia/plugin-ext/lib/common/plugin-protocol");
35
- const terminal_frontend_contribution_1 = require("@theia/terminal/lib/browser/terminal-frontend-contribution");
36
- const quick_open_workspace_1 = require("@theia/workspace/lib/browser/quick-open-workspace");
37
- const terminal_service_1 = require("@theia/terminal/lib/browser/base/terminal-service");
38
- const navigator_contribution_1 = require("@theia/navigator/lib/browser/navigator-contribution");
39
- const browser_4 = require("@theia/navigator/lib/browser");
40
- const tree_selection_1 = require("@theia/core/lib/browser/tree/tree-selection");
41
- const file_service_1 = require("@theia/filesystem/lib/browser/file-service");
42
- const browser_5 = require("@theia/callhierarchy/lib/browser");
43
- const browser_6 = require("@theia/typehierarchy/lib/browser");
44
- const monaco_text_model_service_1 = require("@theia/monaco/lib/browser/monaco-text-model-service");
45
- const hierarchy_types_converters_1 = require("@theia/plugin-ext/lib/main/browser/hierarchy/hierarchy-types-converters");
46
- const custom_editor_opener_1 = require("@theia/plugin-ext/lib/main/browser/custom-editors/custom-editor-opener");
47
- const nls_1 = require("@theia/core/lib/common/nls");
48
- const window_service_1 = require("@theia/core/lib/browser/window/window-service");
49
- const monaco = require("@theia/monaco-editor-core");
50
- const plugin_vscode_uri_1 = require("../common/plugin-vscode-uri");
51
- const vscode_theia_menu_mappings_1 = require("@theia/plugin-ext/lib/main/browser/menus/vscode-theia-menu-mappings");
52
- const outline_view_contribution_1 = require("@theia/outline-view/lib/browser/outline-view-contribution");
53
- const monaco_languages_1 = require("@theia/monaco/lib/browser/monaco-languages");
54
- const scm_contribution_1 = require("@theia/scm/lib/browser/scm-contribution");
55
- const merge_editor_1 = require("@theia/scm/lib/browser/merge-editor/merge-editor");
56
- var VscodeCommands;
16
+ import { __decorate } from "tslib";
17
+ import { environment, isOSX, CancellationTokenSource, MessageService, isArray, ILogger, MEMORY_TEXT_READONLY } from '@theia/core';
18
+ import { ApplicationShell, CommonCommands, NavigatableWidget, open, OpenerService, QuickInputService, Saveable } from '@theia/core/lib/browser';
19
+ import { ContextKeyService } from '@theia/core/lib/browser/context-key-service';
20
+ import { ApplicationShellMouseTracker } from '@theia/core/lib/browser/shell/application-shell-mouse-tracker';
21
+ import { CommandService } from '@theia/core/lib/common/command';
22
+ import TheiaURI from '@theia/core/lib/common/uri';
23
+ import { EditorManager, EditorCommands } from '@theia/editor/lib/browser';
24
+ import { DocumentsMainImpl } from '@theia/plugin-ext/lib/main/browser/documents-main';
25
+ import { isUriComponents, toMergedSymbol, toPosition } from '@theia/plugin-ext/lib/plugin/type-converters';
26
+ import { WorkspaceCommands } from '@theia/workspace/lib/browser';
27
+ import { WorkspaceService } from '@theia/workspace/lib/browser/workspace-service';
28
+ import { DiffService } from '@theia/workspace/lib/browser/diff-service';
29
+ import { inject, injectable, optional, named } from '@theia/core/shared/inversify';
30
+ import { URI } from '@theia/core/shared/vscode-uri';
31
+ import { DuplicateExtensionError, PluginIdentifiers, PluginServer } from '@theia/plugin-ext/lib/common/plugin-protocol';
32
+ import { TerminalFrontendContribution } from '@theia/terminal/lib/browser/terminal-frontend-contribution';
33
+ import { QuickOpenWorkspace } from '@theia/workspace/lib/browser/quick-open-workspace';
34
+ import { TerminalService } from '@theia/terminal/lib/browser/base/terminal-service';
35
+ import { FileNavigatorCommands, FILE_NAVIGATOR_TOGGLE_COMMAND_ID } from '@theia/navigator/lib/browser/navigator-contribution';
36
+ import { FILE_NAVIGATOR_ID, FileNavigatorWidget } from '@theia/navigator/lib/browser';
37
+ import { SelectableTreeNode } from '@theia/core/lib/browser/tree/tree-selection';
38
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
39
+ import { CallHierarchyServiceProvider } from '@theia/callhierarchy/lib/browser';
40
+ import { TypeHierarchyServiceProvider } from '@theia/typehierarchy/lib/browser';
41
+ import { MonacoTextModelService } from '@theia/monaco/lib/browser/monaco-text-model-service';
42
+ import { fromCallHierarchyCalleeToModelCallHierarchyOutgoingCall, fromCallHierarchyCallerToModelCallHierarchyIncomingCall, fromItemHierarchyDefinition, toItemHierarchyDefinition } from '@theia/plugin-ext/lib/main/browser/hierarchy/hierarchy-types-converters';
43
+ import { CustomEditorOpener } from '@theia/plugin-ext/lib/main/browser/custom-editors/custom-editor-opener';
44
+ import { nls } from '@theia/core/lib/common/nls';
45
+ import { WindowService } from '@theia/core/lib/browser/window/window-service';
46
+ import * as monaco from '@theia/monaco-editor-core';
47
+ import { VSCodeExtensionUri } from '../common/plugin-vscode-uri.js';
48
+ import { CodeEditorWidgetUtil } from '@theia/plugin-ext/lib/main/browser/menus/vscode-theia-menu-mappings';
49
+ import { OutlineViewContribution } from '@theia/outline-view/lib/browser/outline-view-contribution';
50
+ import { MonacoLanguages } from '@theia/monaco/lib/browser/monaco-languages';
51
+ import { ScmContribution } from '@theia/scm/lib/browser/scm-contribution';
52
+ import { ScmService } from '@theia/scm/lib/browser/scm-service';
53
+ import { MergeEditorUri } from '@theia/scm/lib/browser/merge-editor/merge-editor';
54
+ import { MultiDiffEditorUri } from '@theia/scm/lib/browser/multi-diff-editor/multi-diff-editor';
55
+ function toTheiaUri(value) {
56
+ if (value === undefined) {
57
+ return undefined;
58
+ }
59
+ if (typeof value === 'string') {
60
+ return new TheiaURI(value);
61
+ }
62
+ return TheiaURI.fromComponents(value);
63
+ }
64
+ export var VscodeCommands;
57
65
  (function (VscodeCommands) {
58
66
  VscodeCommands.GET_CODE_EXCHANGE_ENDPOINTS = {
59
67
  id: 'workbench.getCodeExchangeProxyEndpoints' // this command is used in the github auth built-in
@@ -81,7 +89,7 @@ var VscodeCommands;
81
89
  VscodeCommands.INSTALL_EXTENSION_FROM_VSIX_COMMAND = {
82
90
  id: 'workbench.extensions.command.installFromVSIX'
83
91
  };
84
- })(VscodeCommands || (exports.VscodeCommands = VscodeCommands = {}));
92
+ })(VscodeCommands || (VscodeCommands = {}));
85
93
  function isInDirection(source, candidate, direction) {
86
94
  const sourceCenter = rectCenter(source);
87
95
  const candidateCenter = rectCenter(candidate);
@@ -144,7 +152,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
144
152
  if (!resource) {
145
153
  throw new Error(`${commandId} command requires at least URI argument.`);
146
154
  }
147
- if (!vscode_uri_1.URI.isUri(resource)) {
155
+ if (!URI.isUri(resource)) {
148
156
  throw new Error(`Invalid argument for ${commandId} command with URI argument. Found ${resource}`);
149
157
  }
150
158
  let options;
@@ -158,8 +166,8 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
158
166
  ...columnOrOptions
159
167
  };
160
168
  }
161
- const uri = new uri_1.default(resource);
162
- const editorOptions = documents_main_1.DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
169
+ const uri = new TheiaURI(resource);
170
+ const editorOptions = DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
163
171
  let openHandler;
164
172
  if (typeof openerId === 'string') {
165
173
  const lowerViewType = openerId.toLowerCase();
@@ -281,14 +289,14 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
281
289
  isVisible: () => false,
282
290
  execute: async (resource, columnOrOptions) => {
283
291
  if (typeof resource === 'string') {
284
- resource = vscode_uri_1.URI.parse(resource);
292
+ resource = URI.parse(resource);
285
293
  }
286
294
  try {
287
295
  await this.openWith(VscodeCommands.OPEN.id, resource, columnOrOptions);
288
296
  }
289
297
  catch (error) {
290
- const message = nls_1.nls.localizeByDefault("Unable to open '{0}'", resource.path);
291
- const reason = nls_1.nls.localizeByDefault('Error: {0}', error.message);
298
+ const message = nls.localizeByDefault("Unable to open '{0}'", resource.path);
299
+ const reason = nls.localizeByDefault('Error: {0}', error.message);
292
300
  this.messageService.error(`${message}\n${reason}`);
293
301
  this.logger.warn(error);
294
302
  }
@@ -305,7 +313,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
305
313
  }
306
314
  let result = await this.openWith(VscodeCommands.OPEN_WITH.id, resource, columnOrOptions, viewType);
307
315
  if (!result) {
308
- result = await this.openWith(VscodeCommands.OPEN_WITH.id, resource, columnOrOptions, custom_editor_opener_1.CustomEditorOpener.toCustomEditorId(viewType));
316
+ result = await this.openWith(VscodeCommands.OPEN_WITH.id, resource, columnOrOptions, CustomEditorOpener.toCustomEditorId(viewType));
309
317
  }
310
318
  if (!result) {
311
319
  throw new Error(`Could not find an editor for '${viewType}'`);
@@ -316,9 +324,9 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
316
324
  isVisible: () => false,
317
325
  execute: async (resource, arg = {}) => {
318
326
  if (!resource) {
319
- return commands.executeCommand(browser_3.WorkspaceCommands.OPEN_WORKSPACE.id);
327
+ return commands.executeCommand(WorkspaceCommands.OPEN_WORKSPACE.id);
320
328
  }
321
- if (!vscode_uri_1.URI.isUri(resource)) {
329
+ if (!URI.isUri(resource)) {
322
330
  throw new Error(`Invalid argument for ${VscodeCommands.OPEN_FOLDER.id} command with URI argument. Found ${resource}`);
323
331
  }
324
332
  let options;
@@ -328,7 +336,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
328
336
  else {
329
337
  options = { preserveWindow: !arg.forceNewWindow };
330
338
  }
331
- this.workspaceService.open(new uri_1.default(resource), options);
339
+ this.workspaceService.open(new TheiaURI(resource), options);
332
340
  }
333
341
  });
334
342
  commands.registerCommand(VscodeCommands.DIFF, {
@@ -338,15 +346,15 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
338
346
  if (!left || !right) {
339
347
  throw new Error(`${VscodeCommands.DIFF} command requires at least two URI arguments. Found left=${left}, right=${right} as arguments`);
340
348
  }
341
- if (!vscode_uri_1.URI.isUri(left)) {
349
+ if (!URI.isUri(left)) {
342
350
  throw new Error(`Invalid argument for ${VscodeCommands.DIFF.id} command with left argument. Expecting URI left type but found ${left}`);
343
351
  }
344
- if (!vscode_uri_1.URI.isUri(right)) {
352
+ if (!URI.isUri(right)) {
345
353
  throw new Error(`Invalid argument for ${VscodeCommands.DIFF.id} command with right argument. Expecting URI right type but found ${right}`);
346
354
  }
347
- const leftURI = new uri_1.default(left);
348
- const editorOptions = documents_main_1.DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
349
- await this.diffService.openDiffEditor(leftURI, new uri_1.default(right), label, editorOptions);
355
+ const leftURI = new TheiaURI(left);
356
+ const editorOptions = DocumentsMainImpl.toEditorOpenerOptions(this.shell, options);
357
+ await this.diffService.openDiffEditor(leftURI, new TheiaURI(right), label, editorOptions);
350
358
  }
351
359
  });
352
360
  // https://code.visualstudio.com/docs/getstarted/keybindings#_navigation
@@ -358,58 +366,51 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
358
366
  * because of it we filter out editors from views based on `NavigatableWidget.is`
359
367
  * and apply actions only to them
360
368
  */
361
- if (!core_1.environment.electron.is() || core_1.isOSX) {
369
+ if (!environment.electron.is() || isOSX) {
362
370
  commands.registerCommand({ id: 'workbench.action.files.openFileFolder' }, {
363
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.OPEN.id)
371
+ execute: () => commands.executeCommand(WorkspaceCommands.OPEN.id)
364
372
  });
365
- commands.registerAlias('workbench.action.files.openFileFolder', browser_3.WorkspaceCommands.OPEN.id);
373
+ commands.registerAlias('workbench.action.files.openFileFolder', WorkspaceCommands.OPEN.id);
366
374
  }
367
375
  commands.registerCommand({ id: 'workbench.action.files.openFile' }, {
368
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.OPEN_FILE.id)
376
+ execute: () => commands.executeCommand(WorkspaceCommands.OPEN_FILE.id)
369
377
  });
370
- commands.registerAlias('workbench.action.files.openFile', browser_3.WorkspaceCommands.OPEN_FILE.id);
378
+ commands.registerAlias('workbench.action.files.openFile', WorkspaceCommands.OPEN_FILE.id);
371
379
  commands.registerCommand({ id: 'workbench.action.files.openFolder' }, {
372
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.OPEN_FOLDER.id)
380
+ execute: () => commands.executeCommand(WorkspaceCommands.OPEN_FOLDER.id)
373
381
  });
374
- commands.registerAlias('workbench.action.files.openFolder', browser_3.WorkspaceCommands.OPEN_FOLDER.id);
382
+ commands.registerAlias('workbench.action.files.openFolder', WorkspaceCommands.OPEN_FOLDER.id);
375
383
  commands.registerCommand({ id: 'workbench.action.addRootFolder' }, {
376
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.ADD_FOLDER.id)
384
+ execute: () => commands.executeCommand(WorkspaceCommands.ADD_FOLDER.id)
377
385
  });
378
- commands.registerAlias('workbench.action.addRootFolder', browser_3.WorkspaceCommands.ADD_FOLDER.id);
386
+ commands.registerAlias('workbench.action.addRootFolder', WorkspaceCommands.ADD_FOLDER.id);
379
387
  commands.registerCommand({ id: 'workbench.action.saveWorkspaceAs' }, {
380
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.SAVE_WORKSPACE_AS.id)
388
+ execute: () => commands.executeCommand(WorkspaceCommands.SAVE_WORKSPACE_AS.id)
381
389
  });
382
- commands.registerAlias('workbench.action.saveWorkspaceAs', browser_3.WorkspaceCommands.SAVE_WORKSPACE_AS.id);
390
+ commands.registerAlias('workbench.action.saveWorkspaceAs', WorkspaceCommands.SAVE_WORKSPACE_AS.id);
383
391
  commands.registerCommand({ id: 'workbench.action.gotoLine' }, {
384
- execute: () => commands.executeCommand(browser_2.EditorCommands.GOTO_LINE_COLUMN.id)
392
+ execute: () => commands.executeCommand(EditorCommands.GOTO_LINE_COLUMN.id)
385
393
  });
386
- commands.registerAlias('workbench.action.gotoLine', browser_2.EditorCommands.GOTO_LINE_COLUMN.id);
394
+ commands.registerAlias('workbench.action.gotoLine', EditorCommands.GOTO_LINE_COLUMN.id);
387
395
  commands.registerCommand({ id: 'workbench.action.quickOpen' }, {
388
396
  execute: (prefix) => this.quickInput.open(typeof prefix === 'string' ? prefix : '')
389
397
  });
390
398
  commands.registerCommand({ id: 'workbench.action.openSettings' }, {
391
- execute: (query) => commands.executeCommand(browser_1.CommonCommands.OPEN_PREFERENCES.id, query)
399
+ execute: (query) => commands.executeCommand(CommonCommands.OPEN_PREFERENCES.id, query)
392
400
  });
393
- commands.registerAlias('workbench.action.openSettings', browser_1.CommonCommands.OPEN_PREFERENCES.id);
401
+ commands.registerAlias('workbench.action.openSettings', CommonCommands.OPEN_PREFERENCES.id);
394
402
  commands.registerCommand({ id: 'workbench.action.openWorkspaceConfigFile' }, {
395
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.OPEN_WORKSPACE_FILE.id)
403
+ execute: () => commands.executeCommand(WorkspaceCommands.OPEN_WORKSPACE_FILE.id)
396
404
  });
397
- commands.registerAlias('workbench.action.openWorkspaceConfigFile', browser_3.WorkspaceCommands.OPEN_WORKSPACE_FILE.id);
405
+ commands.registerAlias('workbench.action.openWorkspaceConfigFile', WorkspaceCommands.OPEN_WORKSPACE_FILE.id);
398
406
  commands.registerCommand({ id: 'workbench.files.action.refreshFilesExplorer' }, {
399
- execute: () => commands.executeCommand(navigator_contribution_1.FileNavigatorCommands.REFRESH_NAVIGATOR.id)
407
+ execute: () => commands.executeCommand(FileNavigatorCommands.REFRESH_NAVIGATOR.id)
400
408
  });
401
- commands.registerAlias('workbench.files.action.refreshFilesExplorer', navigator_contribution_1.FileNavigatorCommands.REFRESH_NAVIGATOR.id);
409
+ commands.registerAlias('workbench.files.action.refreshFilesExplorer', FileNavigatorCommands.REFRESH_NAVIGATOR.id);
402
410
  commands.registerCommand(VscodeCommands.INSTALL_EXTENSION_FROM_ID_OR_URI, {
403
411
  execute: async (vsixUriOrExtensionId) => {
404
412
  if (typeof vsixUriOrExtensionId === 'string') {
405
- let extensionId = vsixUriOrExtensionId;
406
- let opts;
407
- const versionedId = plugin_protocol_1.PluginIdentifiers.idAndVersionFromVersionedId(vsixUriOrExtensionId);
408
- if (versionedId) {
409
- extensionId = versionedId.id;
410
- opts = { version: versionedId.version, ignoreOtherVersions: true };
411
- }
412
- await this.pluginServer.install(plugin_vscode_uri_1.VSCodeExtensionUri.fromId(extensionId).toString(), undefined, opts);
413
+ await this.installExtensionFromId(vsixUriOrExtensionId);
413
414
  }
414
415
  else {
415
416
  await this.deployPlugin(vsixUriOrExtensionId);
@@ -418,7 +419,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
418
419
  });
419
420
  commands.registerCommand(VscodeCommands.INSTALL_EXTENSION_FROM_VSIX_COMMAND, {
420
421
  execute: async (uris) => {
421
- if ((0, core_1.isArray)(uris)) {
422
+ if (isArray(uris)) {
422
423
  await Promise.all(uris.map(async (vsix) => {
423
424
  await this.deployPlugin(vsix);
424
425
  }));
@@ -431,13 +432,13 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
431
432
  commands.registerCommand(VscodeCommands.UNINSTALL_EXTENSION, {
432
433
  execute: async (id) => {
433
434
  if (!id) {
434
- throw new Error(nls_1.nls.localizeByDefault('Extension id required.'));
435
+ throw new Error(nls.localizeByDefault('Extension id required.'));
435
436
  }
436
- const idAndVersion = plugin_protocol_1.PluginIdentifiers.idAndVersionFromVersionedId(id);
437
+ const idAndVersion = PluginIdentifiers.idAndVersionFromVersionedId(id);
437
438
  if (!idAndVersion) {
438
439
  throw new Error(`Invalid extension id: ${id}\nExpected format: <publisher>.<name>@<version>.`);
439
440
  }
440
- await this.pluginServer.uninstall(plugin_protocol_1.PluginIdentifiers.idAndVersionToVersionedId(idAndVersion));
441
+ await this.pluginServer.uninstall(PluginIdentifiers.idAndVersionToVersionedId(idAndVersion));
441
442
  }
442
443
  });
443
444
  commands.registerCommand({ id: 'workbench.action.files.save', }, {
@@ -445,11 +446,11 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
445
446
  if (uri) {
446
447
  const uriString = uri.toString();
447
448
  const widget = this.shell.widgets.find(w => {
448
- const resourceUri = browser_1.Saveable.is(w) && browser_1.NavigatableWidget.is(w) && w.getResourceUri();
449
+ const resourceUri = Saveable.is(w) && NavigatableWidget.is(w) && w.getResourceUri();
449
450
  return (resourceUri && resourceUri.toString()) === uriString;
450
451
  });
451
- if (browser_1.Saveable.is(widget)) {
452
- browser_1.Saveable.save(widget);
452
+ if (Saveable.is(widget)) {
453
+ Saveable.save(widget);
453
454
  }
454
455
  }
455
456
  else {
@@ -461,9 +462,9 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
461
462
  execute: () => this.shell.saveAll()
462
463
  });
463
464
  commands.registerCommand({ id: 'workbench.action.closeActiveEditor' }, {
464
- execute: () => commands.executeCommand(browser_1.CommonCommands.CLOSE_MAIN_TAB.id)
465
+ execute: () => commands.executeCommand(CommonCommands.CLOSE_MAIN_TAB.id)
465
466
  });
466
- commands.registerAlias('workbench.action.closeActiveEditor', browser_1.CommonCommands.CLOSE_MAIN_TAB.id);
467
+ commands.registerAlias('workbench.action.closeActiveEditor', CommonCommands.CLOSE_MAIN_TAB.id);
467
468
  commands.registerCommand({ id: 'workbench.action.closeOtherEditors' }, {
468
469
  execute: async (uri) => {
469
470
  let editor = this.editorManager.currentEditor || this.shell.currentWidget;
@@ -474,7 +475,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
474
475
  return (resourceUri && resourceUri.toString()) === uriString;
475
476
  });
476
477
  }
477
- const toClose = this.shell.widgets.filter(widget => widget !== editor && vscode_theia_menu_mappings_1.CodeEditorWidgetUtil.is(widget));
478
+ const toClose = this.shell.widgets.filter(widget => widget !== editor && CodeEditorWidgetUtil.is(widget) && widget.title.closable);
478
479
  await this.shell.closeMany(toClose);
479
480
  }
480
481
  });
@@ -490,21 +491,21 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
490
491
  if (editor) {
491
492
  const tabBar = this.shell.getTabBarFor(editor);
492
493
  if (tabBar) {
493
- cb(tabBar, ({ owner }) => vscode_theia_menu_mappings_1.CodeEditorWidgetUtil.is(owner));
494
+ cb(tabBar, ({ owner }) => CodeEditorWidgetUtil.is(owner));
494
495
  }
495
496
  }
496
497
  };
497
498
  commands.registerCommand({
498
499
  id: 'workbench.action.closeEditorsInGroup',
499
- label: nls_1.nls.localizeByDefault('Close All Editors in Group')
500
+ label: nls.localizeByDefault('Close All Editors in Group')
500
501
  }, {
501
- execute: (uri) => performActionOnGroup(this.shell.closeTabs, uri)
502
+ execute: (uri) => performActionOnGroup((tabBar, filter) => this.shell.closeTabs(tabBar, (title, index) => title.closable && filter(title, index)), uri)
502
503
  });
503
504
  commands.registerCommand({
504
505
  id: 'workbench.files.saveAllInGroup',
505
- label: nls_1.nls.localizeByDefault('Save All in Group')
506
+ label: nls.localizeByDefault('Save All in Group')
506
507
  }, {
507
- execute: (uri) => performActionOnGroup(this.shell.saveTabs, uri)
508
+ execute: (uri) => performActionOnGroup((tabBar, filter) => this.shell.saveTabs(tabBar, filter), uri)
508
509
  });
509
510
  commands.registerCommand({ id: 'workbench.action.closeEditorsInOtherGroups' }, {
510
511
  execute: () => {
@@ -513,7 +514,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
513
514
  const editorTabBar = this.shell.getTabBarFor(editor);
514
515
  for (const tabBar of this.shell.allTabBars) {
515
516
  if (tabBar !== editorTabBar) {
516
- this.shell.closeTabs(tabBar, ({ owner }) => vscode_theia_menu_mappings_1.CodeEditorWidgetUtil.is(owner));
517
+ this.shell.closeTabs(tabBar, ({ owner, closable }) => closable && CodeEditorWidgetUtil.is(owner));
517
518
  }
518
519
  }
519
520
  }
@@ -526,12 +527,12 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
526
527
  const tabBar = this.shell.getTabBarFor(editor);
527
528
  if (tabBar) {
528
529
  let left = true;
529
- this.shell.closeTabs(tabBar, ({ owner }) => {
530
+ this.shell.closeTabs(tabBar, ({ owner, closable }) => {
530
531
  if (owner === editor) {
531
532
  left = false;
532
533
  return false;
533
534
  }
534
- return left && vscode_theia_menu_mappings_1.CodeEditorWidgetUtil.is(owner);
535
+ return left && closable && CodeEditorWidgetUtil.is(owner);
535
536
  });
536
537
  }
537
538
  }
@@ -544,12 +545,12 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
544
545
  const tabBar = this.shell.getTabBarFor(editor);
545
546
  if (tabBar) {
546
547
  let left = true;
547
- this.shell.closeTabs(tabBar, ({ owner }) => {
548
+ this.shell.closeTabs(tabBar, ({ owner, closable }) => {
548
549
  if (owner === editor) {
549
550
  left = false;
550
551
  return false;
551
552
  }
552
- return !left && vscode_theia_menu_mappings_1.CodeEditorWidgetUtil.is(owner);
553
+ return !left && closable && CodeEditorWidgetUtil.is(owner);
553
554
  });
554
555
  }
555
556
  }
@@ -557,7 +558,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
557
558
  });
558
559
  commands.registerCommand({ id: 'workbench.action.closeAllEditors' }, {
559
560
  execute: async () => {
560
- const toClose = this.shell.widgets.filter(widget => vscode_theia_menu_mappings_1.CodeEditorWidgetUtil.is(widget));
561
+ const toClose = this.shell.widgets.filter(widget => CodeEditorWidgetUtil.is(widget) && widget.title.closable);
561
562
  await this.shell.closeMany(toClose);
562
563
  }
563
564
  });
@@ -569,53 +570,53 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
569
570
  });
570
571
  commands.registerCommand({
571
572
  id: 'workbench.action.navigateLeft',
572
- label: nls_1.nls.localizeByDefault('Navigate to the View on the Left'),
573
- category: nls_1.nls.localizeByDefault('View')
573
+ label: nls.localizeByDefault('Navigate to the View on the Left'),
574
+ category: nls.localizeByDefault('View')
574
575
  }, {
575
576
  execute: () => this.navigateEditorGroup('left')
576
577
  });
577
578
  commands.registerCommand({
578
579
  id: 'workbench.action.navigateRight',
579
- label: nls_1.nls.localizeByDefault('Navigate to the View on the Right'),
580
- category: nls_1.nls.localizeByDefault('View')
580
+ label: nls.localizeByDefault('Navigate to the View on the Right'),
581
+ category: nls.localizeByDefault('View')
581
582
  }, {
582
583
  execute: () => this.navigateEditorGroup('right')
583
584
  });
584
585
  commands.registerCommand({
585
586
  id: 'workbench.action.navigateUp',
586
- label: nls_1.nls.localizeByDefault('Navigate to the View Above'),
587
- category: nls_1.nls.localizeByDefault('View')
587
+ label: nls.localizeByDefault('Navigate to the View Above'),
588
+ category: nls.localizeByDefault('View')
588
589
  }, {
589
590
  execute: () => this.navigateEditorGroup('up')
590
591
  });
591
592
  commands.registerCommand({
592
593
  id: 'workbench.action.navigateDown',
593
- label: nls_1.nls.localizeByDefault('Navigate to the View Below'),
594
- category: nls_1.nls.localizeByDefault('View')
594
+ label: nls.localizeByDefault('Navigate to the View Below'),
595
+ category: nls.localizeByDefault('View')
595
596
  }, {
596
597
  execute: () => this.navigateEditorGroup('down')
597
598
  });
598
599
  commands.registerCommand({
599
600
  id: 'workbench.action.navigateEditorGroups',
600
- label: nls_1.nls.localizeByDefault('Navigate Between Editor Groups'),
601
- category: nls_1.nls.localizeByDefault('View')
601
+ label: nls.localizeByDefault('Navigate Between Editor Groups'),
602
+ category: nls.localizeByDefault('View')
602
603
  }, {
603
604
  execute: () => this.navigateEditorGroups()
604
605
  });
605
606
  commands.registerCommand({ id: 'workbench.action.navigateBack' }, {
606
- execute: () => commands.executeCommand(browser_2.EditorCommands.GO_BACK.id)
607
+ execute: () => commands.executeCommand(EditorCommands.GO_BACK.id)
607
608
  });
608
- commands.registerAlias('workbench.action.navigateBack', browser_2.EditorCommands.GO_BACK.id);
609
+ commands.registerAlias('workbench.action.navigateBack', EditorCommands.GO_BACK.id);
609
610
  commands.registerCommand({ id: 'workbench.action.navigateForward' }, {
610
- execute: () => commands.executeCommand(browser_2.EditorCommands.GO_FORWARD.id)
611
+ execute: () => commands.executeCommand(EditorCommands.GO_FORWARD.id)
611
612
  });
612
- commands.registerAlias('workbench.action.navigateForward', browser_2.EditorCommands.GO_FORWARD.id);
613
+ commands.registerAlias('workbench.action.navigateForward', EditorCommands.GO_FORWARD.id);
613
614
  commands.registerCommand({ id: 'workbench.action.navigateToLastEditLocation' }, {
614
- execute: () => commands.executeCommand(browser_2.EditorCommands.GO_LAST_EDIT.id)
615
+ execute: () => commands.executeCommand(EditorCommands.GO_LAST_EDIT.id)
615
616
  });
616
- commands.registerAlias('workbench.action.navigateToLastEditLocation', browser_2.EditorCommands.GO_LAST_EDIT.id);
617
+ commands.registerAlias('workbench.action.navigateToLastEditLocation', EditorCommands.GO_LAST_EDIT.id);
617
618
  commands.registerCommand({ id: 'openInTerminal' }, {
618
- execute: (resource) => this.terminalContribution.openInTerminal(new uri_1.default(resource.toString()))
619
+ execute: (resource) => this.terminalContribution.openInTerminal(new TheiaURI(resource.toString()))
619
620
  });
620
621
  commands.registerCommand({ id: 'workbench.action.reloadWindow' }, {
621
622
  execute: () => {
@@ -678,7 +679,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
678
679
  if (!Array.isArray(value) || value === undefined) {
679
680
  return undefined;
680
681
  }
681
- return value.map(loc => (0, type_converters_1.toMergedSymbol)(resource, loc));
682
+ return value.map(loc => toMergedSymbol(resource, loc));
682
683
  })
683
684
  });
684
685
  commands.registerCommand({
@@ -715,7 +716,7 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
715
716
  id: 'vscode.executeWorkspaceSymbolProvider'
716
717
  }, {
717
718
  execute: async (queryString) => (await Promise.all(this.monacoLanguages.workspaceSymbolProviders
718
- .map(async (provider) => provider.provideWorkspaceSymbols({ query: queryString }, new core_1.CancellationTokenSource().token))))
719
+ .map(async (provider) => provider.provideWorkspaceSymbols({ query: queryString }, new CancellationTokenSource().token))))
719
720
  .flatMap(symbols => symbols)
720
721
  .filter(symbols => !!symbols)
721
722
  });
@@ -724,9 +725,9 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
724
725
  }, {
725
726
  execute: async (resource, position) => {
726
727
  const provider = await this.getCallHierarchyServiceForUri(resource);
727
- const definition = await provider?.getRootDefinition(resource.path, (0, type_converters_1.toPosition)(position), new core_1.CancellationTokenSource().token);
728
+ const definition = await provider?.getRootDefinition(resource.path, toPosition(position), new CancellationTokenSource().token);
728
729
  if (definition) {
729
- return definition.items.map(item => (0, hierarchy_types_converters_1.fromItemHierarchyDefinition)(item));
730
+ return definition.items.map(item => fromItemHierarchyDefinition(item));
730
731
  }
731
732
  ;
732
733
  return [];
@@ -736,11 +737,11 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
736
737
  id: 'vscode.provideIncomingCalls'
737
738
  }, {
738
739
  execute: async (item) => {
739
- const resource = vscode_uri_1.URI.from(item.uri);
740
+ const resource = URI.from(item.uri);
740
741
  const provider = await this.getCallHierarchyServiceForUri(resource);
741
- const incomingCalls = await provider?.getCallers((0, hierarchy_types_converters_1.toItemHierarchyDefinition)(item), new core_1.CancellationTokenSource().token);
742
+ const incomingCalls = await provider?.getCallers(toItemHierarchyDefinition(item), new CancellationTokenSource().token);
742
743
  if (incomingCalls) {
743
- return incomingCalls.map(hierarchy_types_converters_1.fromCallHierarchyCallerToModelCallHierarchyIncomingCall);
744
+ return incomingCalls.map(fromCallHierarchyCallerToModelCallHierarchyIncomingCall);
744
745
  }
745
746
  return [];
746
747
  },
@@ -749,11 +750,11 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
749
750
  id: 'vscode.provideOutgoingCalls'
750
751
  }, {
751
752
  execute: async (item) => {
752
- const resource = vscode_uri_1.URI.from(item.uri);
753
+ const resource = URI.from(item.uri);
753
754
  const provider = await this.getCallHierarchyServiceForUri(resource);
754
- const outgoingCalls = await provider?.getCallees?.((0, hierarchy_types_converters_1.toItemHierarchyDefinition)(item), new core_1.CancellationTokenSource().token);
755
+ const outgoingCalls = await provider?.getCallees?.(toItemHierarchyDefinition(item), new CancellationTokenSource().token);
755
756
  if (outgoingCalls) {
756
- return outgoingCalls.map(hierarchy_types_converters_1.fromCallHierarchyCalleeToModelCallHierarchyOutgoingCall);
757
+ return outgoingCalls.map(fromCallHierarchyCalleeToModelCallHierarchyOutgoingCall);
757
758
  }
758
759
  return [];
759
760
  }
@@ -763,8 +764,8 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
763
764
  }, {
764
765
  execute: async (resource, position) => {
765
766
  const provider = await this.getTypeHierarchyServiceForUri(resource);
766
- const session = await provider?.prepareSession(resource.path, (0, type_converters_1.toPosition)(position), new core_1.CancellationTokenSource().token);
767
- return session ? session.items.map(item => (0, hierarchy_types_converters_1.fromItemHierarchyDefinition)(item)) : [];
767
+ const session = await provider?.prepareSession(resource.path, toPosition(position), new CancellationTokenSource().token);
768
+ return session ? session.items.map(item => fromItemHierarchyDefinition(item)) : [];
768
769
  }
769
770
  });
770
771
  commands.registerCommand({
@@ -774,10 +775,10 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
774
775
  if (!item._sessionId || !item._itemId) {
775
776
  return [];
776
777
  }
777
- const resource = vscode_uri_1.URI.from(item.uri);
778
+ const resource = URI.from(item.uri);
778
779
  const provider = await this.getTypeHierarchyServiceForUri(resource);
779
- const items = await provider?.provideSuperTypes(item._sessionId, item._itemId, new core_1.CancellationTokenSource().token);
780
- return (items ? items : []).map(typeItem => (0, hierarchy_types_converters_1.fromItemHierarchyDefinition)(typeItem));
780
+ const items = await provider?.provideSuperTypes(item._sessionId, item._itemId, new CancellationTokenSource().token);
781
+ return (items ? items : []).map(typeItem => fromItemHierarchyDefinition(typeItem));
781
782
  }
782
783
  });
783
784
  commands.registerCommand({
@@ -787,10 +788,10 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
787
788
  if (!item._sessionId || !item._itemId) {
788
789
  return [];
789
790
  }
790
- const resource = vscode_uri_1.URI.from(item.uri);
791
+ const resource = URI.from(item.uri);
791
792
  const provider = await this.getTypeHierarchyServiceForUri(resource);
792
- const items = await provider?.provideSubTypes(item._sessionId, item._itemId, new core_1.CancellationTokenSource().token);
793
- return (items ? items : []).map(typeItem => (0, hierarchy_types_converters_1.fromItemHierarchyDefinition)(typeItem));
793
+ const items = await provider?.provideSubTypes(item._sessionId, item._itemId, new CancellationTokenSource().token);
794
+ return (items ? items : []).map(typeItem => fromItemHierarchyDefinition(typeItem));
794
795
  }
795
796
  });
796
797
  commands.registerCommand({
@@ -801,9 +802,9 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
801
802
  commands.registerCommand({
802
803
  id: 'explorer.newFolder'
803
804
  }, {
804
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.NEW_FOLDER.id)
805
+ execute: () => commands.executeCommand(WorkspaceCommands.NEW_FOLDER.id)
805
806
  });
806
- commands.registerAlias('explorer.newFolder', browser_3.WorkspaceCommands.NEW_FOLDER.id);
807
+ commands.registerAlias('explorer.newFolder', WorkspaceCommands.NEW_FOLDER.id);
807
808
  commands.registerCommand({
808
809
  id: 'workbench.action.terminal.sendSequence'
809
810
  }, {
@@ -832,37 +833,37 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
832
833
  commands.registerCommand({
833
834
  id: 'workbench.view.explorer'
834
835
  }, {
835
- execute: () => commands.executeCommand(navigator_contribution_1.FileNavigatorCommands.FOCUS.id)
836
+ execute: () => commands.executeCommand(FileNavigatorCommands.FOCUS.id)
836
837
  });
837
- commands.registerAlias('workbench.view.explorer', navigator_contribution_1.FileNavigatorCommands.FOCUS.id);
838
+ commands.registerAlias('workbench.view.explorer', FileNavigatorCommands.FOCUS.id);
838
839
  commands.registerCommand({
839
840
  id: 'copyFilePath'
840
841
  }, {
841
- execute: () => commands.executeCommand(browser_1.CommonCommands.COPY_PATH.id)
842
+ execute: () => commands.executeCommand(CommonCommands.COPY_PATH.id)
842
843
  });
843
- commands.registerAlias('copyFilePath', browser_1.CommonCommands.COPY_PATH.id);
844
+ commands.registerAlias('copyFilePath', CommonCommands.COPY_PATH.id);
844
845
  commands.registerCommand({
845
846
  id: 'copyRelativeFilePath'
846
847
  }, {
847
- execute: () => commands.executeCommand(browser_3.WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id)
848
+ execute: () => commands.executeCommand(WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id)
848
849
  });
849
- commands.registerAlias('copyRelativeFilePath', browser_3.WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id);
850
+ commands.registerAlias('copyRelativeFilePath', WorkspaceCommands.COPY_RELATIVE_FILE_PATH.id);
850
851
  commands.registerCommand({
851
852
  id: 'revealInExplorer'
852
853
  }, {
853
854
  execute: async (resource) => {
854
- if (!vscode_uri_1.URI.isUri(resource)) {
855
+ if (!URI.isUri(resource)) {
855
856
  return;
856
857
  }
857
- let navigator = await this.shell.revealWidget(browser_4.FILE_NAVIGATOR_ID);
858
+ let navigator = await this.shell.revealWidget(FILE_NAVIGATOR_ID);
858
859
  if (!navigator) {
859
- await this.commandService.executeCommand(navigator_contribution_1.FILE_NAVIGATOR_TOGGLE_COMMAND_ID);
860
- navigator = await this.shell.revealWidget(browser_4.FILE_NAVIGATOR_ID);
860
+ await this.commandService.executeCommand(FILE_NAVIGATOR_TOGGLE_COMMAND_ID);
861
+ navigator = await this.shell.revealWidget(FILE_NAVIGATOR_ID);
861
862
  }
862
- if (navigator instanceof browser_4.FileNavigatorWidget) {
863
+ if (navigator instanceof FileNavigatorWidget) {
863
864
  const model = navigator.model;
864
- const node = await model.revealFile(new uri_1.default(resource));
865
- if (tree_selection_1.SelectableTreeNode.is(node)) {
865
+ const node = await model.revealFile(new TheiaURI(resource));
866
+ if (SelectableTreeNode.is(node)) {
866
867
  model.selectNode(node);
867
868
  }
868
869
  }
@@ -951,17 +952,11 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
951
952
  });
952
953
  commands.registerCommand({ id: '_open.mergeEditor' }, {
953
954
  execute: async (arg) => {
954
- const toTheiaUri = (o) => {
955
- if (typeof o === 'string') {
956
- return new uri_1.default(o);
957
- }
958
- return uri_1.default.fromComponents(o);
959
- };
960
955
  const baseUri = toTheiaUri(arg.base);
961
956
  const resultUri = toTheiaUri(arg.output);
962
957
  const side1Uri = typeof arg.input1 === 'string' ? toTheiaUri(arg.input1) : toTheiaUri(arg.input1.uri);
963
958
  const side2Uri = typeof arg.input2 === 'string' ? toTheiaUri(arg.input2) : toTheiaUri(arg.input2.uri);
964
- const uri = merge_editor_1.MergeEditorUri.encode({ baseUri, side1Uri, side2Uri, resultUri });
959
+ const uri = MergeEditorUri.encode({ baseUri, side1Uri, side2Uri, resultUri });
965
960
  let side1State = undefined;
966
961
  if (typeof arg.input1 !== 'string') {
967
962
  const { title, description, detail } = arg.input1;
@@ -973,38 +968,78 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
973
968
  side2State = { title, description, detail };
974
969
  }
975
970
  const options = { widgetState: { side1State, side2State } };
976
- await (0, browser_1.open)(this.openerService, uri, options);
971
+ await open(this.openerService, uri, options);
977
972
  }
978
973
  });
979
- // Temporary workaround: opens a single diff editor for the revealed resource.
980
- // TODO: GH-16280 implement a proper MultiDiffEditor widget.
981
- commands.registerCommand({ id: '_workbench.openMultiDiffEditor' }, {
974
+ commands.registerCommand({ id: '_workbench.openScmMultiDiffEditor' }, {
982
975
  execute: async (options) => {
983
- if (!options.resources?.length) {
976
+ const repositoryUri = toTheiaUri(options.repositoryUri);
977
+ if (!repositoryUri) {
984
978
  return;
985
979
  }
986
- const revealModified = options.reveal?.modifiedUri;
987
- const revealStr = revealModified ? vscode_uri_1.URI.revive(revealModified)?.toString() : undefined;
988
- const target = revealStr
989
- ? options.resources.find(r => vscode_uri_1.URI.revive(r.modifiedUri)?.toString() === revealStr)
990
- : undefined;
991
- const resource = target ?? options.resources[0];
992
- const left = vscode_uri_1.URI.revive(resource.originalUri);
993
- const right = vscode_uri_1.URI.revive(resource.modifiedUri);
994
- if (left && right) {
995
- await commands.executeCommand(VscodeCommands.DIFF.id, left, right, options.title);
980
+ const repository = this.scmService.repositories.find(repo => new TheiaURI(repo.provider.rootUri).isEqual(repositoryUri));
981
+ const group = repository?.provider.groups.find(candidate => candidate.id === options.resourceGroupId);
982
+ if (!group) {
983
+ return;
996
984
  }
997
- else if (right) {
998
- await commands.executeCommand(VscodeCommands.OPEN.id, right);
985
+ await commands.executeCommand('_workbench.openMultiDiffEditor', {
986
+ title: options.title,
987
+ resources: group.resources.map(resource => ({
988
+ originalUri: resource.multiDiffEditorOriginalUri?.toComponents(),
989
+ modifiedUri: resource.multiDiffEditorModifiedUri?.toComponents()
990
+ }))
991
+ });
992
+ }
993
+ });
994
+ commands.registerCommand({ id: '_workbench.openMultiDiffEditor' }, {
995
+ execute: async (options) => {
996
+ if (!options.resources?.length) {
997
+ return;
999
998
  }
1000
- else if (left) {
1001
- await commands.executeCommand(VscodeCommands.OPEN.id, left);
999
+ const resources = options.resources
1000
+ .map(r => {
1001
+ const originalUri = toTheiaUri(r.originalUri);
1002
+ const modifiedUri = toTheiaUri(r.modifiedUri);
1003
+ const resourceUri = modifiedUri ?? originalUri;
1004
+ if (!resourceUri) {
1005
+ return undefined;
1006
+ }
1007
+ const emptyUri = new TheiaURI().withScheme(MEMORY_TEXT_READONLY).withPath(resourceUri.path);
1008
+ return { originalUri: originalUri ?? emptyUri, modifiedUri: modifiedUri ?? emptyUri };
1009
+ })
1010
+ .filter((r) => r !== undefined);
1011
+ if (!resources.length) {
1012
+ return;
1002
1013
  }
1014
+ const uri = MultiDiffEditorUri.encode({ title: options.title, resources });
1015
+ const reveal = toTheiaUri(options.reveal?.modifiedUri);
1016
+ const openerOptions = { reveal };
1017
+ await open(this.openerService, uri, openerOptions);
1003
1018
  },
1004
1019
  });
1005
1020
  }
1021
+ /**
1022
+ * Installs an extension by its (optionally versioned) ID. Installing an extension that is already installed is a noop.
1023
+ */
1024
+ async installExtensionFromId(extensionIdOrVersionedId) {
1025
+ let extensionId = extensionIdOrVersionedId;
1026
+ let opts;
1027
+ const versionedId = PluginIdentifiers.idAndVersionFromVersionedId(extensionIdOrVersionedId);
1028
+ if (versionedId) {
1029
+ extensionId = versionedId.id;
1030
+ opts = { version: versionedId.version, ignoreOtherVersions: true };
1031
+ }
1032
+ try {
1033
+ await this.pluginServer.install(VSCodeExtensionUri.fromId(extensionId).toString(), undefined, opts);
1034
+ }
1035
+ catch (e) {
1036
+ if (!DuplicateExtensionError.is(e)) {
1037
+ throw e;
1038
+ }
1039
+ }
1040
+ }
1006
1041
  async deployPlugin(uri) {
1007
- const uriPath = (0, type_converters_1.isUriComponents)(uri) ? vscode_uri_1.URI.revive(uri).fsPath : await this.fileService.fsPath(uri);
1042
+ const uriPath = isUriComponents(uri) ? URI.revive(uri).fsPath : await this.fileService.fsPath(uri);
1008
1043
  return this.pluginServer.install(`local-file:${uriPath}`);
1009
1044
  }
1010
1045
  async resolveLanguageId(resource) {
@@ -1015,109 +1050,89 @@ let PluginVscodeCommandsContribution = class PluginVscodeCommandsContribution {
1015
1050
  }
1016
1051
  async getCallHierarchyServiceForUri(resource) {
1017
1052
  const languageId = await this.resolveLanguageId(resource);
1018
- return this.callHierarchyProvider.get(languageId, new uri_1.default(resource));
1053
+ return this.callHierarchyProvider.get(languageId, new TheiaURI(resource));
1019
1054
  }
1020
1055
  async getTypeHierarchyServiceForUri(resource) {
1021
1056
  const languageId = await this.resolveLanguageId(resource);
1022
- return this.typeHierarchyProvider.get(languageId, new uri_1.default(resource));
1057
+ return this.typeHierarchyProvider.get(languageId, new TheiaURI(resource));
1023
1058
  }
1024
1059
  };
1025
- exports.PluginVscodeCommandsContribution = PluginVscodeCommandsContribution;
1026
- tslib_1.__decorate([
1027
- (0, inversify_1.inject)(command_1.CommandService),
1028
- tslib_1.__metadata("design:type", Object)
1060
+ __decorate([
1061
+ inject(CommandService)
1029
1062
  ], PluginVscodeCommandsContribution.prototype, "commandService", void 0);
1030
- tslib_1.__decorate([
1031
- (0, inversify_1.inject)(context_key_service_1.ContextKeyService),
1032
- tslib_1.__metadata("design:type", Object)
1063
+ __decorate([
1064
+ inject(ContextKeyService)
1033
1065
  ], PluginVscodeCommandsContribution.prototype, "contextKeyService", void 0);
1034
- tslib_1.__decorate([
1035
- (0, inversify_1.inject)(browser_2.EditorManager),
1036
- tslib_1.__metadata("design:type", browser_2.EditorManager)
1066
+ __decorate([
1067
+ inject(EditorManager)
1037
1068
  ], PluginVscodeCommandsContribution.prototype, "editorManager", void 0);
1038
- tslib_1.__decorate([
1039
- (0, inversify_1.inject)(browser_1.ApplicationShell),
1040
- tslib_1.__metadata("design:type", browser_1.ApplicationShell)
1069
+ __decorate([
1070
+ inject(ApplicationShell)
1041
1071
  ], PluginVscodeCommandsContribution.prototype, "shell", void 0);
1042
- tslib_1.__decorate([
1043
- (0, inversify_1.inject)(diff_service_1.DiffService),
1044
- tslib_1.__metadata("design:type", diff_service_1.DiffService)
1072
+ __decorate([
1073
+ inject(DiffService)
1045
1074
  ], PluginVscodeCommandsContribution.prototype, "diffService", void 0);
1046
- tslib_1.__decorate([
1047
- (0, inversify_1.inject)(browser_1.OpenerService),
1048
- tslib_1.__metadata("design:type", Object)
1075
+ __decorate([
1076
+ inject(OpenerService)
1049
1077
  ], PluginVscodeCommandsContribution.prototype, "openerService", void 0);
1050
- tslib_1.__decorate([
1051
- (0, inversify_1.inject)(application_shell_mouse_tracker_1.ApplicationShellMouseTracker),
1052
- tslib_1.__metadata("design:type", application_shell_mouse_tracker_1.ApplicationShellMouseTracker)
1078
+ __decorate([
1079
+ inject(ApplicationShellMouseTracker)
1053
1080
  ], PluginVscodeCommandsContribution.prototype, "mouseTracker", void 0);
1054
- tslib_1.__decorate([
1055
- (0, inversify_1.inject)(browser_1.QuickInputService),
1056
- (0, inversify_1.optional)(),
1057
- tslib_1.__metadata("design:type", Object)
1081
+ __decorate([
1082
+ inject(QuickInputService),
1083
+ optional()
1058
1084
  ], PluginVscodeCommandsContribution.prototype, "quickInput", void 0);
1059
- tslib_1.__decorate([
1060
- (0, inversify_1.inject)(workspace_service_1.WorkspaceService),
1061
- tslib_1.__metadata("design:type", workspace_service_1.WorkspaceService)
1085
+ __decorate([
1086
+ inject(WorkspaceService)
1062
1087
  ], PluginVscodeCommandsContribution.prototype, "workspaceService", void 0);
1063
- tslib_1.__decorate([
1064
- (0, inversify_1.inject)(terminal_frontend_contribution_1.TerminalFrontendContribution),
1065
- tslib_1.__metadata("design:type", terminal_frontend_contribution_1.TerminalFrontendContribution)
1088
+ __decorate([
1089
+ inject(TerminalFrontendContribution)
1066
1090
  ], PluginVscodeCommandsContribution.prototype, "terminalContribution", void 0);
1067
- tslib_1.__decorate([
1068
- (0, inversify_1.inject)(quick_open_workspace_1.QuickOpenWorkspace),
1069
- tslib_1.__metadata("design:type", quick_open_workspace_1.QuickOpenWorkspace)
1091
+ __decorate([
1092
+ inject(QuickOpenWorkspace)
1070
1093
  ], PluginVscodeCommandsContribution.prototype, "quickOpenWorkspace", void 0);
1071
- tslib_1.__decorate([
1072
- (0, inversify_1.inject)(terminal_service_1.TerminalService),
1073
- tslib_1.__metadata("design:type", Object)
1094
+ __decorate([
1095
+ inject(TerminalService)
1074
1096
  ], PluginVscodeCommandsContribution.prototype, "terminalService", void 0);
1075
- tslib_1.__decorate([
1076
- (0, inversify_1.inject)(plugin_protocol_1.PluginServer),
1077
- tslib_1.__metadata("design:type", Object)
1097
+ __decorate([
1098
+ inject(PluginServer)
1078
1099
  ], PluginVscodeCommandsContribution.prototype, "pluginServer", void 0);
1079
- tslib_1.__decorate([
1080
- (0, inversify_1.inject)(file_service_1.FileService),
1081
- tslib_1.__metadata("design:type", file_service_1.FileService)
1100
+ __decorate([
1101
+ inject(FileService)
1082
1102
  ], PluginVscodeCommandsContribution.prototype, "fileService", void 0);
1083
- tslib_1.__decorate([
1084
- (0, inversify_1.inject)(browser_5.CallHierarchyServiceProvider),
1085
- tslib_1.__metadata("design:type", browser_5.CallHierarchyServiceProvider)
1103
+ __decorate([
1104
+ inject(CallHierarchyServiceProvider)
1086
1105
  ], PluginVscodeCommandsContribution.prototype, "callHierarchyProvider", void 0);
1087
- tslib_1.__decorate([
1088
- (0, inversify_1.inject)(browser_6.TypeHierarchyServiceProvider),
1089
- tslib_1.__metadata("design:type", browser_6.TypeHierarchyServiceProvider)
1106
+ __decorate([
1107
+ inject(TypeHierarchyServiceProvider)
1090
1108
  ], PluginVscodeCommandsContribution.prototype, "typeHierarchyProvider", void 0);
1091
- tslib_1.__decorate([
1092
- (0, inversify_1.inject)(monaco_text_model_service_1.MonacoTextModelService),
1093
- tslib_1.__metadata("design:type", monaco_text_model_service_1.MonacoTextModelService)
1109
+ __decorate([
1110
+ inject(MonacoTextModelService)
1094
1111
  ], PluginVscodeCommandsContribution.prototype, "textModelService", void 0);
1095
- tslib_1.__decorate([
1096
- (0, inversify_1.inject)(window_service_1.WindowService),
1097
- tslib_1.__metadata("design:type", Object)
1112
+ __decorate([
1113
+ inject(WindowService)
1098
1114
  ], PluginVscodeCommandsContribution.prototype, "windowService", void 0);
1099
- tslib_1.__decorate([
1100
- (0, inversify_1.inject)(core_1.MessageService),
1101
- tslib_1.__metadata("design:type", core_1.MessageService)
1115
+ __decorate([
1116
+ inject(MessageService)
1102
1117
  ], PluginVscodeCommandsContribution.prototype, "messageService", void 0);
1103
- tslib_1.__decorate([
1104
- (0, inversify_1.inject)(outline_view_contribution_1.OutlineViewContribution),
1105
- tslib_1.__metadata("design:type", outline_view_contribution_1.OutlineViewContribution)
1118
+ __decorate([
1119
+ inject(OutlineViewContribution)
1106
1120
  ], PluginVscodeCommandsContribution.prototype, "outlineViewContribution", void 0);
1107
- tslib_1.__decorate([
1108
- (0, inversify_1.inject)(monaco_languages_1.MonacoLanguages),
1109
- tslib_1.__metadata("design:type", monaco_languages_1.MonacoLanguages)
1121
+ __decorate([
1122
+ inject(MonacoLanguages)
1110
1123
  ], PluginVscodeCommandsContribution.prototype, "monacoLanguages", void 0);
1111
- tslib_1.__decorate([
1112
- (0, inversify_1.inject)(scm_contribution_1.ScmContribution),
1113
- tslib_1.__metadata("design:type", scm_contribution_1.ScmContribution)
1124
+ __decorate([
1125
+ inject(ScmContribution)
1114
1126
  ], PluginVscodeCommandsContribution.prototype, "scmContribution", void 0);
1115
- tslib_1.__decorate([
1116
- (0, inversify_1.inject)(core_1.ILogger),
1117
- (0, inversify_1.named)('plugin-ext-vscode:PluginVscodeCommandsContribution'),
1118
- tslib_1.__metadata("design:type", Object)
1127
+ __decorate([
1128
+ inject(ScmService)
1129
+ ], PluginVscodeCommandsContribution.prototype, "scmService", void 0);
1130
+ __decorate([
1131
+ inject(ILogger),
1132
+ named('plugin-ext-vscode:PluginVscodeCommandsContribution')
1119
1133
  ], PluginVscodeCommandsContribution.prototype, "logger", void 0);
1120
- exports.PluginVscodeCommandsContribution = PluginVscodeCommandsContribution = tslib_1.__decorate([
1121
- (0, inversify_1.injectable)()
1134
+ PluginVscodeCommandsContribution = __decorate([
1135
+ injectable()
1122
1136
  ], PluginVscodeCommandsContribution);
1137
+ export { PluginVscodeCommandsContribution };
1123
1138
  //# sourceMappingURL=plugin-vscode-commands-contribution.js.map