@codingame/monaco-vscode-extensions-service-override 4.1.0 → 4.1.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 (109) hide show
  1. package/_virtual/semver.js +3 -0
  2. package/extensions.js +6 -6
  3. package/external/vscode-semver/semver.js +985 -0
  4. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +8 -0
  5. package/package.json +9 -9
  6. package/vscode/src/vs/base/common/console.js +62 -0
  7. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +497 -0
  8. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +44 -0
  9. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +27 -0
  10. package/vscode/src/vs/platform/remote/common/managedSocket.js +98 -0
  11. package/vscode/src/vs/workbench/api/browser/extensionHost.contribution.js +104 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +31 -0
  13. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +35 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +254 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +68 -0
  16. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +103 -0
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +70 -0
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +207 -0
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +41 -0
  20. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +24 -0
  21. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +108 -0
  22. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +98 -0
  23. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +560 -0
  24. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +80 -0
  25. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +35 -0
  26. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +579 -0
  27. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +435 -0
  28. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +102 -0
  29. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +69 -0
  30. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +68 -0
  31. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +79 -0
  32. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +253 -0
  33. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +370 -0
  34. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +22 -0
  35. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +41 -0
  36. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +414 -0
  37. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +501 -0
  38. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +227 -0
  39. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +24 -0
  40. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +317 -0
  41. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +208 -0
  42. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +369 -0
  43. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +72 -0
  44. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +28 -0
  45. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +50 -0
  46. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +27 -0
  47. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +1016 -0
  48. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +185 -0
  49. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +78 -0
  50. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +35 -0
  51. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +78 -0
  52. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +93 -0
  53. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +137 -0
  54. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +194 -0
  55. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +123 -0
  56. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +188 -0
  57. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +129 -0
  58. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +131 -0
  59. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +374 -0
  60. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +25 -0
  61. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +48 -0
  62. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +76 -0
  63. package/vscode/src/vs/workbench/api/browser/mainThreadProfileContentHandlers.js +38 -0
  64. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +68 -0
  65. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +42 -0
  66. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +185 -0
  67. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +30 -0
  68. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +493 -0
  69. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +49 -0
  70. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +168 -0
  71. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +70 -0
  72. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +50 -0
  73. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +99 -0
  74. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +53 -0
  75. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +72 -0
  76. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +731 -0
  77. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +53 -0
  78. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +409 -0
  79. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalShellIntegration.js +51 -0
  80. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +219 -0
  81. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +24 -0
  82. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +55 -0
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +312 -0
  84. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +223 -0
  85. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +110 -0
  86. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +61 -0
  87. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +29 -0
  88. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +283 -0
  89. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +100 -0
  90. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +135 -0
  91. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +57 -0
  92. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +268 -0
  93. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +35 -0
  94. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +76 -0
  95. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +83 -0
  96. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +285 -0
  97. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +276 -0
  98. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +52 -0
  99. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +1149 -0
  100. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +41 -0
  101. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +25 -0
  102. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +512 -0
  103. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +274 -0
  104. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +58 -0
  105. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +80 -0
  106. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +64 -0
  107. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +161 -0
  108. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +49 -0
  109. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +222 -0
