@codingame/monaco-vscode-api 2.1.3 → 2.2.0-next.1

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 (191) hide show
  1. package/README.md +10 -0
  2. package/contributions.js +1 -0
  3. package/extensions.d.ts +6 -3
  4. package/extensions.js +18 -7
  5. package/lifecycle.js +11 -3
  6. package/missing-services.js +55 -10
  7. package/monaco.js +7 -3
  8. package/package.json +8 -8
  9. package/service-override/tools/editor.js +3 -1
  10. package/service-override/tools/views.d.ts +98 -0
  11. package/service-override/tools/views.js +249 -0
  12. package/services.d.ts +4 -2
  13. package/services.js +11 -9
  14. package/vscode/src/vs/base/browser/deviceAccess.js +60 -0
  15. package/vscode/src/vs/base/browser/dom.js +18 -1
  16. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +178 -0
  17. package/vscode/src/vs/base/browser/ui/grid/grid.js +492 -0
  18. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +4 -0
  19. package/vscode/src/vs/base/browser/ui/grid/gridview.d.ts +1 -0
  20. package/vscode/src/vs/base/browser/ui/grid/gridview.js +1109 -0
  21. package/vscode/src/vs/base/browser/ui/sash/sash.js +9 -1
  22. package/vscode/src/vs/base/browser/ui/splitview/splitview.d.ts +348 -1
  23. package/vscode/src/vs/base/common/async.js +46 -2
  24. package/vscode/src/vs/base/common/codicons.d.ts +579 -0
  25. package/vscode/src/vs/base/common/event.js +11 -2
  26. package/vscode/src/vs/base/common/keybindingParser.js +87 -0
  27. package/vscode/src/vs/base/common/network.js +1 -2
  28. package/vscode/src/vs/base/common/observableInternal/utils.js +1 -1
  29. package/vscode/src/vs/base/common/platform.js +2 -1
  30. package/vscode/src/vs/base/common/scrollable.d.ts +28 -0
  31. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/colors.js +17 -0
  32. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/diffEditorItemTemplate.js +214 -0
  33. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorViewModel.js +84 -0
  34. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidget.js +54 -0
  35. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/multiDiffEditorWidgetImpl.js +324 -0
  36. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/objectPool.js +46 -0
  37. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/style.css.js +4 -0
  38. package/vscode/src/vs/editor/browser/widget/multiDiffEditorWidget/utils.js +11 -0
  39. package/vscode/src/vs/platform/keyboardLayout/common/keyboardLayout.js +61 -1
  40. package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +10 -0
  41. package/vscode/src/vs/platform/log/browser/log.js +24 -0
  42. package/vscode/src/vs/platform/product/common/product.js +1 -2
  43. package/vscode/src/vs/platform/userDataSync/common/abstractSynchronizer.js +772 -0
  44. package/vscode/src/vs/platform/userDataSync/common/userDataSyncStoreService.js +551 -0
  45. package/vscode/src/vs/platform/webview/common/mimeTypes.js +22 -0
  46. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +62 -0
  47. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +788 -0
  48. package/vscode/src/vs/workbench/browser/actions/listCommands.js +763 -0
  49. package/vscode/src/vs/workbench/browser/layout.d.ts +26 -0
  50. package/vscode/src/vs/workbench/browser/media/style.css.js +1 -1
  51. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +610 -0
  52. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +4 -0
  53. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +4 -0
  54. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +148 -0
  55. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +4 -0
  56. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +603 -0
  57. package/vscode/src/vs/workbench/browser/parts/compositePart.js +333 -0
  58. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +221 -0
  59. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1406 -0
  60. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +184 -0
  61. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +509 -0
  62. package/vscode/src/vs/workbench/browser/parts/editor/editorPane.d.ts +112 -0
  63. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1018 -0
  64. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +389 -0
  65. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +4 -0
  66. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +4 -0
  67. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +4 -0
  68. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsActions.css.js +4 -0
  69. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsCenter.css.js +4 -0
  70. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsList.css.js +4 -0
  71. package/vscode/src/vs/workbench/browser/parts/notifications/media/notificationsToasts.css.js +4 -0
  72. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsActions.js +213 -0
  73. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsAlerts.js +73 -0
  74. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsCenter.js +307 -0
  75. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsList.js +226 -0
  76. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsStatus.js +218 -0
  77. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsToasts.js +433 -0
  78. package/vscode/src/vs/workbench/browser/parts/notifications/notificationsViewer.js +436 -0
  79. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
  80. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +377 -0
  81. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +66 -0
  82. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +144 -0
  83. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +4 -0
  84. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +220 -0
  85. package/vscode/src/vs/workbench/browser/window.js +239 -5
  86. package/vscode/src/vs/workbench/common/configuration.js +11 -1
  87. package/vscode/src/vs/workbench/common/theme.js +3 -3
  88. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +298 -0
  89. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +363 -0
  90. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +133 -0
  91. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +4 -0
  92. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +90 -0
  93. package/vscode/src/vs/workbench/contrib/comments/browser/commentMenus.js +43 -0
  94. package/vscode/src/vs/workbench/contrib/comments/browser/commentService.js +317 -2
  95. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +107 -0
  96. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +395 -0
  97. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +3 -0
  98. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1277 -0
  99. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +17 -0
  100. package/vscode/src/vs/workbench/contrib/comments/browser/commentsModel.js +123 -0
  101. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +342 -0
  102. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +451 -0
  103. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +176 -0
  104. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +4 -0
  105. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +35 -0
  106. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +16 -0
  107. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +143 -0
  108. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +212 -0
  109. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +4 -0
  110. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +76 -0
  111. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +61 -0
  112. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +117 -0
  113. package/vscode/src/vs/workbench/contrib/editSessions/common/editSessions.js +62 -0
  114. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +5 -0
  115. package/vscode/src/vs/workbench/contrib/files/browser/editors/binaryFileEditor.js +77 -0
  116. package/vscode/src/vs/workbench/contrib/files/browser/editors/fileEditorHandler.js +72 -0
  117. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditor.js +254 -0
  118. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileEditorTracker.js +97 -0
  119. package/vscode/src/vs/workbench/contrib/files/browser/editors/textFileSaveErrorHandler.js +442 -0
  120. package/vscode/src/vs/workbench/contrib/files/browser/explorerService.js +430 -0
  121. package/vscode/src/vs/workbench/contrib/files/browser/fileActions.contribution.js +784 -0
  122. package/vscode/src/vs/workbench/contrib/files/browser/fileCommands.js +487 -0
  123. package/vscode/src/vs/workbench/contrib/files/browser/files.contribution.js +521 -0
  124. package/vscode/src/vs/workbench/contrib/files/browser/workspaceWatcher.js +150 -0
  125. package/vscode/src/vs/workbench/contrib/files/common/dirtyFilesIndicator.js +61 -0
  126. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveDocumentService.js +25 -1
  127. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +178 -0
  128. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +49 -0
  129. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
  130. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +4 -0
  131. package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +145 -0
  132. package/vscode/src/vs/workbench/contrib/mappedEdits/common/mappedEdits.contribution.js +22 -0
  133. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +691 -0
  134. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +238 -0
  135. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +76 -0
  136. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +40 -0
  137. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +69 -0
  138. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +346 -0
  139. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +96 -0
  140. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +144 -0
  141. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +103 -0
  142. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +399 -0
  143. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +195 -0
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +39 -0
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +126 -0
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +4 -0
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +611 -0
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +156 -0
  149. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +262 -0
  150. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +171 -0
  151. package/vscode/src/vs/workbench/contrib/multiDiffEditor/browser/multiDiffSourceResolverService.js +41 -0
  152. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController.js +317 -0
  153. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/notebookVisibleCellObserver.js +56 -0
  154. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget.js +315 -0
  155. package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +193 -0
  156. package/vscode/src/vs/workbench/contrib/preferences/common/preferences.js +2 -1
  157. package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +37 -0
  158. package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +39 -0
  159. package/vscode/src/vs/workbench/contrib/speech/common/speechService.js +138 -2
  160. package/vscode/src/vs/workbench/contrib/tags/browser/workspaceTagsService.js +12 -0
  161. package/vscode/src/vs/workbench/contrib/tags/common/workspaceTags.js +3 -0
  162. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +4 -0
  163. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +281 -0
  164. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +358 -0
  165. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +131 -0
  166. package/vscode/src/vs/workbench/contrib/update/common/update.js +2 -0
  167. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +288 -0
  168. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +94 -0
  169. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +86 -0
  170. package/vscode/src/vs/workbench/contrib/webview/browser/webview.contribution.js +77 -0
  171. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +646 -0
  172. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +63 -0
  173. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +57 -0
  174. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +140 -0
  175. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +119 -0
  176. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
  177. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +233 -0
  178. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +143 -0
  179. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +0 -3
  180. package/vscode/src/vs/workbench/services/driver/browser/driver.js +184 -0
  181. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +668 -0
  182. package/vscode/src/vs/workbench/services/history/browser/historyService.js +1482 -0
  183. package/vscode/src/vs/workbench/services/layout/browser/layoutService.js +17 -1
  184. package/vscode/src/vs/workbench/services/lifecycle/common/lifecycle.js +8 -1
  185. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +4 -0
  186. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +521 -0
  187. package/vscode/src/vs/workbench/services/textMate/common/TMGrammars.js +102 -0
  188. package/vscode/src/vs/workbench/services/themes/common/tokenClassificationExtensionPoint.js +296 -0
  189. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +99 -0
  190. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
  191. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +596 -0
