@codingame/monaco-vscode-view-common-service-override 4.5.0-improve-code-splitting.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 (114) hide show
  1. package/assets/fake.html +10 -0
  2. package/assets/index-no-csp.html +1230 -0
  3. package/assets/index.html +1231 -0
  4. package/assets/service-worker.js +457 -0
  5. package/index.d.ts +1 -0
  6. package/index.js +1 -0
  7. package/override/vs/workbench/browser/parts/editor/textEditor.js +5 -0
  8. package/override/vs/workbench/browser/parts/editor/textEditor.weak.js +11 -0
  9. package/package.json +32 -0
  10. package/tools/editorAssets.js +4 -0
  11. package/tools/url.js +10 -0
  12. package/viewCommon.d.ts +5 -0
  13. package/viewCommon.js +105 -0
  14. package/vscode/src/vs/base/browser/deviceAccess.js +61 -0
  15. package/vscode/src/vs/base/browser/ui/centered/centeredViewLayout.js +180 -0
  16. package/vscode/src/vs/base/browser/ui/grid/grid.js +494 -0
  17. package/vscode/src/vs/base/browser/ui/grid/gridview.css.js +6 -0
  18. package/vscode/src/vs/base/browser/ui/grid/gridview.js +1113 -0
  19. package/vscode/src/vs/platform/languagePacks/common/localizedStrings.js +12 -0
  20. package/vscode/src/vs/platform/webview/common/mimeTypes.js +24 -0
  21. package/vscode/src/vs/platform/webview/common/webviewPortMapping.js +64 -0
  22. package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +907 -0
  23. package/vscode/src/vs/workbench/browser/actions/listCommands.js +764 -0
  24. package/vscode/src/vs/workbench/browser/actions/navigationActions.js +301 -0
  25. package/vscode/src/vs/workbench/browser/media/style.css.js +6 -0
  26. package/vscode/src/vs/workbench/browser/parts/activitybar/activitybarPart.js +671 -0
  27. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activityaction.css.js +6 -0
  28. package/vscode/src/vs/workbench/browser/parts/activitybar/media/activitybarpart.css.js +6 -0
  29. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/auxiliaryBarPart.js +229 -0
  30. package/vscode/src/vs/workbench/browser/parts/auxiliarybar/media/auxiliaryBarPart.css.js +6 -0
  31. package/vscode/src/vs/workbench/browser/parts/compositeBar.js +606 -0
  32. package/vscode/src/vs/workbench/browser/parts/compositePart.js +346 -0
  33. package/vscode/src/vs/workbench/browser/parts/editor/auxiliaryEditorPart.js +246 -0
  34. package/vscode/src/vs/workbench/browser/parts/editor/editor.contribution.js +1403 -0
  35. package/vscode/src/vs/workbench/browser/parts/editor/editorConfiguration.js +188 -0
  36. package/vscode/src/vs/workbench/browser/parts/editor/editorDropTarget.js +523 -0
  37. package/vscode/src/vs/workbench/browser/parts/editor/editorPart.js +1030 -0
  38. package/vscode/src/vs/workbench/browser/parts/editor/editorParts.js +391 -0
  39. package/vscode/src/vs/workbench/browser/parts/editor/media/editordroptarget.css.js +6 -0
  40. package/vscode/src/vs/workbench/browser/parts/media/compositepart.css.js +6 -0
  41. package/vscode/src/vs/workbench/browser/parts/media/paneCompositePart.css.js +6 -0
  42. package/vscode/src/vs/workbench/browser/parts/paneCompositeBar.js +643 -0
  43. package/vscode/src/vs/workbench/browser/parts/paneCompositePart.js +472 -0
  44. package/vscode/src/vs/workbench/browser/parts/paneCompositePartService.js +68 -0
  45. package/vscode/src/vs/workbench/browser/parts/panel/panelPart.js +160 -0
  46. package/vscode/src/vs/workbench/browser/parts/sidebar/media/sidebarpart.css.js +6 -0
  47. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarActions.js +39 -0
  48. package/vscode/src/vs/workbench/browser/parts/sidebar/sidebarPart.js +238 -0
  49. package/vscode/src/vs/workbench/browser/style.js +54 -0
  50. package/vscode/src/vs/workbench/browser/window.js +381 -0
  51. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution.js +300 -0
  52. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyPeek.js +367 -0
  53. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/callHierarchyTree.js +135 -0
  54. package/vscode/src/vs/workbench/contrib/callHierarchy/browser/media/callHierarchy.css.js +6 -0
  55. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditor.contribution.js +18 -0
  56. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditorInputFactory.js +146 -0
  57. package/vscode/src/vs/workbench/contrib/customEditor/browser/customEditors.js +215 -0
  58. package/vscode/src/vs/workbench/contrib/customEditor/browser/media/customEditor.css.js +6 -0
  59. package/vscode/src/vs/workbench/contrib/customEditor/common/contributedCustomEditors.js +78 -0
  60. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditor.js +56 -0
  61. package/vscode/src/vs/workbench/contrib/customEditor/common/customEditorModelManager.js +63 -0
  62. package/vscode/src/vs/workbench/contrib/customEditor/common/extensionPoint.js +183 -0
  63. package/vscode/src/vs/workbench/contrib/externalUriOpener/common/externalUriOpener.contribution.js +8 -0
  64. package/vscode/src/vs/workbench/contrib/languageStatus/browser/languageStatus.contribution.js +408 -0
  65. package/vscode/src/vs/workbench/contrib/languageStatus/browser/media/languageStatus.css.js +6 -0
  66. package/vscode/src/vs/workbench/contrib/limitIndicator/browser/limitIndicator.contribution.js +147 -0
  67. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/commands.js +635 -0
  68. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/commands/devCommands.js +230 -0
  69. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditor.contribution.js +75 -0
  70. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/mergeEditorSerializer.js +42 -0
  71. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/colors.js +81 -0
  72. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/conflictActions.js +350 -0
  73. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editorGutter.js +100 -0
  74. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/baseCodeEditorView.js +148 -0
  75. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/codeEditorView.js +106 -0
  76. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/inputCodeEditorView.js +403 -0
  77. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/editors/resultCodeEditorView.js +199 -0
  78. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/fixedZoneWidget.js +41 -0
  79. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/lineAlignment.js +128 -0
  80. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/media/mergeEditor.css.js +6 -0
  81. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/mergeEditor.js +619 -0
  82. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/scrollSynchronizer.js +161 -0
  83. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewModel.js +266 -0
  84. package/vscode/src/vs/workbench/contrib/mergeEditor/browser/view/viewZones.js +173 -0
  85. package/vscode/src/vs/workbench/contrib/preferences/browser/keyboardLayoutPicker.js +195 -0
  86. package/vscode/src/vs/workbench/contrib/sash/browser/sash.contribution.js +38 -0
  87. package/vscode/src/vs/workbench/contrib/sash/browser/sash.js +41 -0
  88. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/media/typeHierarchy.css.js +6 -0
  89. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchy.contribution.js +283 -0
  90. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyPeek.js +362 -0
  91. package/vscode/src/vs/workbench/contrib/typeHierarchy/browser/typeHierarchyTree.js +133 -0
  92. package/vscode/src/vs/workbench/contrib/webview/browser/overlayWebview.js +314 -0
  93. package/vscode/src/vs/workbench/contrib/webview/browser/resourceLoading.js +96 -0
  94. package/vscode/src/vs/workbench/contrib/webview/browser/themeing.js +98 -0
  95. package/vscode/src/vs/workbench/contrib/webview/browser/webviewElement.js +656 -0
  96. package/vscode/src/vs/workbench/contrib/webview/browser/webviewFindWidget.js +65 -0
  97. package/vscode/src/vs/workbench/contrib/webview/browser/webviewService.js +59 -0
  98. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewCommands.js +143 -0
  99. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewEditorInputSerializer.js +121 -0
  100. package/vscode/src/vs/workbench/contrib/webviewPanel/browser/webviewPanel.contribution.js +67 -0
  101. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewPane.js +234 -0
  102. package/vscode/src/vs/workbench/contrib/webviewView/browser/webviewViewService.js +45 -0
  103. package/vscode/src/vs/workbench/services/activity/browser/activityService.js +145 -0
  104. package/vscode/src/vs/workbench/services/auxiliaryWindow/browser/auxiliaryWindowService.js +341 -0
  105. package/vscode/src/vs/workbench/services/driver/browser/driver.js +186 -0
  106. package/vscode/src/vs/workbench/services/editor/browser/editorPaneService.js +13 -0
  107. package/vscode/src/vs/workbench/services/editor/browser/editorResolverService.js +676 -0
  108. package/vscode/src/vs/workbench/services/history/browser/historyService.js +1516 -0
  109. package/vscode/src/vs/workbench/services/progress/browser/media/progressService.css.js +6 -0
  110. package/vscode/src/vs/workbench/services/progress/browser/progressService.js +527 -0
  111. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorHandler.js +102 -0
  112. package/vscode/src/vs/workbench/services/untitled/common/untitledTextEditorService.js +133 -0
  113. package/vscode/src/vs/workbench/services/views/browser/viewDescriptorService.js +711 -0
  114. package/vscode/src/vs/workbench/services/views/common/viewContainerModel.js +603 -0
