@codingame/monaco-vscode-extensions-service-override 3.2.3 → 4.1.0

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 (108) hide show
  1. package/extensions.js +6 -87
  2. package/override/vs/platform/dialogs/common/dialogs.js +2 -0
  3. package/package.json +9 -9
  4. package/_virtual/semver.js +0 -3
  5. package/external/vscode-semver/semver.js +0 -985
  6. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +0 -8
  7. package/vscode/src/vs/base/common/console.js +0 -59
  8. package/vscode/src/vs/platform/extensionManagement/common/extensionManagementCLI.js +0 -497
  9. package/vscode/src/vs/platform/extensionResourceLoader/browser/extensionResourceLoaderService.js +0 -44
  10. package/vscode/src/vs/platform/lifecycle/common/lifecycle.js +0 -27
  11. package/vscode/src/vs/platform/remote/common/managedSocket.js +0 -98
  12. package/vscode/src/vs/workbench/api/browser/mainThreadAiEmbeddingVector.js +0 -31
  13. package/vscode/src/vs/workbench/api/browser/mainThreadAiRelatedInformation.js +0 -35
  14. package/vscode/src/vs/workbench/api/browser/mainThreadAuthentication.js +0 -227
  15. package/vscode/src/vs/workbench/api/browser/mainThreadBulkEdits.js +0 -68
  16. package/vscode/src/vs/workbench/api/browser/mainThreadCLICommands.js +0 -103
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChat.js +0 -83
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +0 -203
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatProvider.js +0 -201
  20. package/vscode/src/vs/workbench/api/browser/mainThreadChatVariables.js +0 -41
  21. package/vscode/src/vs/workbench/api/browser/mainThreadClipboard.js +0 -24
  22. package/vscode/src/vs/workbench/api/browser/mainThreadCodeInsets.js +0 -107
  23. package/vscode/src/vs/workbench/api/browser/mainThreadCommands.js +0 -98
  24. package/vscode/src/vs/workbench/api/browser/mainThreadComments.js +0 -545
  25. package/vscode/src/vs/workbench/api/browser/mainThreadConfiguration.js +0 -80
  26. package/vscode/src/vs/workbench/api/browser/mainThreadConsole.js +0 -35
  27. package/vscode/src/vs/workbench/api/browser/mainThreadCustomEditors.js +0 -578
  28. package/vscode/src/vs/workbench/api/browser/mainThreadDebugService.js +0 -424
  29. package/vscode/src/vs/workbench/api/browser/mainThreadDecorations.js +0 -102
  30. package/vscode/src/vs/workbench/api/browser/mainThreadDiagnostics.js +0 -69
  31. package/vscode/src/vs/workbench/api/browser/mainThreadDialogs.js +0 -68
  32. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentContentProviders.js +0 -79
  33. package/vscode/src/vs/workbench/api/browser/mainThreadDocuments.js +0 -253
  34. package/vscode/src/vs/workbench/api/browser/mainThreadDocumentsAndEditors.js +0 -370
  35. package/vscode/src/vs/workbench/api/browser/mainThreadDownloadService.js +0 -22
  36. package/vscode/src/vs/workbench/api/browser/mainThreadEditSessionIdentityParticipant.js +0 -41
  37. package/vscode/src/vs/workbench/api/browser/mainThreadEditor.js +0 -414
  38. package/vscode/src/vs/workbench/api/browser/mainThreadEditorTabs.js +0 -482
  39. package/vscode/src/vs/workbench/api/browser/mainThreadEditors.js +0 -227
  40. package/vscode/src/vs/workbench/api/browser/mainThreadErrors.js +0 -24
  41. package/vscode/src/vs/workbench/api/browser/mainThreadExtensionService.js +0 -317
  42. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystem.js +0 -208
  43. package/vscode/src/vs/workbench/api/browser/mainThreadFileSystemEventService.js +0 -374
  44. package/vscode/src/vs/workbench/api/browser/mainThreadInlineChat.js +0 -72
  45. package/vscode/src/vs/workbench/api/browser/mainThreadInteractive.js +0 -28
  46. package/vscode/src/vs/workbench/api/browser/mainThreadIssueReporter.js +0 -50
  47. package/vscode/src/vs/workbench/api/browser/mainThreadLabelService.js +0 -27
  48. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageFeatures.js +0 -991
  49. package/vscode/src/vs/workbench/api/browser/mainThreadLanguages.js +0 -78
  50. package/vscode/src/vs/workbench/api/browser/mainThreadLocalization.js +0 -35
  51. package/vscode/src/vs/workbench/api/browser/mainThreadLogService.js +0 -78
  52. package/vscode/src/vs/workbench/api/browser/mainThreadManagedSockets.js +0 -93
  53. package/vscode/src/vs/workbench/api/browser/mainThreadMessageService.js +0 -137
  54. package/vscode/src/vs/workbench/api/browser/mainThreadNotebook.js +0 -194
  55. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocuments.js +0 -123
  56. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.js +0 -188
  57. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookDto.js +0 -129
  58. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookEditors.js +0 -131
  59. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookKernels.js +0 -374
  60. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookRenderers.js +0 -25
  61. package/vscode/src/vs/workbench/api/browser/mainThreadNotebookSaveParticipant.js +0 -48
  62. package/vscode/src/vs/workbench/api/browser/mainThreadOutputService.js +0 -76
  63. package/vscode/src/vs/workbench/api/browser/mainThreadProfilContentHandlers.js +0 -38
  64. package/vscode/src/vs/workbench/api/browser/mainThreadProgress.js +0 -68
  65. package/vscode/src/vs/workbench/api/browser/mainThreadQuickDiff.js +0 -42
  66. package/vscode/src/vs/workbench/api/browser/mainThreadQuickOpen.js +0 -185
  67. package/vscode/src/vs/workbench/api/browser/mainThreadRemoteConnectionData.js +0 -30
  68. package/vscode/src/vs/workbench/api/browser/mainThreadSCM.js +0 -493
  69. package/vscode/src/vs/workbench/api/browser/mainThreadSaveParticipant.js +0 -49
  70. package/vscode/src/vs/workbench/api/browser/mainThreadSearch.js +0 -146
  71. package/vscode/src/vs/workbench/api/browser/mainThreadSecretState.js +0 -70
  72. package/vscode/src/vs/workbench/api/browser/mainThreadShare.js +0 -50
  73. package/vscode/src/vs/workbench/api/browser/mainThreadSpeech.js +0 -99
  74. package/vscode/src/vs/workbench/api/browser/mainThreadStatusBar.js +0 -53
  75. package/vscode/src/vs/workbench/api/browser/mainThreadStorage.js +0 -72
  76. package/vscode/src/vs/workbench/api/browser/mainThreadTask.js +0 -731
  77. package/vscode/src/vs/workbench/api/browser/mainThreadTelemetry.js +0 -53
  78. package/vscode/src/vs/workbench/api/browser/mainThreadTerminalService.js +0 -408
  79. package/vscode/src/vs/workbench/api/browser/mainThreadTesting.js +0 -195
  80. package/vscode/src/vs/workbench/api/browser/mainThreadTheming.js +0 -24
  81. package/vscode/src/vs/workbench/api/browser/mainThreadTimeline.js +0 -55
  82. package/vscode/src/vs/workbench/api/browser/mainThreadTreeViews.js +0 -312
  83. package/vscode/src/vs/workbench/api/browser/mainThreadTunnelService.js +0 -223
  84. package/vscode/src/vs/workbench/api/browser/mainThreadUriOpeners.js +0 -110
  85. package/vscode/src/vs/workbench/api/browser/mainThreadUrls.js +0 -61
  86. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewManager.js +0 -29
  87. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewPanels.js +0 -283
  88. package/vscode/src/vs/workbench/api/browser/mainThreadWebviewViews.js +0 -100
  89. package/vscode/src/vs/workbench/api/browser/mainThreadWebviews.js +0 -135
  90. package/vscode/src/vs/workbench/api/browser/mainThreadWindow.js +0 -57
  91. package/vscode/src/vs/workbench/api/browser/mainThreadWorkspace.js +0 -268
  92. package/vscode/src/vs/workbench/api/common/shared/dataTransferCache.js +0 -35
  93. package/vscode/src/vs/workbench/contrib/customEditor/common/customTextEditorModel.js +0 -73
  94. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/contributedOpeners.js +0 -83
  95. package/vscode/src/vs/workbench/services/extensions/browser/extensionService.js +0 -284
  96. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerExtensionHost.js +0 -276
  97. package/vscode/src/vs/workbench/services/extensions/browser/webWorkerFileSystemProvider.js +0 -52
  98. package/vscode/src/vs/workbench/services/extensions/common/abstractExtensionService.js +0 -1138
  99. package/vscode/src/vs/workbench/services/extensions/common/extHostCustomers.js +0 -41
  100. package/vscode/src/vs/workbench/services/extensions/common/extensionDevOptions.js +0 -25
  101. package/vscode/src/vs/workbench/services/extensions/common/extensionHostManager.js +0 -512
  102. package/vscode/src/vs/workbench/services/extensions/common/extensionRunningLocationTracker.js +0 -274
  103. package/vscode/src/vs/workbench/services/extensions/common/extensionStorageMigration.js +0 -58
  104. package/vscode/src/vs/workbench/services/extensions/common/extensionsProposedApi.js +0 -80
  105. package/vscode/src/vs/workbench/services/extensions/common/extensionsUtil.js +0 -64
  106. package/vscode/src/vs/workbench/services/extensions/common/lazyCreateExtensionHostManager.js +0 -161
  107. package/vscode/src/vs/workbench/services/extensions/common/remoteConsoleUtil.js +0 -49
  108. package/vscode/src/vs/workbench/services/extensions/common/remoteExtensionHost.js +0 -222