@@ -0,0 +1,487 @@
1
+ import { toErrorMessage } from '../../../../base/common/errorMessage.js';
2
+ import { KeyChord } from '../../../../base/common/keyCodes.js';
3
+ import { dispose } from '../../../../base/common/lifecycle.js';
4
+ import { Schemas } from '../../../../base/common/network.js';
5
+ import { isWeb, isWindows } from '../../../../base/common/platform.js';
6
+ import { basename, joinPath } from '../../../../base/common/resources.js';
7
+ import { EditorContextKeys } from '../../../../editor/common/editorContextKeys.js';
8
+ import { ITextModelService } from '../../../../editor/common/services/resolverService.js';
9
+ import { localizeWithPath } from '../../../../nls.js';
10
+ import { IClipboardService } from '../../../../platform/clipboard/common/clipboardService.js';
11
+ import { CommandsRegistry, ICommandService } from '../../../../platform/commands/common/commands.js';
12
+ import { IConfigurationService } from '../../../../platform/configuration/common/configuration.js';
13
+ import { ContextKeyExpr, IContextKeyService } from '../../../../platform/contextkey/common/contextkey.js';
14
+ import '../../../../../../../override/vs/platform/dialogs/common/dialogs.js';
15
+ import { EditorResolution, EditorOpenSource } from '../../../../platform/editor/common/editor.js';
16
+ import { IFileService } from '../../../../platform/files/common/files.js';
17
+ import { IInstantiationService } from '../../../../platform/instantiation/common/instantiation.js';
18
+ import { KeybindingsRegistry } from '../../../../platform/keybinding/common/keybindingsRegistry.js';
19
+ import { ILabelService } from '../../../../platform/label/common/label.js';
20
+ import { IListService } from '../../../../platform/list/browser/listService.js';
21
+ import { INotificationService } from '../../../../platform/notification/common/notification.js';
22
+ import { IUriIdentityService } from '../../../../platform/uriIdentity/common/uriIdentity.js';
23
+ import { IWorkspaceContextService } from '../../../../platform/workspace/common/workspace.js';
24
+ import { RemoveRootFolderAction } from '../../../browser/actions/workspaceActions.js';
25
+ import { EditorResourceAccessor, SideBySideEditor } from '../../../common/editor.js';
26
+ import { IExplorerService, getMultiSelectedResources, getResourceForCommand, getOpenEditorsViewMultiSelection } from './files.js';
27
+ import { OpenEditorsView } from './views/openEditorsView.js';
28
+ import { ExplorerFocusCondition, FilesExplorerFocusCondition, ExplorerFolderContext, TextFileContentProvider, VIEW_ID, ExplorerCompressedFocusContext, ExplorerCompressedFirstFocusContext, VIEWLET_ID, ExplorerCompressedLastFocusContext } from '../common/files.js';
29
+ import { IEditorGroupsService } from '../../../services/editor/common/editorGroupsService.js';
30
+ import { IEditorService, SIDE_GROUP } from '../../../services/editor/common/editorService.js';
31
+ import { IPaneCompositePartService } from '../../../services/panecomposite/browser/panecomposite.js';
32
+ import { IViewsService } from '../../../services/views/common/viewsService.js';
33
+ import { IWorkspaceEditingService } from '../../../services/workspaces/common/workspaceEditing.js';
34
+ import { OPEN_TO_SIDE_COMMAND_ID, COMPARE_WITH_SAVED_COMMAND_ID, SELECT_FOR_COMPARE_COMMAND_ID, ResourceSelectedForCompareContext, COMPARE_SELECTED_COMMAND_ID, COMPARE_RESOURCE_COMMAND_ID, COPY_PATH_COMMAND_ID, COPY_RELATIVE_PATH_COMMAND_ID, REVEAL_IN_EXPLORER_COMMAND_ID, OPEN_WITH_EXPLORER_COMMAND_ID, REVERT_FILE_COMMAND_ID, REMOVE_ROOT_FOLDER_COMMAND_ID, PREVIOUS_COMPRESSED_FOLDER, NEXT_COMPRESSED_FOLDER, FIRST_COMPRESSED_FOLDER, LAST_COMPRESSED_FOLDER, NEW_UNTITLED_FILE_COMMAND_ID, NEW_UNTITLED_FILE_LABEL, NEW_FILE_COMMAND_ID } from './fileConstants.js';
35
+ import './fileCommands.save.js';
36
+ import { IFileDialogService } from '../../../../platform/dialogs/common/dialogs.js';
37
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
38
+ weight: 200 ,
39
+ when: ExplorerFocusCondition,
40
+ primary: 2048 | 3 ,
41
+ mac: {
42
+ primary: 256 | 3
43
+ },
44
+ id: OPEN_TO_SIDE_COMMAND_ID, handler: async (accessor, resource) => {
45
+ const editorService = accessor.get(IEditorService);
46
+ const listService = accessor.get(IListService);
47
+ const fileService = accessor.get(IFileService);
48
+ const explorerService = accessor.get(IExplorerService);
49
+ const resources = getMultiSelectedResources(resource, listService, editorService, explorerService);
50
+ if (resources.length) {
51
+ const untitledResources = resources.filter(resource => resource.scheme === Schemas.untitled);
52
+ const fileResources = resources.filter(resource => resource.scheme !== Schemas.untitled);
53
+ const items = await Promise.all(( fileResources.map(async (resource) => {
54
+ const item = explorerService.findClosest(resource);
55
+ if (item) {
56
+ return item;
57
+ }
58
+ return await fileService.stat(resource);
59
+ })));
60
+ const files = items.filter(i => !i.isDirectory);
61
+ const editors = ( files.map(f => ({
62
+ resource: f.resource,
63
+ options: { pinned: true }
64
+ }))).concat(...( untitledResources.map(
65
+ untitledResource => ({ resource: untitledResource, options: { pinned: true } })
66
+ )));
67
+ await editorService.openEditors(editors, SIDE_GROUP);
68
+ }
69
+ }
70
+ });
71
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
72
+ weight: 200 + 10,
73
+ when: ( ContextKeyExpr.and(FilesExplorerFocusCondition, ( ExplorerFolderContext.toNegated()))),
74
+ primary: 3 ,
75
+ mac: {
76
+ primary: 2048 | 18
77
+ },
78
+ id: 'explorer.openAndPassFocus', handler: async (accessor, _resource) => {
79
+ const editorService = accessor.get(IEditorService);
80
+ const explorerService = accessor.get(IExplorerService);
81
+ const resources = explorerService.getContext(true);
82
+ if (resources.length) {
83
+ await editorService.openEditors(( resources.map(
84
+ r => ({ resource: r.resource, options: { preserveFocus: false, pinned: true } })
85
+ )));
86
+ }
87
+ }
88
+ });
89
+ const COMPARE_WITH_SAVED_SCHEMA = 'showModifications';
90
+ let providerDisposables = [];
91
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
92
+ id: COMPARE_WITH_SAVED_COMMAND_ID,
93
+ when: undefined,
94
+ weight: 200 ,
95
+ primary: KeyChord(2048 | 41 , 34 ),
96
+ handler: async (accessor, resource) => {
97
+ const instantiationService = accessor.get(IInstantiationService);
98
+ const textModelService = accessor.get(ITextModelService);
99
+ const editorService = accessor.get(IEditorService);
100
+ const fileService = accessor.get(IFileService);
101
+ let registerEditorListener = false;
102
+ if (providerDisposables.length === 0) {
103
+ registerEditorListener = true;
104
+ const provider = instantiationService.createInstance(TextFileContentProvider);
105
+ providerDisposables.push(provider);
106
+ providerDisposables.push(textModelService.registerTextModelContentProvider(COMPARE_WITH_SAVED_SCHEMA, provider));
107
+ }
108
+ const uri = getResourceForCommand(resource, accessor.get(IListService), editorService);
109
+ if (uri && fileService.hasProvider(uri)) {
110
+ const name = basename(uri);
111
+ const editorLabel = ( localizeWithPath(
112
+ 'vs/workbench/contrib/files/browser/fileCommands',
113
+ 'modifiedLabel',
114
+ "{0} (in file) ↔ {1}",
115
+ name,
116
+ name
117
+ ));
118
+ try {
119
+ await TextFileContentProvider.open(uri, COMPARE_WITH_SAVED_SCHEMA, editorLabel, editorService, { pinned: true });
120
+ if (registerEditorListener) {
121
+ providerDisposables.push(editorService.onDidVisibleEditorsChange(() => {
122
+ if (!( editorService.editors.some(
123
+ editor => !!EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.SECONDARY, filterByScheme: COMPARE_WITH_SAVED_SCHEMA })
124
+ ))) {
125
+ providerDisposables = dispose(providerDisposables);
126
+ }
127
+ }));
128
+ }
129
+ }
130
+ catch {
131
+ providerDisposables = dispose(providerDisposables);
132
+ }
133
+ }
134
+ }
135
+ });
136
+ let globalResourceToCompare;
137
+ let resourceSelectedForCompareContext;
138
+ CommandsRegistry.registerCommand({
139
+ id: SELECT_FOR_COMPARE_COMMAND_ID,
140
+ handler: (accessor, resource) => {
141
+ const listService = accessor.get(IListService);
142
+ globalResourceToCompare = getResourceForCommand(resource, listService, accessor.get(IEditorService));
143
+ if (!resourceSelectedForCompareContext) {
144
+ resourceSelectedForCompareContext = ResourceSelectedForCompareContext.bindTo(accessor.get(IContextKeyService));
145
+ }
146
+ resourceSelectedForCompareContext.set(true);
147
+ }
148
+ });
149
+ CommandsRegistry.registerCommand({
150
+ id: COMPARE_SELECTED_COMMAND_ID,
151
+ handler: async (accessor, resource) => {
152
+ const editorService = accessor.get(IEditorService);
153
+ const explorerService = accessor.get(IExplorerService);
154
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), editorService, explorerService);
155
+ if (resources.length === 2) {
156
+ return editorService.openEditor({
157
+ original: { resource: resources[0] },
158
+ modified: { resource: resources[1] },
159
+ options: { pinned: true }
160
+ });
161
+ }
162
+ return true;
163
+ }
164
+ });
165
+ CommandsRegistry.registerCommand({
166
+ id: COMPARE_RESOURCE_COMMAND_ID,
167
+ handler: (accessor, resource) => {
168
+ const editorService = accessor.get(IEditorService);
169
+ const listService = accessor.get(IListService);
170
+ const rightResource = getResourceForCommand(resource, listService, editorService);
171
+ if (globalResourceToCompare && rightResource) {
172
+ editorService.openEditor({
173
+ original: { resource: globalResourceToCompare },
174
+ modified: { resource: rightResource },
175
+ options: { pinned: true }
176
+ });
177
+ }
178
+ }
179
+ });
180
+ async function resourcesToClipboard(resources, relative, clipboardService, labelService, configurationService) {
181
+ if (resources.length) {
182
+ const lineDelimiter = isWindows ? '\r\n' : '\n';
183
+ let separator = undefined;
184
+ if (relative) {
185
+ const relativeSeparator = configurationService.getValue('explorer.copyRelativePathSeparator');
186
+ if (relativeSeparator === '/' || relativeSeparator === '\\') {
187
+ separator = relativeSeparator;
188
+ }
189
+ }
190
+ const text = ( resources.map(
191
+ resource => labelService.getUriLabel(resource, { relative, noPrefix: true, separator })
192
+ )).join(lineDelimiter);
193
+ await clipboardService.writeText(text);
194
+ }
195
+ }
196
+ const copyPathCommandHandler = async (accessor, resource) => {
197
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService));
198
+ await resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
199
+ };
200
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
201
+ weight: 200 ,
202
+ when: ( EditorContextKeys.focus.toNegated()),
203
+ primary: 2048 | 512 | 33 ,
204
+ win: {
205
+ primary: 1024 | 512 | 33
206
+ },
207
+ id: COPY_PATH_COMMAND_ID,
208
+ handler: copyPathCommandHandler
209
+ });
210
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
211
+ weight: 200 ,
212
+ when: EditorContextKeys.focus,
213
+ primary: KeyChord(2048 | 41 , 2048 | 512 | 33 ),
214
+ win: {
215
+ primary: 1024 | 512 | 33
216
+ },
217
+ id: COPY_PATH_COMMAND_ID,
218
+ handler: copyPathCommandHandler
219
+ });
220
+ const copyRelativePathCommandHandler = async (accessor, resource) => {
221
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService));
222
+ await resourcesToClipboard(resources, true, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
223
+ };
224
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
225
+ weight: 200 ,
226
+ when: ( EditorContextKeys.focus.toNegated()),
227
+ primary: 2048 | 1024 | 512 | 33 ,
228
+ win: {
229
+ primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
230
+ },
231
+ id: COPY_RELATIVE_PATH_COMMAND_ID,
232
+ handler: copyRelativePathCommandHandler
233
+ });
234
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
235
+ weight: 200 ,
236
+ when: EditorContextKeys.focus,
237
+ primary: KeyChord(2048 | 41 , 2048 | 1024 | 512 | 33 ),
238
+ win: {
239
+ primary: KeyChord(2048 | 41 , 2048 | 1024 | 33 )
240
+ },
241
+ id: COPY_RELATIVE_PATH_COMMAND_ID,
242
+ handler: copyRelativePathCommandHandler
243
+ });
244
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
245
+ weight: 200 ,
246
+ when: undefined,
247
+ primary: KeyChord(2048 | 41 , 46 ),
248
+ id: 'workbench.action.files.copyPathOfActiveFile',
249
+ handler: async (accessor) => {
250
+ const editorService = accessor.get(IEditorService);
251
+ const activeInput = editorService.activeEditor;
252
+ const resource = EditorResourceAccessor.getOriginalUri(activeInput, { supportSideBySide: SideBySideEditor.PRIMARY });
253
+ const resources = resource ? [resource] : [];
254
+ await resourcesToClipboard(resources, false, accessor.get(IClipboardService), accessor.get(ILabelService), accessor.get(IConfigurationService));
255
+ }
256
+ });
257
+ CommandsRegistry.registerCommand({
258
+ id: REVEAL_IN_EXPLORER_COMMAND_ID,
259
+ handler: async (accessor, resource) => {
260
+ const viewService = accessor.get(IViewsService);
261
+ const contextService = accessor.get(IWorkspaceContextService);
262
+ const explorerService = accessor.get(IExplorerService);
263
+ const uri = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IEditorService));
264
+ if (uri && contextService.isInsideWorkspace(uri)) {
265
+ const explorerView = await viewService.openView(VIEW_ID, false);
266
+ if (explorerView) {
267
+ const oldAutoReveal = explorerView.autoReveal;
268
+ explorerView.autoReveal = false;
269
+ explorerView.setExpanded(true);
270
+ await explorerService.select(uri, 'force');
271
+ explorerView.focus();
272
+ explorerView.autoReveal = oldAutoReveal;
273
+ }
274
+ }
275
+ else {
276
+ const openEditorsView = await viewService.openView(OpenEditorsView.ID, false);
277
+ if (openEditorsView) {
278
+ openEditorsView.setExpanded(true);
279
+ openEditorsView.focus();
280
+ }
281
+ }
282
+ }
283
+ });
284
+ CommandsRegistry.registerCommand({
285
+ id: OPEN_WITH_EXPLORER_COMMAND_ID,
286
+ handler: async (accessor, resource) => {
287
+ const editorService = accessor.get(IEditorService);
288
+ const uri = getResourceForCommand(resource, accessor.get(IListService), accessor.get(IEditorService));
289
+ if (uri) {
290
+ return editorService.openEditor({ resource: uri, options: { override: EditorResolution.PICK, source: EditorOpenSource.USER } });
291
+ }
292
+ return undefined;
293
+ }
294
+ });
295
+ CommandsRegistry.registerCommand({
296
+ id: REVERT_FILE_COMMAND_ID,
297
+ handler: async (accessor) => {
298
+ const notificationService = accessor.get(INotificationService);
299
+ const listService = accessor.get(IListService);
300
+ const editorGroupService = accessor.get(IEditorGroupsService);
301
+ const editorService = accessor.get(IEditorService);
302
+ let editors = getOpenEditorsViewMultiSelection(listService);
303
+ if (!editors) {
304
+ const activeGroup = editorGroupService.activeGroup;
305
+ if (activeGroup.activeEditor) {
306
+ editors = [{ groupId: activeGroup.id, editor: activeGroup.activeEditor }];
307
+ }
308
+ }
309
+ if (!editors || editors.length === 0) {
310
+ return;
311
+ }
312
+ try {
313
+ await editorService.revert(editors.filter(({ editor }) => !editor.hasCapability(4 ) ), { force: true });
314
+ }
315
+ catch (error) {
316
+ notificationService.error(( localizeWithPath(
317
+ 'vs/workbench/contrib/files/browser/fileCommands',
318
+ 'genericRevertError',
319
+ "Failed to revert '{0}': {1}",
320
+ ( editors.map(({ editor }) => editor.getName())).join(', '),
321
+ toErrorMessage(error, false)
322
+ )));
323
+ }
324
+ }
325
+ });
326
+ CommandsRegistry.registerCommand({
327
+ id: REMOVE_ROOT_FOLDER_COMMAND_ID,
328
+ handler: (accessor, resource) => {
329
+ const workspaceEditingService = accessor.get(IWorkspaceEditingService);
330
+ const contextService = accessor.get(IWorkspaceContextService);
331
+ const uriIdentityService = accessor.get(IUriIdentityService);
332
+ const workspace = contextService.getWorkspace();
333
+ const resources = getMultiSelectedResources(resource, accessor.get(IListService), accessor.get(IEditorService), accessor.get(IExplorerService)).filter(resource => ( workspace.folders.some(folder => uriIdentityService.extUri.isEqual(folder.uri, resource)))
334
+ );
335
+ if (resources.length === 0) {
336
+ const commandService = accessor.get(ICommandService);
337
+ return commandService.executeCommand(RemoveRootFolderAction.ID);
338
+ }
339
+ return workspaceEditingService.removeFolders(resources);
340
+ }
341
+ });
342
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
343
+ weight: 200 + 10,
344
+ when: ( ContextKeyExpr.and(
345
+ FilesExplorerFocusCondition,
346
+ ExplorerCompressedFocusContext,
347
+ ( ExplorerCompressedFirstFocusContext.negate())
348
+ )),
349
+ primary: 15 ,
350
+ id: PREVIOUS_COMPRESSED_FOLDER,
351
+ handler: accessor => {
352
+ const paneCompositeService = accessor.get(IPaneCompositePartService);
353
+ const viewlet = paneCompositeService.getActivePaneComposite(0 );
354
+ if (viewlet?.getId() !== VIEWLET_ID) {
355
+ return;
356
+ }
357
+ const explorer = viewlet.getViewPaneContainer();
358
+ const view = explorer.getExplorerView();
359
+ view.previousCompressedStat();
360
+ }
361
+ });
362
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
363
+ weight: 200 + 10,
364
+ when: ( ContextKeyExpr.and(
365
+ FilesExplorerFocusCondition,
366
+ ExplorerCompressedFocusContext,
367
+ ( ExplorerCompressedLastFocusContext.negate())
368
+ )),
369
+ primary: 17 ,
370
+ id: NEXT_COMPRESSED_FOLDER,
371
+ handler: accessor => {
372
+ const paneCompositeService = accessor.get(IPaneCompositePartService);
373
+ const viewlet = paneCompositeService.getActivePaneComposite(0 );
374
+ if (viewlet?.getId() !== VIEWLET_ID) {
375
+ return;
376
+ }
377
+ const explorer = viewlet.getViewPaneContainer();
378
+ const view = explorer.getExplorerView();
379
+ view.nextCompressedStat();
380
+ }
381
+ });
382
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
383
+ weight: 200 + 10,
384
+ when: ( ContextKeyExpr.and(
385
+ FilesExplorerFocusCondition,
386
+ ExplorerCompressedFocusContext,
387
+ ( ExplorerCompressedFirstFocusContext.negate())
388
+ )),
389
+ primary: 14 ,
390
+ id: FIRST_COMPRESSED_FOLDER,
391
+ handler: accessor => {
392
+ const paneCompositeService = accessor.get(IPaneCompositePartService);
393
+ const viewlet = paneCompositeService.getActivePaneComposite(0 );
394
+ if (viewlet?.getId() !== VIEWLET_ID) {
395
+ return;
396
+ }
397
+ const explorer = viewlet.getViewPaneContainer();
398
+ const view = explorer.getExplorerView();
399
+ view.firstCompressedStat();
400
+ }
401
+ });
402
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
403
+ weight: 200 + 10,
404
+ when: ( ContextKeyExpr.and(
405
+ FilesExplorerFocusCondition,
406
+ ExplorerCompressedFocusContext,
407
+ ( ExplorerCompressedLastFocusContext.negate())
408
+ )),
409
+ primary: 13 ,
410
+ id: LAST_COMPRESSED_FOLDER,
411
+ handler: accessor => {
412
+ const paneCompositeService = accessor.get(IPaneCompositePartService);
413
+ const viewlet = paneCompositeService.getActivePaneComposite(0 );
414
+ if (viewlet?.getId() !== VIEWLET_ID) {
415
+ return;
416
+ }
417
+ const explorer = viewlet.getViewPaneContainer();
418
+ const view = explorer.getExplorerView();
419
+ view.lastCompressedStat();
420
+ }
421
+ });
422
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
423
+ weight: 200 ,
424
+ when: null,
425
+ primary: isWeb ? ((isWindows ? KeyChord(2048 | 41 , 44 ) : 2048 | 512 | 44) ) : 2048 | 44 ,
426
+ secondary: isWeb ? [2048 | 44 ] : undefined,
427
+ id: NEW_UNTITLED_FILE_COMMAND_ID,
428
+ metadata: {
429
+ description: NEW_UNTITLED_FILE_LABEL,
430
+ args: [
431
+ {
432
+ isOptional: true,
433
+ name: 'New Untitled Text File arguments',
434
+ description: 'The editor view type or language ID if known',
435
+ schema: {
436
+ 'type': 'object',
437
+ 'properties': {
438
+ 'viewType': {
439
+ 'type': 'string'
440
+ },
441
+ 'languageId': {
442
+ 'type': 'string'
443
+ }
444
+ }
445
+ }
446
+ }
447
+ ]
448
+ },
449
+ handler: async (accessor, args) => {
450
+ const editorService = accessor.get(IEditorService);
451
+ await editorService.openEditor({
452
+ resource: undefined,
453
+ options: {
454
+ override: args?.viewType,
455
+ pinned: true
456
+ },
457
+ languageId: args?.languageId,
458
+ });
459
+ }
460
+ });
461
+ CommandsRegistry.registerCommand({
462
+ id: NEW_FILE_COMMAND_ID,
463
+ handler: async (accessor, args) => {
464
+ const editorService = accessor.get(IEditorService);
465
+ const dialogService = accessor.get(IFileDialogService);
466
+ const fileService = accessor.get(IFileService);
467
+ const createFileLocalized = ( localizeWithPath(
468
+ 'vs/workbench/contrib/files/browser/fileCommands',
469
+ 'newFileCommand.saveLabel',
470
+ "Create File"
471
+ ));
472
+ const defaultFileUri = joinPath(await dialogService.defaultFilePath(), args?.fileName ?? 'Untitled.txt');
473
+ const saveUri = await dialogService.showSaveDialog({ saveLabel: createFileLocalized, title: createFileLocalized, defaultUri: defaultFileUri });
474
+ if (!saveUri) {
475
+ return;
476
+ }
477
+ await fileService.createFile(saveUri, undefined, { overwrite: true });
478
+ await editorService.openEditor({
479
+ resource: saveUri,
480
+ options: {
481
+ override: args?.viewType,
482
+ pinned: true
483
+ },
484
+ languageId: args?.languageId,
485
+ });
486
+ }
487
+ });