@@ -0,0 +1,370 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { Event } from 'vscode/vscode/vs/base/common/event';
3
+ import { DisposableStore, DisposableMap, combinedDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
4
+ import { isCodeEditor, isDiffEditor } from 'vscode/vscode/vs/editor/browser/editorBrowser';
5
+ import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
6
+ import { shouldSynchronizeModel } from 'vscode/vscode/vs/editor/common/model';
7
+ import { IModelService } from 'vscode/vscode/vs/editor/common/services/model';
8
+ import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
9
+ import { IFileService } from 'vscode/vscode/vs/platform/files/common/files';
10
+ import { extHostCustomer } from '../../services/extensions/common/extHostCustomers.js';
11
+ import { MainThreadDocuments } from './mainThreadDocuments.js';
12
+ import { MainThreadTextEditor } from './mainThreadEditor.js';
13
+ import { MainThreadTextEditors } from './mainThreadEditors.js';
14
+ import { ExtHostContext, MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
15
+ import { AbstractTextEditor as FakeAbstractTextEditor } from '../../../../../../override/vs/workbench/browser/parts/editor/textEditor.weak.js';
16
+ import { editorGroupToColumn } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupColumn';
17
+ import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
18
+ import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
19
+ import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles';
20
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService';
21
+ import { IWorkingCopyFileService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService';
22
+ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
23
+ import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService';
24
+ import { IPathService } from 'vscode/vscode/vs/workbench/services/path/common/pathService';
25
+ import { diffSets, diffMaps } from 'vscode/vscode/vs/base/common/collections';
26
+ import { IPaneCompositePartService } from 'vscode/vscode/vs/workbench/services/panecomposite/browser/panecomposite';
27
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
28
+
29
+ class TextEditorSnapshot {
30
+ constructor(editor) {
31
+ this.editor = editor;
32
+ this.id = `${editor.getId()},${editor.getModel().id}`;
33
+ }
34
+ }
35
+ class DocumentAndEditorStateDelta {
36
+ constructor(removedDocuments, addedDocuments, removedEditors, addedEditors, oldActiveEditor, newActiveEditor) {
37
+ this.removedDocuments = removedDocuments;
38
+ this.addedDocuments = addedDocuments;
39
+ this.removedEditors = removedEditors;
40
+ this.addedEditors = addedEditors;
41
+ this.oldActiveEditor = oldActiveEditor;
42
+ this.newActiveEditor = newActiveEditor;
43
+ this.isEmpty = this.removedDocuments.length === 0
44
+ && this.addedDocuments.length === 0
45
+ && this.removedEditors.length === 0
46
+ && this.addedEditors.length === 0
47
+ && oldActiveEditor === newActiveEditor;
48
+ }
49
+ toString() {
50
+ let ret = 'DocumentAndEditorStateDelta\n';
51
+ ret += `\tRemoved Documents: [${( this.removedDocuments.map(d => ( d.uri.toString(true)))).join(', ')}]\n`;
52
+ ret += `\tAdded Documents: [${( this.addedDocuments.map(d => ( d.uri.toString(true)))).join(', ')}]\n`;
53
+ ret += `\tRemoved Editors: [${( this.removedEditors.map(e => e.id)).join(', ')}]\n`;
54
+ ret += `\tAdded Editors: [${( this.addedEditors.map(e => e.id)).join(', ')}]\n`;
55
+ ret += `\tNew Active Editor: ${this.newActiveEditor}\n`;
56
+ return ret;
57
+ }
58
+ }
59
+ class DocumentAndEditorState {
60
+ static compute(before, after) {
61
+ if (!before) {
62
+ return ( new DocumentAndEditorStateDelta([], [...( after.documents.values())], [], [...( after.textEditors.values())], undefined, after.activeEditor));
63
+ }
64
+ const documentDelta = diffSets(before.documents, after.documents);
65
+ const editorDelta = diffMaps(before.textEditors, after.textEditors);
66
+ const oldActiveEditor = before.activeEditor !== after.activeEditor ? before.activeEditor : undefined;
67
+ const newActiveEditor = before.activeEditor !== after.activeEditor ? after.activeEditor : undefined;
68
+ return ( new DocumentAndEditorStateDelta(
69
+ documentDelta.removed,
70
+ documentDelta.added,
71
+ editorDelta.removed,
72
+ editorDelta.added,
73
+ oldActiveEditor,
74
+ newActiveEditor
75
+ ));
76
+ }
77
+ constructor(documents, textEditors, activeEditor) {
78
+ this.documents = documents;
79
+ this.textEditors = textEditors;
80
+ this.activeEditor = activeEditor;
81
+ }
82
+ }
83
+ let MainThreadDocumentAndEditorStateComputer = class MainThreadDocumentAndEditorStateComputer {
84
+ constructor(_onDidChangeState, _modelService, _codeEditorService, _editorService, _paneCompositeService) {
85
+ this._onDidChangeState = _onDidChangeState;
86
+ this._modelService = _modelService;
87
+ this._codeEditorService = _codeEditorService;
88
+ this._editorService = _editorService;
89
+ this._paneCompositeService = _paneCompositeService;
90
+ this._toDispose = ( new DisposableStore());
91
+ this._toDisposeOnEditorRemove = ( new DisposableMap());
92
+ this._activeEditorOrder = 0 ;
93
+ this._modelService.onModelAdded(this._updateStateOnModelAdd, this, this._toDispose);
94
+ this._modelService.onModelRemoved(_ => this._updateState(), this, this._toDispose);
95
+ this._editorService.onDidActiveEditorChange(_ => this._updateState(), this, this._toDispose);
96
+ this._codeEditorService.onCodeEditorAdd(this._onDidAddEditor, this, this._toDispose);
97
+ this._codeEditorService.onCodeEditorRemove(this._onDidRemoveEditor, this, this._toDispose);
98
+ this._codeEditorService.listCodeEditors().forEach(this._onDidAddEditor, this);
99
+ Event.filter(this._paneCompositeService.onDidPaneCompositeOpen, event => event.viewContainerLocation === 1 )(_ => this._activeEditorOrder = 1 , undefined, this._toDispose);
100
+ Event.filter(this._paneCompositeService.onDidPaneCompositeClose, event => event.viewContainerLocation === 1 )(_ => this._activeEditorOrder = 0 , undefined, this._toDispose);
101
+ this._editorService.onDidVisibleEditorsChange(_ => this._activeEditorOrder = 0 , undefined, this._toDispose);
102
+ this._updateState();
103
+ }
104
+ dispose() {
105
+ this._toDispose.dispose();
106
+ this._toDisposeOnEditorRemove.dispose();
107
+ }
108
+ _onDidAddEditor(e) {
109
+ this._toDisposeOnEditorRemove.set(e.getId(), combinedDisposable(e.onDidChangeModel(() => this._updateState()), e.onDidFocusEditorText(() => this._updateState()), e.onDidFocusEditorWidget(() => this._updateState(e))));
110
+ this._updateState();
111
+ }
112
+ _onDidRemoveEditor(e) {
113
+ const id = e.getId();
114
+ if (( this._toDisposeOnEditorRemove.has(id))) {
115
+ this._toDisposeOnEditorRemove.deleteAndDispose(id);
116
+ this._updateState();
117
+ }
118
+ }
119
+ _updateStateOnModelAdd(model) {
120
+ if (!shouldSynchronizeModel(model)) {
121
+ return;
122
+ }
123
+ if (!this._currentState) {
124
+ this._updateState();
125
+ return;
126
+ }
127
+ this._currentState = ( new DocumentAndEditorState(
128
+ this._currentState.documents.add(model),
129
+ this._currentState.textEditors,
130
+ this._currentState.activeEditor
131
+ ));
132
+ this._onDidChangeState(( new DocumentAndEditorStateDelta([], [model], [], [], undefined, undefined)));
133
+ }
134
+ _updateState(widgetFocusCandidate) {
135
+ const models = ( new Set());
136
+ for (const model of this._modelService.getModels()) {
137
+ if (shouldSynchronizeModel(model)) {
138
+ models.add(model);
139
+ }
140
+ }
141
+ const editors = ( new Map());
142
+ let activeEditor = null;
143
+ for (const editor of this._codeEditorService.listCodeEditors()) {
144
+ if (editor.isSimpleWidget) {
145
+ continue;
146
+ }
147
+ const model = editor.getModel();
148
+ if (editor.hasModel() && model && shouldSynchronizeModel(model)
149
+ && !model.isDisposed()
150
+ && Boolean(this._modelService.getModel(model.uri))
151
+ ) {
152
+ const apiEditor = ( new TextEditorSnapshot(editor));
153
+ editors.set(apiEditor.id, apiEditor);
154
+ if (editor.hasTextFocus() || (widgetFocusCandidate === editor && editor.hasWidgetFocus())) {
155
+ activeEditor = apiEditor.id;
156
+ }
157
+ }
158
+ }
159
+ if (!activeEditor) {
160
+ let candidate;
161
+ if (this._activeEditorOrder === 0 ) {
162
+ candidate = this._getActiveEditorFromEditorPart() || this._getActiveEditorFromPanel();
163
+ }
164
+ else {
165
+ candidate = this._getActiveEditorFromPanel() || this._getActiveEditorFromEditorPart();
166
+ }
167
+ if (candidate) {
168
+ for (const snapshot of ( editors.values())) {
169
+ if (candidate === snapshot.editor) {
170
+ activeEditor = snapshot.id;
171
+ }
172
+ }
173
+ }
174
+ }
175
+ const newState = ( new DocumentAndEditorState(models, editors, activeEditor));
176
+ const delta = DocumentAndEditorState.compute(this._currentState, newState);
177
+ if (!delta.isEmpty) {
178
+ this._currentState = newState;
179
+ this._onDidChangeState(delta);
180
+ }
181
+ }
182
+ _getActiveEditorFromPanel() {
183
+ const panel = this._paneCompositeService.getActivePaneComposite(1 );
184
+ if (panel instanceof FakeAbstractTextEditor) {
185
+ const control = panel.getControl();
186
+ if (isCodeEditor(control)) {
187
+ return control;
188
+ }
189
+ }
190
+ return undefined;
191
+ }
192
+ _getActiveEditorFromEditorPart() {
193
+ let activeTextEditorControl = this._editorService.activeTextEditorControl;
194
+ if (isDiffEditor(activeTextEditorControl)) {
195
+ activeTextEditorControl = activeTextEditorControl.getModifiedEditor();
196
+ }
197
+ return activeTextEditorControl;
198
+ }
199
+ };
200
+ MainThreadDocumentAndEditorStateComputer = ( __decorate([
201
+ ( __param(1, IModelService)),
202
+ ( __param(2, ICodeEditorService)),
203
+ ( __param(3, IEditorService)),
204
+ ( __param(4, IPaneCompositePartService))
205
+ ], MainThreadDocumentAndEditorStateComputer));
206
+ let MainThreadDocumentsAndEditors = class MainThreadDocumentsAndEditors {
207
+ constructor(extHostContext, _modelService, _textFileService, _editorService, codeEditorService, fileService, textModelResolverService, _editorGroupService, paneCompositeService, environmentService, workingCopyFileService, uriIdentityService, _clipboardService, pathService, configurationService) {
208
+ this._modelService = _modelService;
209
+ this._textFileService = _textFileService;
210
+ this._editorService = _editorService;
211
+ this._editorGroupService = _editorGroupService;
212
+ this._clipboardService = _clipboardService;
213
+ this._toDispose = ( new DisposableStore());
214
+ this._textEditors = ( new Map());
215
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostDocumentsAndEditors));
216
+ this._mainThreadDocuments = this._toDispose.add(( new MainThreadDocuments(
217
+ extHostContext,
218
+ this._modelService,
219
+ this._textFileService,
220
+ fileService,
221
+ textModelResolverService,
222
+ environmentService,
223
+ uriIdentityService,
224
+ workingCopyFileService,
225
+ pathService
226
+ )));
227
+ extHostContext.set(MainContext.MainThreadDocuments, this._mainThreadDocuments);
228
+ this._mainThreadEditors = this._toDispose.add(( new MainThreadTextEditors(
229
+ this,
230
+ extHostContext,
231
+ codeEditorService,
232
+ this._editorService,
233
+ this._editorGroupService,
234
+ configurationService
235
+ )));
236
+ extHostContext.set(MainContext.MainThreadTextEditors, this._mainThreadEditors);
237
+ this._toDispose.add(( new MainThreadDocumentAndEditorStateComputer(
238
+ delta => this._onDelta(delta),
239
+ _modelService,
240
+ codeEditorService,
241
+ this._editorService,
242
+ paneCompositeService
243
+ )));
244
+ }
245
+ dispose() {
246
+ this._toDispose.dispose();
247
+ }
248
+ _onDelta(delta) {
249
+ const removedEditors = [];
250
+ const addedEditors = [];
251
+ const removedDocuments = ( delta.removedDocuments.map(m => m.uri));
252
+ for (const apiEditor of delta.addedEditors) {
253
+ const mainThreadEditor = ( new MainThreadTextEditor(
254
+ apiEditor.id,
255
+ apiEditor.editor.getModel(),
256
+ apiEditor.editor,
257
+ { onGainedFocus() { }, onLostFocus() { } },
258
+ this._mainThreadDocuments,
259
+ this._modelService,
260
+ this._clipboardService
261
+ ));
262
+ this._textEditors.set(apiEditor.id, mainThreadEditor);
263
+ addedEditors.push(mainThreadEditor);
264
+ }
265
+ for (const { id } of delta.removedEditors) {
266
+ const mainThreadEditor = this._textEditors.get(id);
267
+ if (mainThreadEditor) {
268
+ mainThreadEditor.dispose();
269
+ this._textEditors.delete(id);
270
+ removedEditors.push(id);
271
+ }
272
+ }
273
+ const extHostDelta = Object.create(null);
274
+ let empty = true;
275
+ if (delta.newActiveEditor !== undefined) {
276
+ empty = false;
277
+ extHostDelta.newActiveEditor = delta.newActiveEditor;
278
+ }
279
+ if (removedDocuments.length > 0) {
280
+ empty = false;
281
+ extHostDelta.removedDocuments = removedDocuments;
282
+ }
283
+ if (removedEditors.length > 0) {
284
+ empty = false;
285
+ extHostDelta.removedEditors = removedEditors;
286
+ }
287
+ if (delta.addedDocuments.length > 0) {
288
+ empty = false;
289
+ extHostDelta.addedDocuments = ( delta.addedDocuments.map(m => this._toModelAddData(m)));
290
+ }
291
+ if (delta.addedEditors.length > 0) {
292
+ empty = false;
293
+ extHostDelta.addedEditors = ( addedEditors.map(e => this._toTextEditorAddData(e)));
294
+ }
295
+ if (!empty) {
296
+ this._proxy.$acceptDocumentsAndEditorsDelta(extHostDelta);
297
+ removedDocuments.forEach(this._mainThreadDocuments.handleModelRemoved, this._mainThreadDocuments);
298
+ delta.addedDocuments.forEach(this._mainThreadDocuments.handleModelAdded, this._mainThreadDocuments);
299
+ removedEditors.forEach(this._mainThreadEditors.handleTextEditorRemoved, this._mainThreadEditors);
300
+ addedEditors.forEach(this._mainThreadEditors.handleTextEditorAdded, this._mainThreadEditors);
301
+ }
302
+ }
303
+ _toModelAddData(model) {
304
+ return {
305
+ uri: model.uri,
306
+ versionId: model.getVersionId(),
307
+ lines: model.getLinesContent(),
308
+ EOL: model.getEOL(),
309
+ languageId: model.getLanguageId(),
310
+ isDirty: this._textFileService.isDirty(model.uri)
311
+ };
312
+ }
313
+ _toTextEditorAddData(textEditor) {
314
+ const props = textEditor.getProperties();
315
+ return {
316
+ id: textEditor.getId(),
317
+ documentUri: textEditor.getModel().uri,
318
+ options: props.options,
319
+ selections: props.selections,
320
+ visibleRanges: props.visibleRanges,
321
+ editorPosition: this._findEditorPosition(textEditor)
322
+ };
323
+ }
324
+ _findEditorPosition(editor) {
325
+ for (const editorPane of this._editorService.visibleEditorPanes) {
326
+ if (editor.matches(editorPane)) {
327
+ return editorGroupToColumn(this._editorGroupService, editorPane.group);
328
+ }
329
+ }
330
+ return undefined;
331
+ }
332
+ findTextEditorIdFor(editorPane) {
333
+ for (const [id, editor] of this._textEditors) {
334
+ if (editor.matches(editorPane)) {
335
+ return id;
336
+ }
337
+ }
338
+ return undefined;
339
+ }
340
+ getIdOfCodeEditor(codeEditor) {
341
+ for (const [id, editor] of this._textEditors) {
342
+ if (editor.getCodeEditor() === codeEditor) {
343
+ return id;
344
+ }
345
+ }
346
+ return undefined;
347
+ }
348
+ getEditor(id) {
349
+ return this._textEditors.get(id);
350
+ }
351
+ };
352
+ MainThreadDocumentsAndEditors = __decorate([
353
+ extHostCustomer,
354
+ ( __param(1, IModelService)),
355
+ ( __param(2, ITextFileService)),
356
+ ( __param(3, IEditorService)),
357
+ ( __param(4, ICodeEditorService)),
358
+ ( __param(5, IFileService)),
359
+ ( __param(6, ITextModelService)),
360
+ ( __param(7, IEditorGroupsService)),
361
+ ( __param(8, IPaneCompositePartService)),
362
+ ( __param(9, IWorkbenchEnvironmentService)),
363
+ ( __param(10, IWorkingCopyFileService)),
364
+ ( __param(11, IUriIdentityService)),
365
+ ( __param(12, IClipboardService)),
366
+ ( __param(13, IPathService)),
367
+ ( __param(14, IConfigurationService))
368
+ ], MainThreadDocumentsAndEditors);
369
+
370
+ export { MainThreadDocumentsAndEditors };
@@ -0,0 +1,22 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
+ import { MainContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
4
+ import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
5
+ import { IDownloadService } from 'vscode/vscode/vs/platform/download/common/download';
6
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
7
+
8
+ let MainThreadDownloadService = class MainThreadDownloadService extends Disposable {
9
+ constructor(extHostContext, downloadService) {
10
+ super();
11
+ this.downloadService = downloadService;
12
+ }
13
+ $download(uri, to) {
14
+ return this.downloadService.download(URI.revive(uri), URI.revive(to));
15
+ }
16
+ };
17
+ MainThreadDownloadService = __decorate([
18
+ extHostNamedCustomer(MainContext.MainThreadDownloadService),
19
+ ( __param(1, IDownloadService))
20
+ ], MainThreadDownloadService);
21
+
22
+ export { MainThreadDownloadService };
@@ -0,0 +1,41 @@
1
+ import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
4
+ import { extHostCustomer } from '../../services/extensions/common/extHostCustomers.js';
5
+ import { raceCancellationError } from 'vscode/vscode/vs/base/common/async';
6
+ import { IEditSessionIdentityService } from 'vscode/vscode/vs/platform/workspace/common/editSessions';
7
+ import { ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
8
+
9
+ class ExtHostEditSessionIdentityCreateParticipant {
10
+ constructor(extHostContext) {
11
+ this.timeout = 10000;
12
+ this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostWorkspace));
13
+ }
14
+ async participate(workspaceFolder, token) {
15
+ const p = ( new Promise((resolve, reject) => {
16
+ setTimeout(() => reject(( new Error(( localizeWithPath(
17
+ 'vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant',
18
+ 'timeout.onWillCreateEditSessionIdentity',
19
+ "Aborted onWillCreateEditSessionIdentity-event after 10000ms"
20
+ ))))), this.timeout);
21
+ this._proxy.$onWillCreateEditSessionIdentity(workspaceFolder.uri, token, this.timeout).then(resolve, reject);
22
+ }));
23
+ return raceCancellationError(p, token);
24
+ }
25
+ }
26
+ let EditSessionIdentityCreateParticipant = class EditSessionIdentityCreateParticipant {
27
+ constructor(extHostContext, instantiationService, _editSessionIdentityService) {
28
+ this._editSessionIdentityService = _editSessionIdentityService;
29
+ this._saveParticipantDisposable = this._editSessionIdentityService.addEditSessionIdentityCreateParticipant(instantiationService.createInstance(ExtHostEditSessionIdentityCreateParticipant, extHostContext));
30
+ }
31
+ dispose() {
32
+ this._saveParticipantDisposable.dispose();
33
+ }
34
+ };
35
+ EditSessionIdentityCreateParticipant = __decorate([
36
+ extHostCustomer,
37
+ ( __param(1, IInstantiationService)),
38
+ ( __param(2, IEditSessionIdentityService))
39
+ ], EditSessionIdentityCreateParticipant);
40
+
41
+ export { EditSessionIdentityCreateParticipant };