@@ -1,24 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
3
- import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
4
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
5
-
6
- let MainThreadTheming = class MainThreadTheming {
7
- constructor(extHostContext, themeService) {
8
- this._themeService = themeService;
9
- this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTheming));
10
- this._themeChangeListener = this._themeService.onDidColorThemeChange(e => {
11
- this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type);
12
- });
13
- this._proxy.$onColorThemeChange(this._themeService.getColorTheme().type);
14
- }
15
- dispose() {
16
- this._themeChangeListener.dispose();
17
- }
18
- };
19
- MainThreadTheming = __decorate([
20
- extHostNamedCustomer(MainContext.MainThreadTheming),
21
- ( __param(1, IThemeService))
22
- ], MainThreadTheming);
23
-
24
- export { MainThreadTheming };
@@ -1,55 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { Emitter } from 'vscode/vscode/vs/base/common/event';
3
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
4
- import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
5
- import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
6
- import { ITimelineService } from 'vscode/vscode/vs/workbench/contrib/timeline/common/timeline';
7
- import { revive } from 'vscode/vscode/vs/base/common/marshalling';
8
-
9
- let MainThreadTimeline = class MainThreadTimeline {
10
- constructor(context, logService, _timelineService) {
11
- this.logService = logService;
12
- this._timelineService = _timelineService;
13
- this._providerEmitters = ( new Map());
14
- this._proxy = ( context.getProxy(ExtHostContext.ExtHostTimeline));
15
- }
16
- $registerTimelineProvider(provider) {
17
- this.logService.trace(`MainThreadTimeline#registerTimelineProvider: id=${provider.id}`);
18
- const proxy = this._proxy;
19
- const emitters = this._providerEmitters;
20
- let onDidChange = emitters.get(provider.id);
21
- if (onDidChange === undefined) {
22
- onDidChange = ( new Emitter());
23
- emitters.set(provider.id, onDidChange);
24
- }
25
- this._timelineService.registerTimelineProvider({
26
- ...provider,
27
- onDidChange: onDidChange.event,
28
- async provideTimeline(uri, options, token) {
29
- return revive(await proxy.$getTimeline(provider.id, uri, options, token));
30
- },
31
- dispose() {
32
- emitters.delete(provider.id);
33
- onDidChange?.dispose();
34
- }
35
- });
36
- }
37
- $unregisterTimelineProvider(id) {
38
- this.logService.trace(`MainThreadTimeline#unregisterTimelineProvider: id=${id}`);
39
- this._timelineService.unregisterTimelineProvider(id);
40
- }
41
- $emitTimelineChangeEvent(e) {
42
- this.logService.trace(`MainThreadTimeline#emitChangeEvent: id=${e.id}, uri=${e.uri?.toString(true)}`);
43
- const emitter = this._providerEmitters.get(e.id);
44
- emitter?.fire(e);
45
- }
46
- dispose() {
47
- }
48
- };
49
- MainThreadTimeline = __decorate([
50
- extHostNamedCustomer(MainContext.MainThreadTimeline),
51
- ( __param(1, ILogService)),
52
- ( __param(2, ITimelineService))
53
- ], MainThreadTimeline);
54
-
55
- export { MainThreadTimeline };
@@ -1,312 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { Disposable, DisposableMap, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { MainContext, ExtHostContext } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
4
- import { Extensions, NoTreeViewError, ResolvableTreeItem } from 'vscode/vscode/vs/workbench/common/views';
5
- import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
6
- import { distinct } from 'vscode/vscode/vs/base/common/arrays';
7
- import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification';
8
- import { isUndefinedOrNull, isNumber } from 'vscode/vscode/vs/base/common/types';
9
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
10
- import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
11
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
12
- import { VSDataTransfer, createStringDataTransferItem } from 'vscode/vscode/vs/base/common/dataTransfer';
13
- import { DataTransferFileCache } from '../common/shared/dataTransferCache.js';
14
- import { DataTransfer } from 'vscode/vscode/vs/workbench/api/common/extHostTypeConverters';
15
- import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService';
16
-
17
- let MainThreadTreeViews = class MainThreadTreeViews extends Disposable {
18
- constructor(extHostContext, viewsService, notificationService, extensionService, logService) {
19
- super();
20
- this.viewsService = viewsService;
21
- this.notificationService = notificationService;
22
- this.extensionService = extensionService;
23
- this.logService = logService;
24
- this._dataProviders = this._register(( new DisposableMap()));
25
- this._dndControllers = ( new Map());
26
- this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTreeViews));
27
- }
28
- async $registerTreeViewDataProvider(treeViewId, options) {
29
- this.logService.trace('MainThreadTreeViews#$registerTreeViewDataProvider', treeViewId, options);
30
- this.extensionService.whenInstalledExtensionsRegistered().then(() => {
31
- const dataProvider = ( new TreeViewDataProvider(treeViewId, this._proxy, this.notificationService));
32
- const disposables = ( new DisposableStore());
33
- this._dataProviders.set(treeViewId, { dataProvider, dispose: () => disposables.dispose() });
34
- const dndController = (options.hasHandleDrag || options.hasHandleDrop)
35
- ? ( new TreeViewDragAndDropController(
36
- treeViewId,
37
- options.dropMimeTypes,
38
- options.dragMimeTypes,
39
- options.hasHandleDrag,
40
- this._proxy
41
- )) : undefined;
42
- const viewer = this.getTreeView(treeViewId);
43
- if (viewer) {
44
- viewer.showCollapseAllAction = options.showCollapseAll;
45
- viewer.canSelectMany = options.canSelectMany;
46
- viewer.manuallyManageCheckboxes = options.manuallyManageCheckboxes;
47
- viewer.dragAndDropController = dndController;
48
- if (dndController) {
49
- this._dndControllers.set(treeViewId, dndController);
50
- }
51
- viewer.dataProvider = dataProvider;
52
- this.registerListeners(treeViewId, viewer, disposables);
53
- this._proxy.$setVisible(treeViewId, viewer.visible);
54
- }
55
- else {
56
- this.notificationService.error('No view is registered with id: ' + treeViewId);
57
- }
58
- });
59
- }
60
- $reveal(treeViewId, itemInfo, options) {
61
- this.logService.trace('MainThreadTreeViews#$reveal', treeViewId, itemInfo?.item, itemInfo?.parentChain, options);
62
- return this.viewsService.openView(treeViewId, options.focus)
63
- .then(() => {
64
- const viewer = this.getTreeView(treeViewId);
65
- if (viewer && itemInfo) {
66
- return this.reveal(viewer, this._dataProviders.get(treeViewId).dataProvider, itemInfo.item, itemInfo.parentChain, options);
67
- }
68
- return undefined;
69
- });
70
- }
71
- $refresh(treeViewId, itemsToRefreshByHandle) {
72
- this.logService.trace('MainThreadTreeViews#$refresh', treeViewId, itemsToRefreshByHandle);
73
- const viewer = this.getTreeView(treeViewId);
74
- const dataProvider = this._dataProviders.get(treeViewId);
75
- if (viewer && dataProvider) {
76
- const itemsToRefresh = dataProvider.dataProvider.getItemsToRefresh(itemsToRefreshByHandle);
77
- return viewer.refresh(itemsToRefresh.length ? itemsToRefresh : undefined);
78
- }
79
- return Promise.resolve();
80
- }
81
- $setMessage(treeViewId, message) {
82
- this.logService.trace('MainThreadTreeViews#$setMessage', treeViewId, ( message.toString()));
83
- const viewer = this.getTreeView(treeViewId);
84
- if (viewer) {
85
- viewer.message = message;
86
- }
87
- }
88
- $setTitle(treeViewId, title, description) {
89
- this.logService.trace('MainThreadTreeViews#$setTitle', treeViewId, title, description);
90
- const viewer = this.getTreeView(treeViewId);
91
- if (viewer) {
92
- viewer.title = title;
93
- viewer.description = description;
94
- }
95
- }
96
- $setBadge(treeViewId, badge) {
97
- this.logService.trace('MainThreadTreeViews#$setBadge', treeViewId, badge?.value, badge?.tooltip);
98
- const viewer = this.getTreeView(treeViewId);
99
- if (viewer) {
100
- viewer.badge = badge;
101
- }
102
- }
103
- $resolveDropFileData(destinationViewId, requestId, dataItemId) {
104
- const controller = this._dndControllers.get(destinationViewId);
105
- if (!controller) {
106
- throw new Error('Unknown tree');
107
- }
108
- return controller.resolveDropFileData(requestId, dataItemId);
109
- }
110
- async $disposeTree(treeViewId) {
111
- const viewer = this.getTreeView(treeViewId);
112
- if (viewer) {
113
- viewer.dataProvider = undefined;
114
- }
115
- this._dataProviders.deleteAndDispose(treeViewId);
116
- }
117
- async reveal(treeView, dataProvider, itemIn, parentChain, options) {
118
- options = options ? options : { select: false, focus: false };
119
- const select = isUndefinedOrNull(options.select) ? false : options.select;
120
- const focus = isUndefinedOrNull(options.focus) ? false : options.focus;
121
- let expand = Math.min(isNumber(options.expand) ? options.expand : options.expand === true ? 1 : 0, 3);
122
- if (dataProvider.isEmpty()) {
123
- await treeView.refresh();
124
- }
125
- for (const parent of parentChain) {
126
- const parentItem = dataProvider.getItem(parent.handle);
127
- if (parentItem) {
128
- await treeView.expand(parentItem);
129
- }
130
- }
131
- const item = dataProvider.getItem(itemIn.handle);
132
- if (item) {
133
- await treeView.reveal(item);
134
- if (select) {
135
- treeView.setSelection([item]);
136
- }
137
- if (focus === false) {
138
- treeView.setFocus();
139
- }
140
- else if (focus) {
141
- treeView.setFocus(item);
142
- }
143
- let itemsToExpand = [item];
144
- for (; itemsToExpand.length > 0 && expand > 0; expand--) {
145
- await treeView.expand(itemsToExpand);
146
- itemsToExpand = itemsToExpand.reduce((result, itemValue) => {
147
- const item = dataProvider.getItem(itemValue.handle);
148
- if (item && item.children && item.children.length) {
149
- result.push(...item.children);
150
- }
151
- return result;
152
- }, []);
153
- }
154
- }
155
- }
156
- registerListeners(treeViewId, treeView, disposables) {
157
- disposables.add(treeView.onDidExpandItem(item => this._proxy.$setExpanded(treeViewId, item.handle, true)));
158
- disposables.add(treeView.onDidCollapseItem(item => this._proxy.$setExpanded(treeViewId, item.handle, false)));
159
- disposables.add(treeView.onDidChangeSelectionAndFocus(items => this._proxy.$setSelectionAndFocus(treeViewId, ( items.selection.map(({ handle }) => handle)), items.focus.handle)));
160
- disposables.add(treeView.onDidChangeVisibility(isVisible => this._proxy.$setVisible(treeViewId, isVisible)));
161
- disposables.add(treeView.onDidChangeCheckboxState(items => {
162
- this._proxy.$changeCheckboxState(treeViewId, ( items.map(item => {
163
- return { treeItemHandle: item.handle, newState: item.checkbox?.isChecked ?? false };
164
- })));
165
- }));
166
- }
167
- getTreeView(treeViewId) {
168
- const viewDescriptor = ( Registry.as(Extensions.ViewsRegistry)).getView(treeViewId);
169
- return viewDescriptor ? viewDescriptor.treeView : null;
170
- }
171
- dispose() {
172
- for (const dataprovider of this._dataProviders) {
173
- const treeView = this.getTreeView(dataprovider[0]);
174
- if (treeView) {
175
- treeView.dataProvider = undefined;
176
- }
177
- }
178
- this._dataProviders.dispose();
179
- this._dndControllers.clear();
180
- super.dispose();
181
- }
182
- };
183
- MainThreadTreeViews = __decorate([
184
- extHostNamedCustomer(MainContext.MainThreadTreeViews),
185
- ( __param(1, IViewsService)),
186
- ( __param(2, INotificationService)),
187
- ( __param(3, IExtensionService)),
188
- ( __param(4, ILogService))
189
- ], MainThreadTreeViews);
190
- class TreeViewDragAndDropController {
191
- constructor(treeViewId, dropMimeTypes, dragMimeTypes, hasWillDrop, _proxy) {
192
- this.treeViewId = treeViewId;
193
- this.dropMimeTypes = dropMimeTypes;
194
- this.dragMimeTypes = dragMimeTypes;
195
- this.hasWillDrop = hasWillDrop;
196
- this._proxy = _proxy;
197
- this.dataTransfersCache = ( new DataTransferFileCache());
198
- }
199
- async handleDrop(dataTransfer, targetTreeItem, token, operationUuid, sourceTreeId, sourceTreeItemHandles) {
200
- const request = this.dataTransfersCache.add(dataTransfer);
201
- try {
202
- const dataTransferDto = await DataTransfer.from(dataTransfer);
203
- if (token.isCancellationRequested) {
204
- return;
205
- }
206
- return await this._proxy.$handleDrop(this.treeViewId, request.id, dataTransferDto, targetTreeItem?.handle, token, operationUuid, sourceTreeId, sourceTreeItemHandles);
207
- }
208
- finally {
209
- request.dispose();
210
- }
211
- }
212
- async handleDrag(sourceTreeItemHandles, operationUuid, token) {
213
- if (!this.hasWillDrop) {
214
- return;
215
- }
216
- const additionalDataTransferDTO = await this._proxy.$handleDrag(this.treeViewId, sourceTreeItemHandles, operationUuid, token);
217
- if (!additionalDataTransferDTO) {
218
- return;
219
- }
220
- const additionalDataTransfer = ( new VSDataTransfer());
221
- additionalDataTransferDTO.items.forEach(([type, item]) => {
222
- additionalDataTransfer.replace(type, createStringDataTransferItem(item.asString));
223
- });
224
- return additionalDataTransfer;
225
- }
226
- resolveDropFileData(requestId, dataItemId) {
227
- return this.dataTransfersCache.resolveFileData(requestId, dataItemId);
228
- }
229
- }
230
- class TreeViewDataProvider {
231
- constructor(treeViewId, _proxy, notificationService) {
232
- this.treeViewId = treeViewId;
233
- this._proxy = _proxy;
234
- this.notificationService = notificationService;
235
- this.itemsMap = ( new Map());
236
- this.hasResolve = this._proxy.$hasResolve(this.treeViewId);
237
- }
238
- getChildren(treeItem) {
239
- if (!treeItem) {
240
- this.itemsMap.clear();
241
- }
242
- return this._proxy.$getChildren(this.treeViewId, treeItem ? treeItem.handle : undefined)
243
- .then(children => this.postGetChildren(children), err => {
244
- if (!NoTreeViewError.is(err)) {
245
- this.notificationService.error(err);
246
- }
247
- return [];
248
- });
249
- }
250
- getItemsToRefresh(itemsToRefreshByHandle) {
251
- const itemsToRefresh = [];
252
- if (itemsToRefreshByHandle) {
253
- for (const treeItemHandle of ( Object.keys(itemsToRefreshByHandle))) {
254
- const currentTreeItem = this.getItem(treeItemHandle);
255
- if (currentTreeItem) {
256
- const treeItem = itemsToRefreshByHandle[treeItemHandle];
257
- this.updateTreeItem(currentTreeItem, treeItem);
258
- if (treeItemHandle === treeItem.handle) {
259
- itemsToRefresh.push(currentTreeItem);
260
- }
261
- else {
262
- this.itemsMap.delete(treeItemHandle);
263
- this.itemsMap.set(currentTreeItem.handle, currentTreeItem);
264
- const parent = treeItem.parentHandle ? this.itemsMap.get(treeItem.parentHandle) : null;
265
- if (parent) {
266
- itemsToRefresh.push(parent);
267
- }
268
- }
269
- }
270
- }
271
- }
272
- return itemsToRefresh;
273
- }
274
- getItem(treeItemHandle) {
275
- return this.itemsMap.get(treeItemHandle);
276
- }
277
- isEmpty() {
278
- return this.itemsMap.size === 0;
279
- }
280
- async postGetChildren(elements) {
281
- if (elements === undefined) {
282
- return undefined;
283
- }
284
- const result = [];
285
- const hasResolve = await this.hasResolve;
286
- if (elements) {
287
- for (const element of elements) {
288
- const resolvable = ( new ResolvableTreeItem(element, hasResolve ? (token) => {
289
- return this._proxy.$resolve(this.treeViewId, element.handle, token);
290
- } : undefined));
291
- this.itemsMap.set(element.handle, resolvable);
292
- result.push(resolvable);
293
- }
294
- }
295
- return result;
296
- }
297
- updateTreeItem(current, treeItem) {
298
- treeItem.children = treeItem.children ? treeItem.children : undefined;
299
- if (current) {
300
- const properties = distinct([...( Object.keys(current instanceof ResolvableTreeItem ? current.asTreeItem() : current)),
301
- ...( Object.keys(treeItem))]);
302
- for (const property of properties) {
303
- current[property] = treeItem[property];
304
- }
305
- if (current instanceof ResolvableTreeItem) {
306
- current.resetResolve();
307
- }
308
- }
309
- }
310
- }
311
-
312
- export { MainThreadTreeViews };
@@ -1,223 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../external/tslib/tslib.es6.js';
2
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { MainContext, ExtHostContext, CandidatePortSource } from 'vscode/vscode/vs/workbench/api/common/extHost.protocol';
4
- import { TunnelDtoConverter } from 'vscode/vscode/vs/workbench/api/common/extHostTunnelService';
5
- import { extHostNamedCustomer } from '../../services/extensions/common/extHostCustomers.js';
6
- import { IRemoteExplorerService, PORT_AUTO_FORWARD_SETTING, PORT_AUTO_SOURCE_SETTING, PORT_AUTO_SOURCE_SETTING_OUTPUT } from 'vscode/vscode/vs/workbench/services/remote/common/remoteExplorerService';
7
- import { ITunnelService, TunnelProtocol } from 'vscode/vscode/vs/platform/tunnel/common/tunnel';
8
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
9
- import { INotificationService, Severity } from 'vscode/vscode/vs/platform/notification/common/notification';
10
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
11
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log';
12
- import { IRemoteAgentService } from 'vscode/vscode/vs/workbench/services/remote/common/remoteAgentService';
13
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
14
- import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
15
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
16
- import { TunnelSource, TunnelCloseReason, forwardedPortsViewEnabled, makeAddress } from 'vscode/vscode/vs/workbench/services/remote/common/tunnelModel';
17
-
18
- let MainThreadTunnelService = class MainThreadTunnelService extends Disposable {
19
- constructor(extHostContext, remoteExplorerService, tunnelService, notificationService, configurationService, logService, remoteAgentService, contextKeyService) {
20
- super();
21
- this.remoteExplorerService = remoteExplorerService;
22
- this.tunnelService = tunnelService;
23
- this.notificationService = notificationService;
24
- this.configurationService = configurationService;
25
- this.logService = logService;
26
- this.remoteAgentService = remoteAgentService;
27
- this.contextKeyService = contextKeyService;
28
- this.elevateionRetry = false;
29
- this.portsAttributesProviders = ( new Map());
30
- this._alreadyRegistered = false;
31
- this._proxy = ( extHostContext.getProxy(ExtHostContext.ExtHostTunnelService));
32
- this._register(tunnelService.onTunnelOpened(() => this._proxy.$onDidTunnelsChange()));
33
- this._register(tunnelService.onTunnelClosed(() => this._proxy.$onDidTunnelsChange()));
34
- }
35
- processFindingEnabled() {
36
- return (!!this.configurationService.getValue(PORT_AUTO_FORWARD_SETTING) || this.tunnelService.hasTunnelProvider)
37
- && (this.configurationService.getValue(PORT_AUTO_SOURCE_SETTING) !== PORT_AUTO_SOURCE_SETTING_OUTPUT);
38
- }
39
- async $setRemoteTunnelService(processId) {
40
- this.remoteExplorerService.namedProcesses.set(processId, 'Code Extension Host');
41
- if (this.remoteExplorerService.portsFeaturesEnabled) {
42
- this._proxy.$registerCandidateFinder(this.processFindingEnabled());
43
- }
44
- else {
45
- this._register(this.remoteExplorerService.onEnabledPortsFeatures(() => this._proxy.$registerCandidateFinder(this.processFindingEnabled())));
46
- }
47
- this._register(this.configurationService.onDidChangeConfiguration(async (e) => {
48
- if (e.affectsConfiguration(PORT_AUTO_FORWARD_SETTING) || e.affectsConfiguration(PORT_AUTO_SOURCE_SETTING)) {
49
- return this._proxy.$registerCandidateFinder(this.processFindingEnabled());
50
- }
51
- }));
52
- this._register(this.tunnelService.onAddedTunnelProvider(() => {
53
- return this._proxy.$registerCandidateFinder(this.processFindingEnabled());
54
- }));
55
- }
56
- async $registerPortsAttributesProvider(selector, providerHandle) {
57
- this.portsAttributesProviders.set(providerHandle, selector);
58
- if (!this._alreadyRegistered) {
59
- this.remoteExplorerService.tunnelModel.addAttributesProvider(this);
60
- this._alreadyRegistered = true;
61
- }
62
- }
63
- async $unregisterPortsAttributesProvider(providerHandle) {
64
- this.portsAttributesProviders.delete(providerHandle);
65
- }
66
- async providePortAttributes(ports, pid, commandLine, token) {
67
- if (this.portsAttributesProviders.size === 0) {
68
- return [];
69
- }
70
- const appropriateHandles = ( Array.from(this.portsAttributesProviders.entries()).filter(entry => {
71
- const selector = entry[1];
72
- const portRange = (typeof selector.portRange === 'number') ? [selector.portRange, selector.portRange + 1] : selector.portRange;
73
- const portInRange = portRange ? ( ports.some(port => portRange[0] <= port && port < portRange[1])) : true;
74
- const commandMatches = !selector.commandPattern || (commandLine && (commandLine.match(selector.commandPattern)));
75
- return portInRange && commandMatches;
76
- }).map(entry => entry[0]));
77
- if (appropriateHandles.length === 0) {
78
- return [];
79
- }
80
- return this._proxy.$providePortAttributes(appropriateHandles, ports, pid, commandLine, token);
81
- }
82
- async $openTunnel(tunnelOptions, source) {
83
- const tunnel = await this.remoteExplorerService.forward({
84
- remote: tunnelOptions.remoteAddress,
85
- local: tunnelOptions.localAddressPort,
86
- name: tunnelOptions.label,
87
- source: {
88
- source: TunnelSource.Extension,
89
- description: source
90
- },
91
- elevateIfNeeded: false
92
- });
93
- if (!tunnel || (typeof tunnel === 'string')) {
94
- return undefined;
95
- }
96
- if (!this.elevateionRetry
97
- && (tunnelOptions.localAddressPort !== undefined)
98
- && (tunnel.tunnelLocalPort !== undefined)
99
- && this.tunnelService.isPortPrivileged(tunnelOptions.localAddressPort)
100
- && (tunnel.tunnelLocalPort !== tunnelOptions.localAddressPort)
101
- && this.tunnelService.canElevate) {
102
- this.elevationPrompt(tunnelOptions, tunnel, source);
103
- }
104
- return TunnelDtoConverter.fromServiceTunnel(tunnel);
105
- }
106
- async elevationPrompt(tunnelOptions, tunnel, source) {
107
- return this.notificationService.prompt(Severity.Info, ( localizeWithPath(
108
- 'vs/workbench/api/browser/mainThreadTunnelService',
109
- 'remote.tunnel.openTunnel',
110
- "The extension {0} has forwarded port {1}. You'll need to run as superuser to use port {2} locally.",
111
- source,
112
- tunnelOptions.remoteAddress.port,
113
- tunnelOptions.localAddressPort
114
- )), [{
115
- label: ( localizeWithPath(
116
- 'vs/workbench/api/browser/mainThreadTunnelService',
117
- 'remote.tunnelsView.elevationButton',
118
- "Use Port {0} as Sudo...",
119
- tunnel.tunnelRemotePort
120
- )),
121
- run: async () => {
122
- this.elevateionRetry = true;
123
- await this.remoteExplorerService.close({ host: tunnel.tunnelRemoteHost, port: tunnel.tunnelRemotePort }, TunnelCloseReason.Other);
124
- await this.remoteExplorerService.forward({
125
- remote: tunnelOptions.remoteAddress,
126
- local: tunnelOptions.localAddressPort,
127
- name: tunnelOptions.label,
128
- source: {
129
- source: TunnelSource.Extension,
130
- description: source
131
- },
132
- elevateIfNeeded: true
133
- });
134
- this.elevateionRetry = false;
135
- }
136
- }]);
137
- }
138
- async $closeTunnel(remote) {
139
- return this.remoteExplorerService.close(remote, TunnelCloseReason.Other);
140
- }
141
- async $getTunnels() {
142
- return ( (await this.tunnelService.tunnels).map(tunnel => {
143
- return {
144
- remoteAddress: { port: tunnel.tunnelRemotePort, host: tunnel.tunnelRemoteHost },
145
- localAddress: tunnel.localAddress,
146
- privacy: tunnel.privacy,
147
- protocol: tunnel.protocol
148
- };
149
- }));
150
- }
151
- async $onFoundNewCandidates(candidates) {
152
- this.remoteExplorerService.onFoundNewCandidates(candidates);
153
- }
154
- async $setTunnelProvider(features) {
155
- const tunnelProvider = {
156
- forwardPort: (tunnelOptions, tunnelCreationOptions) => {
157
- const forward = this._proxy.$forwardPort(tunnelOptions, tunnelCreationOptions);
158
- return forward.then(tunnelOrError => {
159
- if (!tunnelOrError) {
160
- return undefined;
161
- }
162
- else if (typeof tunnelOrError === 'string') {
163
- return tunnelOrError;
164
- }
165
- const tunnel = tunnelOrError;
166
- this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) New tunnel established by tunnel provider: ${tunnel?.remoteAddress.host}:${tunnel?.remoteAddress.port}`);
167
- return {
168
- tunnelRemotePort: tunnel.remoteAddress.port,
169
- tunnelRemoteHost: tunnel.remoteAddress.host,
170
- localAddress: typeof tunnel.localAddress === 'string' ? tunnel.localAddress : makeAddress(tunnel.localAddress.host, tunnel.localAddress.port),
171
- tunnelLocalPort: typeof tunnel.localAddress !== 'string' ? tunnel.localAddress.port : undefined,
172
- public: tunnel.public,
173
- privacy: tunnel.privacy,
174
- protocol: tunnel.protocol ?? TunnelProtocol.Http,
175
- dispose: async (silent) => {
176
- this.logService.trace(`ForwardedPorts: (MainThreadTunnelService) Closing tunnel from tunnel provider: ${tunnel?.remoteAddress.host}:${tunnel?.remoteAddress.port}`);
177
- return this._proxy.$closeTunnel({ host: tunnel.remoteAddress.host, port: tunnel.remoteAddress.port }, silent);
178
- }
179
- };
180
- });
181
- }
182
- };
183
- if (features) {
184
- this.tunnelService.setTunnelFeatures(features);
185
- }
186
- this.tunnelService.setTunnelProvider(tunnelProvider);
187
- this.contextKeyService.createKey(forwardedPortsViewEnabled.key, true);
188
- }
189
- async $setCandidateFilter() {
190
- this.remoteExplorerService.setCandidateFilter((candidates) => {
191
- return this._proxy.$applyCandidateFilter(candidates);
192
- });
193
- }
194
- async $setCandidatePortSource(source) {
195
- this.remoteAgentService.getEnvironment().then(() => {
196
- switch (source) {
197
- case CandidatePortSource.None: {
198
- ( Registry.as(Extensions.Configuration))
199
- .registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPorts': false } }]);
200
- break;
201
- }
202
- case CandidatePortSource.Output: {
203
- ( Registry.as(Extensions.Configuration))
204
- .registerDefaultConfigurations([{ overrides: { 'remote.autoForwardPortsSource': PORT_AUTO_SOURCE_SETTING_OUTPUT } }]);
205
- break;
206
- }
207
- }
208
- }).catch(() => {
209
- });
210
- }
211
- };
212
- MainThreadTunnelService = __decorate([
213
- extHostNamedCustomer(MainContext.MainThreadTunnelService),
214
- ( __param(1, IRemoteExplorerService)),
215
- ( __param(2, ITunnelService)),
216
- ( __param(3, INotificationService)),
217
- ( __param(4, IConfigurationService)),
218
- ( __param(5, ILogService)),
219
- ( __param(6, IRemoteAgentService)),
220
- ( __param(7, IContextKeyService))
221
- ], MainThreadTunnelService);
222
-
223
- export { MainThreadTunnelService };