@@ -0,0 +1,381 @@
1
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
+ import { setFullscreen, isSafari } from 'vscode/vscode/vs/base/browser/browser';
3
+ import { getWindowsCount, getWindows, getWindow, getActiveWindow, getWindowById, addDisposableListener, EventType, EventHelper, windowOpenWithSuccess, windowOpenPopup, windowOpenNoOpener } from 'vscode/vscode/vs/base/browser/dom';
4
+ import { DomEmitter } from 'vscode/vscode/vs/base/browser/event';
5
+ import { requestUsbDevice, requestSerialPort, requestHidDevice } from '../../base/browser/deviceAccess.js';
6
+ import { timeout } from 'vscode/vscode/vs/base/common/async';
7
+ import { Event } from 'vscode/vscode/vs/base/common/event';
8
+ import { Disposable, dispose, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
9
+ import { matchesScheme, Schemas } from 'vscode/vscode/vs/base/common/network';
10
+ import { isMacintosh, isIOS } from 'vscode/vscode/vs/base/common/platform';
11
+ import Severity$1 from 'vscode/vscode/vs/base/common/severity';
12
+ import { URI } from 'vscode/vscode/vs/base/common/uri';
13
+ import { localizeWithPath } from 'vscode/vscode/vs/nls';
14
+ import { CommandsRegistry } from 'vscode/vscode/vs/platform/commands/common/commands';
15
+ import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
16
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
17
+ import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
18
+ import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
19
+ import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
20
+ import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService.service';
21
+ import { IWorkbenchLayoutService } from 'vscode/vscode/vs/workbench/services/layout/browser/layoutService.service';
22
+ import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
23
+ import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
24
+ import { registerWindowDriver } from '../services/driver/browser/driver.js';
25
+ import { isAuxiliaryWindow, mainWindow } from 'vscode/vscode/vs/base/browser/window';
26
+ import { createSingleCallFunction } from 'vscode/vscode/vs/base/common/functional';
27
+ import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
28
+ import { IWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/common/environmentService.service';
29
+
30
+ var BaseWindow_1;
31
+ let BaseWindow = class BaseWindow extends Disposable {
32
+ static { BaseWindow_1 = this; }
33
+ static { this.TIMEOUT_HANDLES = Number.MIN_SAFE_INTEGER; }
34
+ static { this.TIMEOUT_DISPOSABLES = ( new Map()); }
35
+ constructor(targetWindow, dom = { getWindowsCount, getWindows }, hostService, environmentService) {
36
+ super();
37
+ this.hostService = hostService;
38
+ this.environmentService = environmentService;
39
+ this.enableWindowFocusOnElementFocus(targetWindow);
40
+ this.enableMultiWindowAwareTimeout(targetWindow, dom);
41
+ this.registerFullScreenListeners(targetWindow.vscodeWindowId);
42
+ }
43
+ enableWindowFocusOnElementFocus(targetWindow) {
44
+ const originalFocus = targetWindow.HTMLElement.prototype.focus;
45
+ const that = this;
46
+ targetWindow.HTMLElement.prototype.focus = function (options) {
47
+ that.onElementFocus(getWindow(this));
48
+ originalFocus.apply(this, [options]);
49
+ };
50
+ }
51
+ onElementFocus(targetWindow) {
52
+ const activeWindow = getActiveWindow();
53
+ if (activeWindow !== targetWindow && activeWindow.document.hasFocus()) {
54
+ targetWindow.focus();
55
+ if (!this.environmentService.extensionTestsLocationURI &&
56
+ !targetWindow.document.hasFocus()) {
57
+ this.hostService.focus(targetWindow);
58
+ }
59
+ }
60
+ }
61
+ enableMultiWindowAwareTimeout(targetWindow, dom = { getWindowsCount, getWindows }) {
62
+ const originalSetTimeout = targetWindow.setTimeout;
63
+ Object.defineProperty(targetWindow, 'vscodeOriginalSetTimeout', { get: () => originalSetTimeout });
64
+ const originalClearTimeout = targetWindow.clearTimeout;
65
+ Object.defineProperty(targetWindow, 'vscodeOriginalClearTimeout', { get: () => originalClearTimeout });
66
+ targetWindow.setTimeout = function (handler, timeout = 0, ...args) {
67
+ if (dom.getWindowsCount() === 1 || typeof handler === 'string' || timeout === 0 ) {
68
+ return originalSetTimeout.apply(this, [handler, timeout, ...args]);
69
+ }
70
+ const timeoutDisposables = ( new Set());
71
+ const timeoutHandle = BaseWindow_1.TIMEOUT_HANDLES++;
72
+ BaseWindow_1.TIMEOUT_DISPOSABLES.set(timeoutHandle, timeoutDisposables);
73
+ const handlerFn = createSingleCallFunction(handler, () => {
74
+ dispose(timeoutDisposables);
75
+ BaseWindow_1.TIMEOUT_DISPOSABLES.delete(timeoutHandle);
76
+ });
77
+ for (const { window, disposables } of dom.getWindows()) {
78
+ if (isAuxiliaryWindow(window) && window.document.visibilityState === 'hidden') {
79
+ continue;
80
+ }
81
+ const handle = window.vscodeOriginalSetTimeout.apply(this, [handlerFn, timeout, ...args]);
82
+ const timeoutDisposable = toDisposable(() => {
83
+ window.vscodeOriginalClearTimeout(handle);
84
+ timeoutDisposables.delete(timeoutDisposable);
85
+ });
86
+ disposables.add(timeoutDisposable);
87
+ timeoutDisposables.add(timeoutDisposable);
88
+ }
89
+ return timeoutHandle;
90
+ };
91
+ targetWindow.clearTimeout = function (timeoutHandle) {
92
+ const timeoutDisposables = typeof timeoutHandle === 'number' ? BaseWindow_1.TIMEOUT_DISPOSABLES.get(timeoutHandle) : undefined;
93
+ if (timeoutDisposables) {
94
+ dispose(timeoutDisposables);
95
+ BaseWindow_1.TIMEOUT_DISPOSABLES.delete(timeoutHandle);
96
+ }
97
+ else {
98
+ originalClearTimeout.apply(this, [timeoutHandle]);
99
+ }
100
+ };
101
+ }
102
+ registerFullScreenListeners(targetWindowId) {
103
+ this._register(this.hostService.onDidChangeFullScreen(({ windowId, fullscreen }) => {
104
+ if (windowId === targetWindowId) {
105
+ const targetWindow = getWindowById(targetWindowId);
106
+ if (targetWindow) {
107
+ setFullscreen(fullscreen, targetWindow.window);
108
+ }
109
+ }
110
+ }));
111
+ }
112
+ static async confirmOnShutdown(accessor, reason) {
113
+ const dialogService = accessor.get(IDialogService);
114
+ const configurationService = accessor.get(IConfigurationService);
115
+ const message = reason === 2 ?
116
+ (isMacintosh ? ( localizeWithPath(
117
+ 'vs/workbench/browser/window',
118
+ 'quitMessageMac',
119
+ "Are you sure you want to quit?"
120
+ )) : ( localizeWithPath(
121
+ 'vs/workbench/browser/window',
122
+ 'quitMessage',
123
+ "Are you sure you want to exit?"
124
+ ))) :
125
+ ( localizeWithPath(
126
+ 'vs/workbench/browser/window',
127
+ 'closeWindowMessage',
128
+ "Are you sure you want to close the window?"
129
+ ));
130
+ const primaryButton = reason === 2 ?
131
+ (isMacintosh ? ( localizeWithPath(
132
+ 'vs/workbench/browser/window',
133
+ { key: 'quitButtonLabel', comment: ['&& denotes a mnemonic'] },
134
+ "&&Quit"
135
+ )) : ( localizeWithPath(
136
+ 'vs/workbench/browser/window',
137
+ { key: 'exitButtonLabel', comment: ['&& denotes a mnemonic'] },
138
+ "&&Exit"
139
+ ))) :
140
+ ( localizeWithPath(
141
+ 'vs/workbench/browser/window',
142
+ { key: 'closeWindowButtonLabel', comment: ['&& denotes a mnemonic'] },
143
+ "&&Close Window"
144
+ ));
145
+ const res = await dialogService.confirm({
146
+ message,
147
+ primaryButton,
148
+ checkbox: {
149
+ label: ( localizeWithPath('vs/workbench/browser/window', 'doNotAskAgain', "Do not ask me again"))
150
+ }
151
+ });
152
+ if (res.confirmed && res.checkboxChecked) {
153
+ await configurationService.updateValue('window.confirmBeforeClose', 'never');
154
+ }
155
+ return res.confirmed;
156
+ }
157
+ };
158
+ BaseWindow = BaseWindow_1 = ( __decorate([
159
+ ( __param(2, IHostService)),
160
+ ( __param(3, IWorkbenchEnvironmentService))
161
+ ], BaseWindow));
162
+ let BrowserWindow = class BrowserWindow extends BaseWindow {
163
+ constructor(openerService, lifecycleService, dialogService, labelService, productService, browserEnvironmentService, layoutService, instantiationService, hostService) {
164
+ super(mainWindow, undefined, hostService, browserEnvironmentService);
165
+ this.openerService = openerService;
166
+ this.lifecycleService = lifecycleService;
167
+ this.dialogService = dialogService;
168
+ this.labelService = labelService;
169
+ this.productService = productService;
170
+ this.browserEnvironmentService = browserEnvironmentService;
171
+ this.layoutService = layoutService;
172
+ this.instantiationService = instantiationService;
173
+ this.registerListeners();
174
+ this.create();
175
+ }
176
+ registerListeners() {
177
+ this._register(this.lifecycleService.onWillShutdown(() => this.onWillShutdown()));
178
+ const viewport = isIOS && mainWindow.visualViewport ? mainWindow.visualViewport : mainWindow ;
179
+ this._register(addDisposableListener(viewport, EventType.RESIZE, () => {
180
+ this.layoutService.layout();
181
+ if (isIOS) {
182
+ mainWindow.scrollTo(0, 0);
183
+ }
184
+ }));
185
+ this._register(addDisposableListener(this.layoutService.mainContainer, EventType.WHEEL, e => e.preventDefault(), { passive: false }));
186
+ this._register(addDisposableListener(this.layoutService.mainContainer, EventType.CONTEXT_MENU, e => EventHelper.stop(e, true)));
187
+ this._register(addDisposableListener(this.layoutService.mainContainer, EventType.DROP, e => EventHelper.stop(e, true)));
188
+ }
189
+ onWillShutdown() {
190
+ Event.toPromise(Event.any(Event.once(( new DomEmitter(mainWindow.document.body, EventType.KEY_DOWN, true)).event), Event.once(( new DomEmitter(mainWindow.document.body, EventType.MOUSE_DOWN, true)).event))).then(async () => {
191
+ await timeout(3000);
192
+ await this.dialogService.prompt({
193
+ type: Severity$1.Error,
194
+ message: ( localizeWithPath(
195
+ 'vs/workbench/browser/window',
196
+ 'shutdownError',
197
+ "An unexpected error occurred that requires a reload of this page."
198
+ )),
199
+ detail: ( localizeWithPath(
200
+ 'vs/workbench/browser/window',
201
+ 'shutdownErrorDetail',
202
+ "The workbench was unexpectedly disposed while running."
203
+ )),
204
+ buttons: [
205
+ {
206
+ label: ( localizeWithPath(
207
+ 'vs/workbench/browser/window',
208
+ { key: 'reload', comment: ['&& denotes a mnemonic'] },
209
+ "&&Reload"
210
+ )),
211
+ run: () => mainWindow.location.reload()
212
+ }
213
+ ]
214
+ });
215
+ });
216
+ }
217
+ create() {
218
+ this.setupOpenHandlers();
219
+ this.registerLabelFormatters();
220
+ this.registerCommands();
221
+ this.setupDriver();
222
+ }
223
+ setupDriver() {
224
+ if (this.environmentService.enableSmokeTestDriver) {
225
+ registerWindowDriver(this.instantiationService);
226
+ }
227
+ }
228
+ setupOpenHandlers() {
229
+ this.openerService.setDefaultExternalOpener({
230
+ openExternal: async (href) => {
231
+ let isAllowedOpener = false;
232
+ if (this.browserEnvironmentService.options?.openerAllowedExternalUrlPrefixes) {
233
+ for (const trustedPopupPrefix of this.browserEnvironmentService.options.openerAllowedExternalUrlPrefixes) {
234
+ if (href.startsWith(trustedPopupPrefix)) {
235
+ isAllowedOpener = true;
236
+ break;
237
+ }
238
+ }
239
+ }
240
+ if (matchesScheme(href, Schemas.http) || matchesScheme(href, Schemas.https)) {
241
+ if (isSafari) {
242
+ const opened = windowOpenWithSuccess(href, !isAllowedOpener);
243
+ if (!opened) {
244
+ await this.dialogService.prompt({
245
+ type: Severity$1.Warning,
246
+ message: ( localizeWithPath(
247
+ 'vs/workbench/browser/window',
248
+ 'unableToOpenExternal',
249
+ "The browser interrupted the opening of a new tab or window. Press 'Open' to open it anyway."
250
+ )),
251
+ detail: href,
252
+ buttons: [
253
+ {
254
+ label: ( localizeWithPath(
255
+ 'vs/workbench/browser/window',
256
+ { key: 'open', comment: ['&& denotes a mnemonic'] },
257
+ "&&Open"
258
+ )),
259
+ run: () => isAllowedOpener ? windowOpenPopup(href) : windowOpenNoOpener(href)
260
+ },
261
+ {
262
+ label: ( localizeWithPath(
263
+ 'vs/workbench/browser/window',
264
+ { key: 'learnMore', comment: ['&& denotes a mnemonic'] },
265
+ "&&Learn More"
266
+ )),
267
+ run: () => this.openerService.open(( URI.parse('https://aka.ms/allow-vscode-popup')))
268
+ }
269
+ ],
270
+ cancelButton: true
271
+ });
272
+ }
273
+ }
274
+ else {
275
+ isAllowedOpener
276
+ ? windowOpenPopup(href)
277
+ : windowOpenNoOpener(href);
278
+ }
279
+ }
280
+ else {
281
+ const invokeProtocolHandler = () => {
282
+ this.lifecycleService.withExpectedShutdown({ disableShutdownHandling: true }, () => mainWindow.location.href = href);
283
+ };
284
+ invokeProtocolHandler();
285
+ const showProtocolUrlOpenedDialog = async () => {
286
+ const { downloadUrl } = this.productService;
287
+ let detail;
288
+ const buttons = [
289
+ {
290
+ label: ( localizeWithPath(
291
+ 'vs/workbench/browser/window',
292
+ { key: 'openExternalDialogButtonRetry.v2', comment: ['&& denotes a mnemonic'] },
293
+ "&&Try Again"
294
+ )),
295
+ run: () => invokeProtocolHandler()
296
+ }
297
+ ];
298
+ if (downloadUrl !== undefined) {
299
+ detail = ( localizeWithPath(
300
+ 'vs/workbench/browser/window',
301
+ 'openExternalDialogDetail.v2',
302
+ "We launched {0} on your computer.\n\nIf {1} did not launch, try again or install it below.",
303
+ this.productService.nameLong,
304
+ this.productService.nameLong
305
+ ));
306
+ buttons.push({
307
+ label: ( localizeWithPath(
308
+ 'vs/workbench/browser/window',
309
+ { key: 'openExternalDialogButtonInstall.v3', comment: ['&& denotes a mnemonic'] },
310
+ "&&Install"
311
+ )),
312
+ run: async () => {
313
+ await this.openerService.open(( URI.parse(downloadUrl)));
314
+ showProtocolUrlOpenedDialog();
315
+ }
316
+ });
317
+ }
318
+ else {
319
+ detail = ( localizeWithPath(
320
+ 'vs/workbench/browser/window',
321
+ 'openExternalDialogDetailNoInstall',
322
+ "We launched {0} on your computer.\n\nIf {1} did not launch, try again below.",
323
+ this.productService.nameLong,
324
+ this.productService.nameLong
325
+ ));
326
+ }
327
+ await this.hostService.withExpectedShutdown(() => this.dialogService.prompt({
328
+ type: Severity$1.Info,
329
+ message: ( localizeWithPath(
330
+ 'vs/workbench/browser/window',
331
+ 'openExternalDialogTitle',
332
+ "All done. You can close this tab now."
333
+ )),
334
+ detail,
335
+ buttons,
336
+ cancelButton: true
337
+ }));
338
+ };
339
+ if (matchesScheme(href, this.productService.urlProtocol)) {
340
+ await showProtocolUrlOpenedDialog();
341
+ }
342
+ }
343
+ return true;
344
+ }
345
+ });
346
+ }
347
+ registerLabelFormatters() {
348
+ this._register(this.labelService.registerFormatter({
349
+ scheme: Schemas.vscodeUserData,
350
+ priority: true,
351
+ formatting: {
352
+ label: '(Settings) ${path}',
353
+ separator: '/',
354
+ }
355
+ }));
356
+ }
357
+ registerCommands() {
358
+ CommandsRegistry.registerCommand('workbench.experimental.requestUsbDevice', async (_accessor, options) => {
359
+ return requestUsbDevice(options);
360
+ });
361
+ CommandsRegistry.registerCommand('workbench.experimental.requestSerialPort', async (_accessor, options) => {
362
+ return requestSerialPort(options);
363
+ });
364
+ CommandsRegistry.registerCommand('workbench.experimental.requestHidDevice', async (_accessor, options) => {
365
+ return requestHidDevice(options);
366
+ });
367
+ }
368
+ };
369
+ BrowserWindow = ( __decorate([
370
+ ( __param(0, IOpenerService)),
371
+ ( __param(1, ILifecycleService)),
372
+ ( __param(2, IDialogService)),
373
+ ( __param(3, ILabelService)),
374
+ ( __param(4, IProductService)),
375
+ ( __param(5, IBrowserWorkbenchEnvironmentService)),
376
+ ( __param(6, IWorkbenchLayoutService)),
377
+ ( __param(7, IInstantiationService)),
378
+ ( __param(8, IHostService))
379
+ ], BrowserWindow));
380
+
381
+ export { BaseWindow, BrowserWindow };
@@ -0,0 +1,300 @@
1
+ import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
+ import { localizeWithPath, localize2WithPath } from 'vscode/vscode/vs/nls';
3
+ import { CallHierarchyProviderRegistry, CallHierarchyModel } from 'vscode/vscode/vs/workbench/contrib/callHierarchy/common/callHierarchy';
4
+ import { CancellationTokenSource } from 'vscode/vscode/vs/base/common/cancellation';
5
+ import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
6
+ import { CallHierarchyTreePeekWidget } from './callHierarchyPeek.js';
7
+ import { Event } from 'vscode/vscode/vs/base/common/event';
8
+ import { registerEditorContribution, EditorAction2 } from 'vscode/vscode/vs/editor/browser/editorExtensions';
9
+ import { RawContextKey, ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
10
+ import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
11
+ import { DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
12
+ import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
13
+ import { PeekContext } from 'vscode/vscode/vs/editor/contrib/peekView/browser/peekView';
14
+ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
15
+ import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
16
+ import { Range } from 'vscode/vscode/vs/editor/common/core/range';
17
+ import { registerAction2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
18
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
19
+ import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
20
+ import { isCancellationError } from 'vscode/vscode/vs/base/common/errors';
21
+
22
+ var CallHierarchyController_1;
23
+ const _ctxHasCallHierarchyProvider = ( new RawContextKey('editorHasCallHierarchyProvider', false, ( localizeWithPath(
24
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
25
+ 'editorHasCallHierarchyProvider',
26
+ 'Whether a call hierarchy provider is available'
27
+ ))));
28
+ const _ctxCallHierarchyVisible = ( new RawContextKey('callHierarchyVisible', false, ( localizeWithPath(
29
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
30
+ 'callHierarchyVisible',
31
+ 'Whether call hierarchy peek is currently showing'
32
+ ))));
33
+ const _ctxCallHierarchyDirection = ( new RawContextKey(
34
+ 'callHierarchyDirection',
35
+ undefined,
36
+ { type: 'string', description: ( localizeWithPath(
37
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
38
+ 'callHierarchyDirection',
39
+ 'Whether call hierarchy shows incoming or outgoing calls'
40
+ )) }
41
+ ));
42
+ function sanitizedDirection(candidate) {
43
+ return candidate === "outgoingCalls" || candidate === "incomingCalls"
44
+ ? candidate
45
+ : "incomingCalls" ;
46
+ }
47
+ let CallHierarchyController = class CallHierarchyController {
48
+ static { CallHierarchyController_1 = this; }
49
+ static { this.Id = 'callHierarchy'; }
50
+ static get(editor) {
51
+ return editor.getContribution(CallHierarchyController_1.Id);
52
+ }
53
+ static { this._StorageDirection = 'callHierarchy/defaultDirection'; }
54
+ constructor(_editor, _contextKeyService, _storageService, _editorService, _instantiationService) {
55
+ this._editor = _editor;
56
+ this._contextKeyService = _contextKeyService;
57
+ this._storageService = _storageService;
58
+ this._editorService = _editorService;
59
+ this._instantiationService = _instantiationService;
60
+ this._dispoables = ( new DisposableStore());
61
+ this._sessionDisposables = ( new DisposableStore());
62
+ this._ctxIsVisible = _ctxCallHierarchyVisible.bindTo(this._contextKeyService);
63
+ this._ctxHasProvider = _ctxHasCallHierarchyProvider.bindTo(this._contextKeyService);
64
+ this._ctxDirection = _ctxCallHierarchyDirection.bindTo(this._contextKeyService);
65
+ this._dispoables.add(Event.any(_editor.onDidChangeModel, _editor.onDidChangeModelLanguage, CallHierarchyProviderRegistry.onDidChange)(() => {
66
+ this._ctxHasProvider.set(_editor.hasModel() && ( CallHierarchyProviderRegistry.has(_editor.getModel())));
67
+ }));
68
+ this._dispoables.add(this._sessionDisposables);
69
+ }
70
+ dispose() {
71
+ this._ctxHasProvider.reset();
72
+ this._ctxIsVisible.reset();
73
+ this._dispoables.dispose();
74
+ }
75
+ async startCallHierarchyFromEditor() {
76
+ this._sessionDisposables.clear();
77
+ if (!this._editor.hasModel()) {
78
+ return;
79
+ }
80
+ const document = this._editor.getModel();
81
+ const position = this._editor.getPosition();
82
+ if (!( CallHierarchyProviderRegistry.has(document))) {
83
+ return;
84
+ }
85
+ const cts = ( new CancellationTokenSource());
86
+ const model = CallHierarchyModel.create(document, position, cts.token);
87
+ const direction = sanitizedDirection(this._storageService.get(CallHierarchyController_1._StorageDirection, 0 , "incomingCalls" ));
88
+ this._showCallHierarchyWidget(position, direction, model, cts);
89
+ }
90
+ async startCallHierarchyFromCallHierarchy() {
91
+ if (!this._widget) {
92
+ return;
93
+ }
94
+ const model = this._widget.getModel();
95
+ const call = this._widget.getFocused();
96
+ if (!call || !model) {
97
+ return;
98
+ }
99
+ const newEditor = await this._editorService.openCodeEditor({ resource: call.item.uri }, this._editor);
100
+ if (!newEditor) {
101
+ return;
102
+ }
103
+ const newModel = model.fork(call.item);
104
+ this._sessionDisposables.clear();
105
+ CallHierarchyController_1.get(newEditor)?._showCallHierarchyWidget(Range.lift(newModel.root.selectionRange).getStartPosition(), this._widget.direction, Promise.resolve(newModel), ( new CancellationTokenSource()));
106
+ }
107
+ _showCallHierarchyWidget(position, direction, model, cts) {
108
+ this._ctxIsVisible.set(true);
109
+ this._ctxDirection.set(direction);
110
+ Event.any(this._editor.onDidChangeModel, this._editor.onDidChangeModelLanguage)(this.endCallHierarchy, this, this._sessionDisposables);
111
+ this._widget = this._instantiationService.createInstance(CallHierarchyTreePeekWidget, this._editor, position, direction);
112
+ this._widget.showLoading();
113
+ this._sessionDisposables.add(this._widget.onDidClose(() => {
114
+ this.endCallHierarchy();
115
+ this._storageService.store(CallHierarchyController_1._StorageDirection, this._widget.direction, 0 , 0 );
116
+ }));
117
+ this._sessionDisposables.add({ dispose() { cts.dispose(true); } });
118
+ this._sessionDisposables.add(this._widget);
119
+ model.then(model => {
120
+ if (cts.token.isCancellationRequested) {
121
+ return;
122
+ }
123
+ if (model) {
124
+ this._sessionDisposables.add(model);
125
+ this._widget.showModel(model);
126
+ }
127
+ else {
128
+ this._widget.showMessage(( localizeWithPath(
129
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
130
+ 'no.item',
131
+ "No results"
132
+ )));
133
+ }
134
+ }).catch(err => {
135
+ if (isCancellationError(err)) {
136
+ this.endCallHierarchy();
137
+ return;
138
+ }
139
+ this._widget.showMessage(( localizeWithPath(
140
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
141
+ 'error',
142
+ "Failed to show call hierarchy"
143
+ )));
144
+ });
145
+ }
146
+ showOutgoingCalls() {
147
+ this._widget?.updateDirection("outgoingCalls" );
148
+ this._ctxDirection.set("outgoingCalls" );
149
+ }
150
+ showIncomingCalls() {
151
+ this._widget?.updateDirection("incomingCalls" );
152
+ this._ctxDirection.set("incomingCalls" );
153
+ }
154
+ endCallHierarchy() {
155
+ this._sessionDisposables.clear();
156
+ this._ctxIsVisible.set(false);
157
+ this._editor.focus();
158
+ }
159
+ };
160
+ CallHierarchyController = CallHierarchyController_1 = ( __decorate([
161
+ ( __param(1, IContextKeyService)),
162
+ ( __param(2, IStorageService)),
163
+ ( __param(3, ICodeEditorService)),
164
+ ( __param(4, IInstantiationService))
165
+ ], CallHierarchyController));
166
+ registerEditorContribution(CallHierarchyController.Id, CallHierarchyController, 0 );
167
+ registerAction2(class PeekCallHierarchyAction extends EditorAction2 {
168
+ constructor() {
169
+ super({
170
+ id: 'editor.showCallHierarchy',
171
+ title: ( localize2WithPath(
172
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
173
+ 'title',
174
+ 'Peek Call Hierarchy'
175
+ )),
176
+ menu: {
177
+ id: MenuId.EditorContextPeek,
178
+ group: 'navigation',
179
+ order: 1000,
180
+ when: ( ContextKeyExpr.and(_ctxHasCallHierarchyProvider, PeekContext.notInPeekEditor, ( EditorContextKeys.isInEmbeddedEditor.toNegated()))),
181
+ },
182
+ keybinding: {
183
+ when: EditorContextKeys.editorTextFocus,
184
+ weight: 200 ,
185
+ primary: 1024 + 512 + 38
186
+ },
187
+ precondition: ( ContextKeyExpr.and(_ctxHasCallHierarchyProvider, PeekContext.notInPeekEditor)),
188
+ f1: true
189
+ });
190
+ }
191
+ async runEditorCommand(_accessor, editor) {
192
+ return CallHierarchyController.get(editor)?.startCallHierarchyFromEditor();
193
+ }
194
+ });
195
+ registerAction2(class extends EditorAction2 {
196
+ constructor() {
197
+ super({
198
+ id: 'editor.showIncomingCalls',
199
+ title: ( localize2WithPath(
200
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
201
+ 'title.incoming',
202
+ 'Show Incoming Calls'
203
+ )),
204
+ icon: registerIcon('callhierarchy-incoming', Codicon.callIncoming, ( localizeWithPath(
205
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
206
+ 'showIncomingCallsIcons',
207
+ 'Icon for incoming calls in the call hierarchy view.'
208
+ ))),
209
+ precondition: ( ContextKeyExpr.and(_ctxCallHierarchyVisible, ( _ctxCallHierarchyDirection.isEqualTo("outgoingCalls" )))),
210
+ keybinding: {
211
+ weight: 200 ,
212
+ primary: 1024 + 512 + 38 ,
213
+ },
214
+ menu: {
215
+ id: CallHierarchyTreePeekWidget.TitleMenu,
216
+ when: ( _ctxCallHierarchyDirection.isEqualTo("outgoingCalls" )),
217
+ order: 1,
218
+ }
219
+ });
220
+ }
221
+ runEditorCommand(_accessor, editor) {
222
+ return CallHierarchyController.get(editor)?.showIncomingCalls();
223
+ }
224
+ });
225
+ registerAction2(class extends EditorAction2 {
226
+ constructor() {
227
+ super({
228
+ id: 'editor.showOutgoingCalls',
229
+ title: ( localize2WithPath(
230
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
231
+ 'title.outgoing',
232
+ 'Show Outgoing Calls'
233
+ )),
234
+ icon: registerIcon('callhierarchy-outgoing', Codicon.callOutgoing, ( localizeWithPath(
235
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
236
+ 'showOutgoingCallsIcon',
237
+ 'Icon for outgoing calls in the call hierarchy view.'
238
+ ))),
239
+ precondition: ( ContextKeyExpr.and(_ctxCallHierarchyVisible, ( _ctxCallHierarchyDirection.isEqualTo("incomingCalls" )))),
240
+ keybinding: {
241
+ weight: 200 ,
242
+ primary: 1024 + 512 + 38 ,
243
+ },
244
+ menu: {
245
+ id: CallHierarchyTreePeekWidget.TitleMenu,
246
+ when: ( _ctxCallHierarchyDirection.isEqualTo("incomingCalls" )),
247
+ order: 1
248
+ }
249
+ });
250
+ }
251
+ runEditorCommand(_accessor, editor) {
252
+ return CallHierarchyController.get(editor)?.showOutgoingCalls();
253
+ }
254
+ });
255
+ registerAction2(class extends EditorAction2 {
256
+ constructor() {
257
+ super({
258
+ id: 'editor.refocusCallHierarchy',
259
+ title: ( localize2WithPath(
260
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
261
+ 'title.refocus',
262
+ 'Refocus Call Hierarchy'
263
+ )),
264
+ precondition: _ctxCallHierarchyVisible,
265
+ keybinding: {
266
+ weight: 200 ,
267
+ primary: 1024 + 3
268
+ }
269
+ });
270
+ }
271
+ async runEditorCommand(_accessor, editor) {
272
+ return CallHierarchyController.get(editor)?.startCallHierarchyFromCallHierarchy();
273
+ }
274
+ });
275
+ registerAction2(class extends EditorAction2 {
276
+ constructor() {
277
+ super({
278
+ id: 'editor.closeCallHierarchy',
279
+ title: ( localizeWithPath(
280
+ 'vs/workbench/contrib/callHierarchy/browser/callHierarchy.contribution',
281
+ 'close',
282
+ 'Close'
283
+ )),
284
+ icon: Codicon.close,
285
+ precondition: _ctxCallHierarchyVisible,
286
+ keybinding: {
287
+ weight: 200 + 10,
288
+ primary: 9 ,
289
+ when: ContextKeyExpr.not('config.editor.stablePeek')
290
+ },
291
+ menu: {
292
+ id: CallHierarchyTreePeekWidget.TitleMenu,
293
+ order: 1000
294
+ }
295
+ });
296
+ }
297
+ runEditorCommand(_accessor, editor) {
298
+ return CallHierarchyController.get(editor)?.endCallHierarchy();
299
+ }
300
+ });