@codingame/monaco-vscode-extensions-service-override 1.83.7 → 1.83.9

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 (183) hide show
  1. package/assets/webWorkerExtensionHostIframe.html +123 -0
  2. package/extensions.d.ts +12 -13
  3. package/extensions.js +456 -0
  4. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +3 -0
  5. package/external/tslib/tslib.es6.js +11 -0
  6. package/index.d.ts +1 -1
  7. package/index.js +2 -2
  8. package/override/vs/platform/dialogs/common/dialogs.js +8 -0
  9. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
  10. package/override/vs/workbench/contrib/notebook/common/notebookEditorInput.js +3 -0
  11. package/package.json +5 -3
  12. package/tools/url.js +10 -0
  13. package/tools.js +5 -0
  14. package/vscode/src/vs/base/common/console.js +59 -0
  15. package/vscode/src/vs/base/common/prefixTree.js +131 -0
  16. package/vscode/src/vs/platform/files/common/watcher.js +71 -0
  17. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
  18. package/vscode/src/vs/platform/log/browser/log.js +26 -0
  19. package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
  20. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +31 -0
  21. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +35 -0
  22. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +330 -0
  23. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
  24. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +174 -0
  25. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents.js +52 -0
  26. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +61 -0
  27. package/vscode/src/vs/workbench/api/browser/mainThreadChatSlashCommands.js +49 -0
  28. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +31 -0
  29. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
  30. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +107 -0
  31. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +94 -0
  32. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +541 -0
  33. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -0
  34. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +35 -0
  35. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +578 -0
  36. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +387 -0
  37. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +102 -0
  38. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +69 -0
  39. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +68 -0
  40. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +75 -0
  41. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +249 -0
  42. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +370 -0
  43. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +22 -0
  44. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +41 -0
  45. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +411 -0
  46. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +475 -0
  47. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +227 -0
  48. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +24 -0
  49. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +317 -0
  50. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +280 -0
  51. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +283 -0
  52. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +68 -0
  53. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
  54. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +33 -0
  55. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
  56. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +947 -0
  57. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +78 -0
  58. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +35 -0
  59. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +78 -0
  60. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +93 -0
  61. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +118 -0
  62. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +158 -0
  63. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +123 -0
  64. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +188 -0
  65. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +129 -0
  66. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +131 -0
  67. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +341 -0
  68. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +25 -0
  69. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +48 -0
  70. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +76 -0
  71. package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +38 -0
  72. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
  73. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +49 -0
  74. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +185 -0
  75. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +30 -0
  76. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +463 -0
  77. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
  78. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +148 -0
  79. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +70 -0
  80. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +50 -0
  81. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +53 -0
  82. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +72 -0
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +731 -0
  84. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +53 -0
  85. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +412 -0
  86. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +182 -0
  87. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +24 -0
  88. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +55 -0
  89. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +313 -0
  90. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +223 -0
  91. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +110 -0
  92. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +61 -0
  93. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +29 -0
  94. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +283 -0
  95. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +100 -0
  96. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +135 -0
  97. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +57 -0
  98. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +273 -0
  99. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHost.api.impl.d.ts +2 -2
  100. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostConfiguration.d.ts +3 -3
  101. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostExtensionService.d.ts +3 -4
  102. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostManagedSockets.d.ts +2 -2
  103. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostTerminalService.d.ts +19 -20
  104. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostTunnelService.d.ts +7 -8
  105. package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostWorkspace.d.ts +25 -26
  106. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
  107. package/vscode/src/vs/workbench/contrib/chat/common/chatModel.js +217 -0
  108. package/vscode/src/vs/workbench/contrib/comments/browser/commentColors.js +57 -0
  109. package/vscode/src/vs/workbench/contrib/comments/browser/commentFormActions.js +51 -0
  110. package/vscode/src/vs/workbench/contrib/comments/browser/commentGlyphWidget.js +92 -0
  111. package/vscode/src/vs/workbench/contrib/comments/browser/commentNode.js +648 -0
  112. package/vscode/src/vs/workbench/contrib/comments/browser/commentReply.js +297 -0
  113. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadAdditionalActions.js +62 -0
  114. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadBody.js +249 -0
  115. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadHeader.js +109 -0
  116. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadRangeDecorator.js +109 -0
  117. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadWidget.js +331 -0
  118. package/vscode/src/vs/workbench/contrib/comments/browser/commentThreadZoneWidget.js +380 -0
  119. package/vscode/src/vs/workbench/contrib/comments/browser/comments.js +5 -0
  120. package/vscode/src/vs/workbench/contrib/comments/browser/commentsController.js +1196 -0
  121. package/vscode/src/vs/workbench/contrib/comments/browser/commentsFilterOptions.js +19 -0
  122. package/vscode/src/vs/workbench/contrib/comments/browser/commentsTreeViewer.js +334 -0
  123. package/vscode/src/vs/workbench/contrib/comments/browser/commentsView.js +543 -0
  124. package/vscode/src/vs/workbench/contrib/comments/browser/commentsViewActions.js +178 -0
  125. package/vscode/src/vs/workbench/contrib/comments/browser/media/panel.css.js +6 -0
  126. package/vscode/src/vs/workbench/contrib/comments/browser/media/review.css.js +6 -0
  127. package/vscode/src/vs/workbench/contrib/comments/browser/reactionsAction.js +101 -0
  128. package/vscode/src/vs/workbench/contrib/comments/browser/timestamp.js +57 -0
  129. package/vscode/src/vs/workbench/contrib/comments/common/commentModel.js +145 -0
  130. package/vscode/src/vs/workbench/contrib/comments/common/commentsConfiguration.js +3 -0
  131. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +73 -0
  132. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
  133. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditorInput.js +179 -0
  134. package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveHistoryService.js +5 -0
  135. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInput.js +144 -0
  136. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorInputModel.js +482 -0
  137. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeMarkers/mergeMarkersController.js +6 -0
  138. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/diffComputer.js +85 -0
  139. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/editing.js +56 -0
  140. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/lineRange.js +110 -0
  141. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mapping.js +260 -0
  142. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/mergeEditorModel.js +616 -0
  143. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/modifiedBaseRange.js +309 -0
  144. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/rangeUtils.js +38 -0
  145. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/model/textModelDiffs.js +167 -0
  146. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/telemetry.js +80 -0
  147. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/utils.js +70 -0
  148. package/vscode/src/vs/workbench/contrib/mergeEditor/common/mergeEditor.js +3 -0
  149. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModel.js +108 -0
  150. package/vscode/src/vs/workbench/contrib/tasks/common/tasks.js +506 -0
  151. package/vscode/src/vs/workbench/contrib/terminal/browser/terminalProcessExtHostProxy.js +132 -0
  152. package/vscode/src/vs/workbench/contrib/testing/common/getComputedState.js +103 -0
  153. package/vscode/src/vs/workbench/contrib/testing/common/observableValue.js +28 -0
  154. package/vscode/src/vs/workbench/contrib/testing/common/testCoverage.js +25 -0
  155. package/vscode/src/vs/workbench/contrib/testing/common/testResult.js +336 -0
  156. package/vscode/src/vs/workbench/contrib/testing/common/testingStates.js +46 -0
  157. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +283 -0
  158. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +273 -0
  159. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
  160. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1093 -0
  161. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +41 -0
  162. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +25 -0
  163. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +643 -0
  164. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +274 -0
  165. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +58 -0
  166. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +80 -0
  167. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +64 -0
  168. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
  169. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +220 -0
  170. package/vscode/src/vs/workbench/services/themes/common/iconExtensionPoint.js +5 -0
  171. package/vscode/src/vs/workbench/services/workingCopy/common/resourceWorkingCopy.js +79 -0
  172. package/vscode-proposed.d.ts +0 -3872
  173. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHost.protocol.d.ts +0 -0
  174. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostExtensionActivator.d.ts +0 -0
  175. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostFileSystemInfo.d.ts +0 -0
  176. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostInitDataService.d.ts +0 -0
  177. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostLocalizationService.d.ts +0 -0
  178. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostRpcService.d.ts +0 -0
  179. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostStoragePaths.d.ts +0 -0
  180. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostTypes.d.ts +0 -0
  181. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/common/extHostUriTransformerService.d.ts +0 -0
  182. /package/{dist/main/vscode → vscode}/src/vs/workbench/api/worker/extHostExtensionService.d.ts +0 -0
  183. /package/{dist/main/vscode → vscode}/src/vs/workbench/services/search/common/queryBuilder.d.ts +0 -0
@@ -0,0 +1,475 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { DisposableStore } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
3
+ import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
4
+ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
5
+ import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
6
+ import { DiffEditorInput } from 'vscode/vscode/vs/workbench/common/editor/diffEditorInput';
7
+ import { editorGroupToColumn, columnToEditorGroup } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupColumn';
8
+ import { IEditorGroupsService, preferredSideBySideGroupDirection } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
9
+ import { IEditorService, SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
10
+ import { AbstractTextResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor/textResourceEditorInput';
11
+ import { NotebookEditorInput } from '../../../../../../override/vs/workbench/contrib/notebook/common/notebookEditorInput.js';
12
+ import { CustomEditorInput } from 'vscode/vscode/vs/workbench/contrib/customEditor/browser/customEditorInput';
13
+ import { URI } from 'monaco-editor/esm/vs/base/common/uri.js';
14
+ import { WebviewInput } from 'vscode/vscode/vs/workbench/contrib/webviewPanel/browser/webviewEditorInput';
15
+ import { TerminalEditorInput } from 'vscode/vscode/vs/workbench/contrib/terminal/browser/terminalEditorInput';
16
+ import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
17
+ import { SideBySideEditorInput } from 'vscode/vscode/vs/workbench/common/editor/sideBySideEditorInput';
18
+ import { isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
19
+ import { isGroupEditorMoveEvent } from 'vscode/vscode/vs/workbench/common/editor/editorGroupModel';
20
+ import { InteractiveEditorInput } from '../../contrib/interactive/browser/interactiveEditorInput.js';
21
+ import { MergeEditorInput } from '../../contrib/mergeEditor/browser/mergeEditorInput.js';
22
+ import { ILogService } from 'monaco-editor/esm/vs/platform/log/common/log.js';
23
+
24
+ let MainThreadEditorTabs = class MainThreadEditorTabs {
25
+ constructor(extHostContext, _editorGroupsService, _configurationService, _logService, editorService) {
26
+ this._editorGroupsService = _editorGroupsService;
27
+ this._configurationService = _configurationService;
28
+ this._logService = _logService;
29
+ this._dispoables = ( new DisposableStore());
30
+ this._tabGroupModel = [];
31
+ this._groupLookup = ( new Map());
32
+ this._tabInfoLookup = ( new Map());
33
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostEditorTabs));
34
+ this._dispoables.add(editorService.onDidEditorsChange((event) => {
35
+ try {
36
+ this._updateTabsModel(event);
37
+ }
38
+ catch {
39
+ this._logService.error('Failed to update model, rebuilding');
40
+ this._createTabsModel();
41
+ }
42
+ }));
43
+ this._dispoables.add(this._editorGroupsService.onDidAddGroup(() => this._createTabsModel()));
44
+ this._dispoables.add(this._editorGroupsService.onDidRemoveGroup(() => this._createTabsModel()));
45
+ this._editorGroupsService.whenReady.then(() => this._createTabsModel());
46
+ }
47
+ dispose() {
48
+ this._groupLookup.clear();
49
+ this._tabInfoLookup.clear();
50
+ this._dispoables.dispose();
51
+ }
52
+ _buildTabObject(group, editor, editorIndex) {
53
+ const editorId = editor.editorId;
54
+ const tab = {
55
+ id: this._generateTabId(editor, group.id),
56
+ label: editor.getName(),
57
+ editorId,
58
+ input: this._editorInputToDto(editor),
59
+ isPinned: group.isSticky(editorIndex),
60
+ isPreview: !group.isPinned(editorIndex),
61
+ isActive: group.isActive(editor),
62
+ isDirty: editor.isDirty()
63
+ };
64
+ return tab;
65
+ }
66
+ _editorInputToDto(editor) {
67
+ if (editor instanceof MergeEditorInput) {
68
+ return {
69
+ kind: 3 ,
70
+ base: editor.base,
71
+ input1: editor.input1.uri,
72
+ input2: editor.input2.uri,
73
+ result: editor.resource
74
+ };
75
+ }
76
+ if (editor instanceof AbstractTextResourceEditorInput) {
77
+ return {
78
+ kind: 1 ,
79
+ uri: editor.resource
80
+ };
81
+ }
82
+ if (editor instanceof SideBySideEditorInput && !(editor instanceof DiffEditorInput)) {
83
+ const primaryResource = editor.primary.resource;
84
+ const secondaryResource = editor.secondary.resource;
85
+ if (editor.primary instanceof AbstractTextResourceEditorInput
86
+ && editor.secondary instanceof AbstractTextResourceEditorInput
87
+ && isEqual(primaryResource, secondaryResource)
88
+ && primaryResource
89
+ && secondaryResource) {
90
+ return {
91
+ kind: 1 ,
92
+ uri: primaryResource
93
+ };
94
+ }
95
+ return { kind: 0 };
96
+ }
97
+ if (editor instanceof NotebookEditorInput) {
98
+ return {
99
+ kind: 4 ,
100
+ notebookType: editor.viewType,
101
+ uri: editor.resource
102
+ };
103
+ }
104
+ if (editor instanceof CustomEditorInput) {
105
+ return {
106
+ kind: 6 ,
107
+ viewType: editor.viewType,
108
+ uri: editor.resource,
109
+ };
110
+ }
111
+ if (editor instanceof WebviewInput) {
112
+ return {
113
+ kind: 7 ,
114
+ viewType: editor.viewType
115
+ };
116
+ }
117
+ if (editor instanceof TerminalEditorInput) {
118
+ return {
119
+ kind: 8
120
+ };
121
+ }
122
+ if (editor instanceof DiffEditorInput) {
123
+ if (editor.modified instanceof AbstractTextResourceEditorInput && editor.original instanceof AbstractTextResourceEditorInput) {
124
+ return {
125
+ kind: 2 ,
126
+ modified: editor.modified.resource,
127
+ original: editor.original.resource
128
+ };
129
+ }
130
+ if (editor.modified instanceof NotebookEditorInput && editor.original instanceof NotebookEditorInput) {
131
+ return {
132
+ kind: 5 ,
133
+ notebookType: editor.original.viewType,
134
+ modified: editor.modified.resource,
135
+ original: editor.original.resource
136
+ };
137
+ }
138
+ }
139
+ if (editor instanceof InteractiveEditorInput) {
140
+ return {
141
+ kind: 9 ,
142
+ uri: editor.resource,
143
+ inputBoxUri: editor.inputResource
144
+ };
145
+ }
146
+ return { kind: 0 };
147
+ }
148
+ _generateTabId(editor, groupId) {
149
+ let resourceString;
150
+ const resource = EditorResourceAccessor.getCanonicalUri(editor, { supportSideBySide: SideBySideEditor.BOTH });
151
+ if (resource instanceof URI) {
152
+ resourceString = ( resource.toString());
153
+ }
154
+ else {
155
+ resourceString = `${resource?.primary?.toString()}-${resource?.secondary?.toString()}`;
156
+ }
157
+ return `${groupId}~${editor.editorId}-${editor.typeId}-${resourceString} `;
158
+ }
159
+ _onDidGroupActivate() {
160
+ const activeGroupId = this._editorGroupsService.activeGroup.id;
161
+ const activeGroup = this._groupLookup.get(activeGroupId);
162
+ if (activeGroup) {
163
+ activeGroup.isActive = true;
164
+ this._proxy.$acceptTabGroupUpdate(activeGroup);
165
+ }
166
+ }
167
+ _onDidTabLabelChange(groupId, editorInput, editorIndex) {
168
+ const tabId = this._generateTabId(editorInput, groupId);
169
+ const tabInfo = this._tabInfoLookup.get(tabId);
170
+ if (tabInfo) {
171
+ tabInfo.tab.label = editorInput.getName();
172
+ this._proxy.$acceptTabOperation({
173
+ groupId,
174
+ index: editorIndex,
175
+ tabDto: tabInfo.tab,
176
+ kind: 2
177
+ });
178
+ }
179
+ else {
180
+ this._logService.error('Invalid model for label change, rebuilding');
181
+ this._createTabsModel();
182
+ }
183
+ }
184
+ _onDidTabOpen(groupId, editorInput, editorIndex) {
185
+ const group = this._editorGroupsService.getGroup(groupId);
186
+ const groupInModel = this._groupLookup.get(groupId) !== undefined;
187
+ if (!group || !groupInModel) {
188
+ this._createTabsModel();
189
+ return;
190
+ }
191
+ const tabs = this._groupLookup.get(groupId)?.tabs;
192
+ if (!tabs) {
193
+ return;
194
+ }
195
+ const tabObject = this._buildTabObject(group, editorInput, editorIndex);
196
+ tabs.splice(editorIndex, 0, tabObject);
197
+ this._tabInfoLookup.set(this._generateTabId(editorInput, groupId), { group, editorInput, tab: tabObject });
198
+ this._proxy.$acceptTabOperation({
199
+ groupId,
200
+ index: editorIndex,
201
+ tabDto: tabObject,
202
+ kind: 0
203
+ });
204
+ }
205
+ _onDidTabClose(groupId, editorIndex) {
206
+ const group = this._editorGroupsService.getGroup(groupId);
207
+ const tabs = this._groupLookup.get(groupId)?.tabs;
208
+ if (!group || !tabs) {
209
+ this._createTabsModel();
210
+ return;
211
+ }
212
+ const removedTab = tabs.splice(editorIndex, 1);
213
+ if (removedTab.length === 0) {
214
+ return;
215
+ }
216
+ this._tabInfoLookup.delete(removedTab[0]?.id ?? '');
217
+ this._proxy.$acceptTabOperation({
218
+ groupId,
219
+ index: editorIndex,
220
+ tabDto: removedTab[0],
221
+ kind: 1
222
+ });
223
+ }
224
+ _onDidTabActiveChange(groupId, editorIndex) {
225
+ const tabs = this._groupLookup.get(groupId)?.tabs;
226
+ if (!tabs) {
227
+ return;
228
+ }
229
+ const activeTab = tabs[editorIndex];
230
+ activeTab.isActive = true;
231
+ this._proxy.$acceptTabOperation({
232
+ groupId,
233
+ index: editorIndex,
234
+ tabDto: activeTab,
235
+ kind: 2
236
+ });
237
+ }
238
+ _onDidTabDirty(groupId, editorIndex, editor) {
239
+ const tabId = this._generateTabId(editor, groupId);
240
+ const tabInfo = this._tabInfoLookup.get(tabId);
241
+ if (!tabInfo) {
242
+ this._logService.error('Invalid model for dirty change, rebuilding');
243
+ this._createTabsModel();
244
+ return;
245
+ }
246
+ tabInfo.tab.isDirty = editor.isDirty();
247
+ this._proxy.$acceptTabOperation({
248
+ groupId,
249
+ index: editorIndex,
250
+ tabDto: tabInfo.tab,
251
+ kind: 2
252
+ });
253
+ }
254
+ _onDidTabPinChange(groupId, editorIndex, editor) {
255
+ const tabId = this._generateTabId(editor, groupId);
256
+ const tabInfo = this._tabInfoLookup.get(tabId);
257
+ const group = tabInfo?.group;
258
+ const tab = tabInfo?.tab;
259
+ if (!group || !tab) {
260
+ this._logService.error('Invalid model for sticky change, rebuilding');
261
+ this._createTabsModel();
262
+ return;
263
+ }
264
+ tab.isPinned = group.isSticky(editorIndex);
265
+ this._proxy.$acceptTabOperation({
266
+ groupId,
267
+ index: editorIndex,
268
+ tabDto: tab,
269
+ kind: 2
270
+ });
271
+ }
272
+ _onDidTabPreviewChange(groupId, editorIndex, editor) {
273
+ const tabId = this._generateTabId(editor, groupId);
274
+ const tabInfo = this._tabInfoLookup.get(tabId);
275
+ const group = tabInfo?.group;
276
+ const tab = tabInfo?.tab;
277
+ if (!group || !tab) {
278
+ this._logService.error('Invalid model for sticky change, rebuilding');
279
+ this._createTabsModel();
280
+ return;
281
+ }
282
+ tab.isPreview = !group.isPinned(editorIndex);
283
+ this._proxy.$acceptTabOperation({
284
+ kind: 2 ,
285
+ groupId,
286
+ tabDto: tab,
287
+ index: editorIndex
288
+ });
289
+ }
290
+ _onDidTabMove(groupId, editorIndex, oldEditorIndex, editor) {
291
+ const tabs = this._groupLookup.get(groupId)?.tabs;
292
+ if (!tabs) {
293
+ this._logService.error('Invalid model for move change, rebuilding');
294
+ this._createTabsModel();
295
+ return;
296
+ }
297
+ const removedTab = tabs.splice(oldEditorIndex, 1);
298
+ if (removedTab.length === 0) {
299
+ return;
300
+ }
301
+ tabs.splice(editorIndex, 0, removedTab[0]);
302
+ this._proxy.$acceptTabOperation({
303
+ kind: 3 ,
304
+ groupId,
305
+ tabDto: removedTab[0],
306
+ index: editorIndex,
307
+ oldIndex: oldEditorIndex
308
+ });
309
+ }
310
+ _createTabsModel() {
311
+ this._tabGroupModel = [];
312
+ this._groupLookup.clear();
313
+ this._tabInfoLookup.clear();
314
+ let tabs = [];
315
+ for (const group of this._editorGroupsService.groups) {
316
+ const currentTabGroupModel = {
317
+ groupId: group.id,
318
+ isActive: group.id === this._editorGroupsService.activeGroup.id,
319
+ viewColumn: editorGroupToColumn(this._editorGroupsService, group),
320
+ tabs: []
321
+ };
322
+ group.editors.forEach((editor, editorIndex) => {
323
+ const tab = this._buildTabObject(group, editor, editorIndex);
324
+ tabs.push(tab);
325
+ this._tabInfoLookup.set(this._generateTabId(editor, group.id), {
326
+ group,
327
+ tab,
328
+ editorInput: editor
329
+ });
330
+ });
331
+ currentTabGroupModel.tabs = tabs;
332
+ this._tabGroupModel.push(currentTabGroupModel);
333
+ this._groupLookup.set(group.id, currentTabGroupModel);
334
+ tabs = [];
335
+ }
336
+ this._proxy.$acceptEditorTabModel(this._tabGroupModel);
337
+ }
338
+ _updateTabsModel(changeEvent) {
339
+ const event = changeEvent.event;
340
+ const groupId = changeEvent.groupId;
341
+ switch (event.kind) {
342
+ case 0 :
343
+ if (groupId === this._editorGroupsService.activeGroup.id) {
344
+ this._onDidGroupActivate();
345
+ break;
346
+ }
347
+ else {
348
+ return;
349
+ }
350
+ case 7 :
351
+ if (event.editor !== undefined && event.editorIndex !== undefined) {
352
+ this._onDidTabLabelChange(groupId, event.editor, event.editorIndex);
353
+ break;
354
+ }
355
+ case 3 :
356
+ if (event.editor !== undefined && event.editorIndex !== undefined) {
357
+ this._onDidTabOpen(groupId, event.editor, event.editorIndex);
358
+ break;
359
+ }
360
+ case 4 :
361
+ if (event.editorIndex !== undefined) {
362
+ this._onDidTabClose(groupId, event.editorIndex);
363
+ break;
364
+ }
365
+ case 6 :
366
+ if (event.editorIndex !== undefined) {
367
+ this._onDidTabActiveChange(groupId, event.editorIndex);
368
+ break;
369
+ }
370
+ case 11 :
371
+ if (event.editorIndex !== undefined && event.editor !== undefined) {
372
+ this._onDidTabDirty(groupId, event.editorIndex, event.editor);
373
+ break;
374
+ }
375
+ case 10 :
376
+ if (event.editorIndex !== undefined && event.editor !== undefined) {
377
+ this._onDidTabPinChange(groupId, event.editorIndex, event.editor);
378
+ break;
379
+ }
380
+ case 9 :
381
+ if (event.editorIndex !== undefined && event.editor !== undefined) {
382
+ this._onDidTabPreviewChange(groupId, event.editorIndex, event.editor);
383
+ break;
384
+ }
385
+ case 5 :
386
+ if (isGroupEditorMoveEvent(event) && event.editor && event.editorIndex !== undefined && event.oldEditorIndex !== undefined) {
387
+ this._onDidTabMove(groupId, event.editorIndex, event.oldEditorIndex, event.editor);
388
+ break;
389
+ }
390
+ default:
391
+ this._createTabsModel();
392
+ }
393
+ }
394
+ $moveTab(tabId, index, viewColumn, preserveFocus) {
395
+ const groupId = columnToEditorGroup(this._editorGroupsService, this._configurationService, viewColumn);
396
+ const tabInfo = this._tabInfoLookup.get(tabId);
397
+ const tab = tabInfo?.tab;
398
+ if (!tab) {
399
+ throw new Error(`Attempted to close tab with id ${tabId} which does not exist`);
400
+ }
401
+ let targetGroup;
402
+ const sourceGroup = this._editorGroupsService.getGroup(tabInfo.group.id);
403
+ if (!sourceGroup) {
404
+ return;
405
+ }
406
+ if (this._groupLookup.get(groupId) === undefined) {
407
+ let direction = 3 ;
408
+ if (viewColumn === SIDE_GROUP) {
409
+ direction = preferredSideBySideGroupDirection(this._configurationService);
410
+ }
411
+ targetGroup = this._editorGroupsService.addGroup(this._editorGroupsService.groups[this._editorGroupsService.groups.length - 1], direction);
412
+ }
413
+ else {
414
+ targetGroup = this._editorGroupsService.getGroup(groupId);
415
+ }
416
+ if (!targetGroup) {
417
+ return;
418
+ }
419
+ if (index < 0 || index > targetGroup.editors.length) {
420
+ index = targetGroup.editors.length;
421
+ }
422
+ const editorInput = tabInfo?.editorInput;
423
+ if (!editorInput) {
424
+ return;
425
+ }
426
+ sourceGroup.moveEditor(editorInput, targetGroup, { index, preserveFocus });
427
+ return;
428
+ }
429
+ async $closeTab(tabIds, preserveFocus) {
430
+ const groups = ( new Map());
431
+ for (const tabId of tabIds) {
432
+ const tabInfo = this._tabInfoLookup.get(tabId);
433
+ const tab = tabInfo?.tab;
434
+ const group = tabInfo?.group;
435
+ const editorTab = tabInfo?.editorInput;
436
+ if (!group || !tab || !tabInfo || !editorTab) {
437
+ continue;
438
+ }
439
+ const groupEditors = groups.get(group);
440
+ if (!groupEditors) {
441
+ groups.set(group, [editorTab]);
442
+ }
443
+ else {
444
+ groupEditors.push(editorTab);
445
+ }
446
+ }
447
+ const results = [];
448
+ for (const [group, editors] of groups) {
449
+ results.push(await group.closeEditors(editors, { preserveFocus }));
450
+ }
451
+ return results.every(result => result);
452
+ }
453
+ async $closeGroup(groupIds, preserveFocus) {
454
+ const groupCloseResults = [];
455
+ for (const groupId of groupIds) {
456
+ const group = this._editorGroupsService.getGroup(groupId);
457
+ if (group) {
458
+ groupCloseResults.push(await group.closeAllEditors());
459
+ if (group.count === 0 && this._editorGroupsService.getGroup(group.id)) {
460
+ this._editorGroupsService.removeGroup(group);
461
+ }
462
+ }
463
+ }
464
+ return groupCloseResults.every(result => result);
465
+ }
466
+ };
467
+ MainThreadEditorTabs = __decorate([
468
+ extHostNamedCustomer(MainContext.MainThreadEditorTabs),
469
+ ( __param(1, IEditorGroupsService)),
470
+ ( __param(2, IConfigurationService)),
471
+ ( __param(3, ILogService)),
472
+ ( __param(4, IEditorService))
473
+ ], MainThreadEditorTabs);
474
+
475
+ export { MainThreadEditorTabs };