@codingame/monaco-vscode-host-service-override 11.1.2 → 12.0.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.
- package/index.d.ts +2 -1
- package/index.js +15 -1
- package/package.json +22 -7
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.d.ts +63 -0
- package/vscode/src/vs/workbench/services/host/browser/browserHostService.js +62 -55
- package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.d.ts +12 -0
- package/vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js +2 -0
- package/host.js +0 -14
package/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { IEditorOverrideServices } from "vscode/vscode/vs/editor/standalone/browser/standaloneServices";
|
|
2
|
+
export default function getServiceOverride(): IEditorOverrideServices;
|
package/index.js
CHANGED
|
@@ -1 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
3
|
+
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
4
|
+
import { IHostColorSchemeService } from 'vscode/vscode/vs/workbench/services/themes/common/hostColorSchemeService.service';
|
|
5
|
+
import { BrowserHostService } from './vscode/src/vs/workbench/services/host/browser/browserHostService.js';
|
|
6
|
+
import { BrowserHostColorSchemeService } from './vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js';
|
|
7
|
+
|
|
8
|
+
function getServiceOverride() {
|
|
9
|
+
return {
|
|
10
|
+
[IHostService.toString()]: new SyncDescriptor(BrowserHostService, [], true),
|
|
11
|
+
[IHostColorSchemeService.toString()]: new SyncDescriptor(BrowserHostColorSchemeService, [], true)
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export { getServiceOverride as default };
|
package/package.json
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-host-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "12.0.1",
|
|
4
|
+
"private": false,
|
|
5
|
+
"description": "VSCode public API plugged on the monaco editor - host service-override",
|
|
4
6
|
"keywords": [],
|
|
5
7
|
"author": {
|
|
6
8
|
"name": "CodinGame",
|
|
@@ -12,8 +14,19 @@
|
|
|
12
14
|
"url": "git+ssh://git@github.com/CodinGame/monaco-vscode-api.git"
|
|
13
15
|
},
|
|
14
16
|
"type": "module",
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@codingame/monaco-vscode-82e231ca-6ed7-5920-b2b8-1874ccc0be07-common": "12.0.1",
|
|
19
|
+
"@codingame/monaco-vscode-9e888134-1a6f-58d9-b0e6-0fc047448366-common": "12.0.1",
|
|
20
|
+
"vscode": "npm:@codingame/monaco-vscode-api@12.0.1"
|
|
21
|
+
},
|
|
22
|
+
"peerDependencies": {
|
|
23
|
+
"@codingame/monaco-vscode-lifecycle-service-override": "12.0.1"
|
|
24
|
+
},
|
|
25
|
+
"peerDependenciesMeta": {
|
|
26
|
+
"@codingame/monaco-vscode-lifecycle-service-override": {
|
|
27
|
+
"optional": true
|
|
28
|
+
}
|
|
29
|
+
},
|
|
17
30
|
"main": "index.js",
|
|
18
31
|
"module": "index.js",
|
|
19
32
|
"types": "index.d.ts",
|
|
@@ -22,10 +35,12 @@
|
|
|
22
35
|
"default": "./index.js"
|
|
23
36
|
},
|
|
24
37
|
"./vscode/*": {
|
|
25
|
-
"default": "./vscode/src/*.js"
|
|
38
|
+
"default": "./vscode/src/*.js",
|
|
39
|
+
"types": "./vscode/src/*.d.ts"
|
|
40
|
+
},
|
|
41
|
+
"./*": {
|
|
42
|
+
"default": "./*.js",
|
|
43
|
+
"types": "./*.d.ts"
|
|
26
44
|
}
|
|
27
|
-
},
|
|
28
|
-
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@11.1.2"
|
|
30
45
|
}
|
|
31
46
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { IHostService } from "vscode/vscode/vs/workbench/services/host/browser/host.service";
|
|
3
|
+
import { ILayoutService } from "vscode/vscode/vs/platform/layout/browser/layoutService.service";
|
|
4
|
+
import { IConfigurationService } from "vscode/vscode/vs/platform/configuration/common/configuration.service";
|
|
5
|
+
import { IWindowOpenable, IOpenWindowOptions, IOpenEmptyWindowOptions } from "vscode/vscode/vs/platform/window/common/window";
|
|
6
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
7
|
+
import { ILabelService } from "vscode/vscode/vs/platform/label/common/label.service";
|
|
8
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
9
|
+
import { IBrowserWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/browser/environmentService.service";
|
|
10
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
11
|
+
import { BrowserLifecycleService } from "@codingame/monaco-vscode-lifecycle-service-override/vscode/vs/workbench/services/lifecycle/browser/lifecycleService";
|
|
12
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
13
|
+
import { IDialogService } from "vscode/vscode/vs/platform/dialogs/common/dialogs.service";
|
|
14
|
+
import { IWorkspaceContextService } from "vscode/vscode/vs/platform/workspace/common/workspace.service";
|
|
15
|
+
import { IUserDataProfilesService } from "vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service";
|
|
16
|
+
export declare class BrowserHostService extends Disposable implements IHostService {
|
|
17
|
+
private readonly layoutService;
|
|
18
|
+
private readonly configurationService;
|
|
19
|
+
private readonly fileService;
|
|
20
|
+
private readonly labelService;
|
|
21
|
+
private readonly environmentService;
|
|
22
|
+
private readonly instantiationService;
|
|
23
|
+
private readonly lifecycleService;
|
|
24
|
+
private readonly logService;
|
|
25
|
+
private readonly dialogService;
|
|
26
|
+
private readonly contextService;
|
|
27
|
+
private readonly userDataProfilesService;
|
|
28
|
+
readonly _serviceBrand: undefined;
|
|
29
|
+
private workspaceProvider;
|
|
30
|
+
private shutdownReason;
|
|
31
|
+
constructor(layoutService: ILayoutService, configurationService: IConfigurationService, fileService: IFileService, labelService: ILabelService, environmentService: IBrowserWorkbenchEnvironmentService, instantiationService: IInstantiationService, lifecycleService: BrowserLifecycleService, logService: ILogService, dialogService: IDialogService, contextService: IWorkspaceContextService, userDataProfilesService: IUserDataProfilesService);
|
|
32
|
+
private registerListeners;
|
|
33
|
+
private onBeforeShutdown;
|
|
34
|
+
private updateShutdownReasonFromEvent;
|
|
35
|
+
get onDidChangeFocus(): Event<boolean>;
|
|
36
|
+
get hasFocus(): boolean;
|
|
37
|
+
hadLastFocus(): Promise<boolean>;
|
|
38
|
+
focus(targetWindow: Window): Promise<void>;
|
|
39
|
+
get onDidChangeActiveWindow(): Event<number>;
|
|
40
|
+
get onDidChangeFullScreen(): Event<{
|
|
41
|
+
windowId: number;
|
|
42
|
+
fullscreen: boolean;
|
|
43
|
+
}>;
|
|
44
|
+
openWindow(options?: IOpenEmptyWindowOptions): Promise<void>;
|
|
45
|
+
openWindow(toOpen: IWindowOpenable[], options?: IOpenWindowOptions): Promise<void>;
|
|
46
|
+
private doOpenWindow;
|
|
47
|
+
private withServices;
|
|
48
|
+
private preservePayload;
|
|
49
|
+
private getRecentLabel;
|
|
50
|
+
private shouldReuse;
|
|
51
|
+
private doOpenEmptyWindow;
|
|
52
|
+
private doOpen;
|
|
53
|
+
toggleFullScreen(targetWindow: Window): Promise<void>;
|
|
54
|
+
moveTop(targetWindow: Window): Promise<void>;
|
|
55
|
+
getCursorScreenPoint(): Promise<undefined>;
|
|
56
|
+
restart(): Promise<void>;
|
|
57
|
+
reload(): Promise<void>;
|
|
58
|
+
close(): Promise<void>;
|
|
59
|
+
withExpectedShutdown<T>(expectedShutdownTask: () => Promise<T>): Promise<T>;
|
|
60
|
+
private handleExpectedShutdown;
|
|
61
|
+
getScreenshot(): Promise<ArrayBufferLike | undefined>;
|
|
62
|
+
getNativeWindowHandle(_windowId: number): Promise<undefined>;
|
|
63
|
+
}
|
|
@@ -1,13 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
3
4
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
4
6
|
import { ILayoutService } from 'vscode/vscode/vs/platform/layout/browser/layoutService.service';
|
|
5
7
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
6
8
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
7
9
|
import { isFolderToOpen, isWorkspaceToOpen, isFileToOpen } from 'vscode/vscode/vs/platform/window/common/window';
|
|
8
10
|
import { pathsToEditors, isResourceEditorInput } from 'vscode/vscode/vs/workbench/common/editor';
|
|
9
|
-
import { whenEditorClosed } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
11
|
+
import { whenEditorClosed } from '@codingame/monaco-vscode-9e888134-1a6f-58d9-b0e6-0fc047448366-common/vscode/vs/workbench/browser/editor';
|
|
10
12
|
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
13
|
+
import { Verbosity } from '@codingame/monaco-vscode-82e231ca-6ed7-5920-b2b8-1874ccc0be07-common/vscode/vs/platform/label/common/label';
|
|
11
14
|
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
12
15
|
import { ModifierKeyEmitter, onDidRegisterWindow, trackFocus, getActiveDocument, getWindowId, disposableWindowInterval, detectFullscreen, EventType, addDisposableListener, addDisposableThrottledListener } from 'vscode/vscode/vs/base/browser/dom';
|
|
13
16
|
import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
@@ -15,11 +18,12 @@ import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/
|
|
|
15
18
|
import { memoize } from 'vscode/vscode/vs/base/common/decorators';
|
|
16
19
|
import { parseLineAndColumnAware } from 'vscode/vscode/vs/base/common/extpath';
|
|
17
20
|
import { IWorkspaceEditingService } from 'vscode/vscode/vs/workbench/services/workspaces/common/workspaceEditing.service';
|
|
21
|
+
import { ShutdownReason } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
|
|
18
22
|
import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
|
|
19
23
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
20
24
|
import { getWorkspaceIdentifier } from 'vscode/vscode/vs/workbench/services/workspaces/browser/workspaces';
|
|
21
25
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
22
|
-
import Severity
|
|
26
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
23
27
|
import { IDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
24
28
|
import { DomEmitter } from 'vscode/vscode/vs/base/browser/event';
|
|
25
29
|
import { isUndefined } from 'vscode/vscode/vs/base/common/types';
|
|
@@ -32,11 +36,11 @@ import { isIOS, isMacintosh } from 'vscode/vscode/vs/base/common/platform';
|
|
|
32
36
|
import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
|
|
33
37
|
|
|
34
38
|
var HostShutdownReason;
|
|
35
|
-
( (
|
|
39
|
+
(function (HostShutdownReason) {
|
|
36
40
|
HostShutdownReason[HostShutdownReason["Unknown"] = 1] = "Unknown";
|
|
37
41
|
HostShutdownReason[HostShutdownReason["Keyboard"] = 2] = "Keyboard";
|
|
38
42
|
HostShutdownReason[HostShutdownReason["Api"] = 3] = "Api";
|
|
39
|
-
})(HostShutdownReason || (HostShutdownReason = {}))
|
|
43
|
+
})(HostShutdownReason || (HostShutdownReason = {}));
|
|
40
44
|
let BrowserHostService = class BrowserHostService extends Disposable {
|
|
41
45
|
constructor(layoutService, configurationService, fileService, labelService, environmentService, instantiationService, lifecycleService, logService, dialogService, contextService, userDataProfilesService) {
|
|
42
46
|
super();
|
|
@@ -95,11 +99,11 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
95
99
|
}
|
|
96
100
|
}
|
|
97
101
|
get onDidChangeFocus() {
|
|
98
|
-
const emitter = this._register((
|
|
102
|
+
const emitter = this._register(( new Emitter()));
|
|
99
103
|
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => {
|
|
100
104
|
const focusTracker = disposables.add(trackFocus(window));
|
|
101
|
-
const visibilityTracker = disposables.add((
|
|
102
|
-
Event.any((
|
|
105
|
+
const visibilityTracker = disposables.add(( new DomEmitter(window.document, 'visibilitychange')));
|
|
106
|
+
Event.any(( Event.map(focusTracker.onDidFocus, () => this.hasFocus, disposables)), ( Event.map(focusTracker.onDidBlur, () => this.hasFocus, disposables)), ( Event.map(visibilityTracker.event, () => this.hasFocus, disposables)), ( Event.map(this.onDidChangeActiveWindow, () => this.hasFocus, disposables)))(focus => emitter.fire(focus));
|
|
103
107
|
}, { window: mainWindow, disposables: this._store }));
|
|
104
108
|
return Event.latch(emitter.event, undefined, this._store);
|
|
105
109
|
}
|
|
@@ -113,7 +117,7 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
113
117
|
targetWindow.focus();
|
|
114
118
|
}
|
|
115
119
|
get onDidChangeActiveWindow() {
|
|
116
|
-
const emitter = this._register((
|
|
120
|
+
const emitter = this._register(( new Emitter()));
|
|
117
121
|
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => {
|
|
118
122
|
const windowId = getWindowId(window);
|
|
119
123
|
const focusTracker = disposables.add(trackFocus(window));
|
|
@@ -131,7 +135,7 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
131
135
|
return Event.latch(emitter.event, undefined, this._store);
|
|
132
136
|
}
|
|
133
137
|
get onDidChangeFullScreen() {
|
|
134
|
-
const emitter = this._register((
|
|
138
|
+
const emitter = this._register(( new Emitter()));
|
|
135
139
|
this._register(Event.runAndSubscribe(onDidRegisterWindow, ({ window, disposables }) => {
|
|
136
140
|
const windowId = getWindowId(window);
|
|
137
141
|
const viewport = isIOS && window.visualViewport ? window.visualViewport : window ;
|
|
@@ -197,11 +201,11 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
197
201
|
});
|
|
198
202
|
}
|
|
199
203
|
else {
|
|
200
|
-
const environment = (
|
|
201
|
-
environment.set('mergeFile1', (
|
|
202
|
-
environment.set('mergeFile2', (
|
|
203
|
-
environment.set('mergeFileBase', (
|
|
204
|
-
environment.set('mergeFileResult', (
|
|
204
|
+
const environment = ( new Map());
|
|
205
|
+
environment.set('mergeFile1', ( editors[0].resource.toString()));
|
|
206
|
+
environment.set('mergeFile2', ( editors[1].resource.toString()));
|
|
207
|
+
environment.set('mergeFileBase', ( editors[2].resource.toString()));
|
|
208
|
+
environment.set('mergeFileResult', ( editors[3].resource.toString()));
|
|
205
209
|
this.doOpen(undefined, { payload: Array.from(environment.entries()) });
|
|
206
210
|
}
|
|
207
211
|
}
|
|
@@ -218,9 +222,9 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
218
222
|
});
|
|
219
223
|
}
|
|
220
224
|
else {
|
|
221
|
-
const environment = (
|
|
222
|
-
environment.set('diffFileSecondary', (
|
|
223
|
-
environment.set('diffFilePrimary', (
|
|
225
|
+
const environment = ( new Map());
|
|
226
|
+
environment.set('diffFileSecondary', ( editors[0].resource.toString()));
|
|
227
|
+
environment.set('diffFilePrimary', ( editors[1].resource.toString()));
|
|
224
228
|
this.doOpen(undefined, { payload: Array.from(environment.entries()) });
|
|
225
229
|
}
|
|
226
230
|
}
|
|
@@ -243,8 +247,8 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
243
247
|
editorService.openEditors(coalesce(await pathsToEditors(openables, this.fileService, this.logService)), undefined, { validateTrust: true });
|
|
244
248
|
}
|
|
245
249
|
else {
|
|
246
|
-
const environment = (
|
|
247
|
-
environment.set('openFile', (
|
|
250
|
+
const environment = ( new Map());
|
|
251
|
+
environment.set('openFile', ( openable.fileUri.toString()));
|
|
248
252
|
if (options?.gotoLineMode) {
|
|
249
253
|
environment.set('gotoLineMode', 'true');
|
|
250
254
|
}
|
|
@@ -255,7 +259,7 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
255
259
|
const waitMarkerFileURI = options?.waitMarkerFileURI;
|
|
256
260
|
if (waitMarkerFileURI) {
|
|
257
261
|
(async () => {
|
|
258
|
-
await this.instantiationService.invokeFunction(accessor => whenEditorClosed(accessor, (
|
|
262
|
+
await this.instantiationService.invokeFunction(accessor => whenEditorClosed(accessor, ( fileOpenables.map(fileOpenable => fileOpenable.fileUri))));
|
|
259
263
|
await this.fileService.del(waitMarkerFileURI);
|
|
260
264
|
})();
|
|
261
265
|
}
|
|
@@ -266,9 +270,9 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
266
270
|
this.instantiationService.invokeFunction(accessor => fn(accessor));
|
|
267
271
|
}
|
|
268
272
|
preservePayload(isEmptyWindow, options) {
|
|
269
|
-
const newPayload = (
|
|
273
|
+
const newPayload = ( new Array());
|
|
270
274
|
if (!isEmptyWindow && this.environmentService.extensionDevelopmentLocationURI) {
|
|
271
|
-
newPayload.push(['extensionDevelopmentPath', (
|
|
275
|
+
newPayload.push(['extensionDevelopmentPath', ( this.environmentService.extensionDevelopmentLocationURI.toString())]);
|
|
272
276
|
if (this.environmentService.debugExtensionHost.debugId) {
|
|
273
277
|
newPayload.push(['debugId', this.environmentService.debugExtensionHost.debugId]);
|
|
274
278
|
}
|
|
@@ -286,10 +290,10 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
286
290
|
}
|
|
287
291
|
getRecentLabel(openable) {
|
|
288
292
|
if (isFolderToOpen(openable)) {
|
|
289
|
-
return this.labelService.getWorkspaceLabel(openable.folderUri, { verbose:
|
|
293
|
+
return this.labelService.getWorkspaceLabel(openable.folderUri, { verbose: Verbosity.LONG });
|
|
290
294
|
}
|
|
291
295
|
if (isWorkspaceToOpen(openable)) {
|
|
292
|
-
return this.labelService.getWorkspaceLabel(getWorkspaceIdentifier(openable.workspaceUri), { verbose:
|
|
296
|
+
return this.labelService.getWorkspaceLabel(getWorkspaceIdentifier(openable.workspaceUri), { verbose: Verbosity.LONG });
|
|
293
297
|
}
|
|
294
298
|
return this.labelService.getUriLabel(openable.fileUri);
|
|
295
299
|
}
|
|
@@ -320,17 +324,17 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
320
324
|
return;
|
|
321
325
|
}
|
|
322
326
|
if (options?.reuse) {
|
|
323
|
-
await this.handleExpectedShutdown(
|
|
327
|
+
await this.handleExpectedShutdown(ShutdownReason.LOAD);
|
|
324
328
|
}
|
|
325
329
|
const opened = await this.workspaceProvider.open(workspace, options);
|
|
326
330
|
if (!opened) {
|
|
327
331
|
const { confirmed } = await this.dialogService.confirm({
|
|
328
|
-
type: Severity
|
|
332
|
+
type: Severity.Warning,
|
|
329
333
|
message: ( localize(
|
|
330
|
-
|
|
334
|
+
11587,
|
|
331
335
|
"The browser interrupted the opening of a new tab or window. Press 'Open' to open it anyway."
|
|
332
336
|
)),
|
|
333
|
-
primaryButton: ( localize(
|
|
337
|
+
primaryButton: ( localize(11588, "&&Open"))
|
|
334
338
|
});
|
|
335
339
|
if (confirmed) {
|
|
336
340
|
await this.workspaceProvider.open(workspace, options);
|
|
@@ -380,11 +384,11 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
380
384
|
this.reload();
|
|
381
385
|
}
|
|
382
386
|
async reload() {
|
|
383
|
-
await this.handleExpectedShutdown(
|
|
387
|
+
await this.handleExpectedShutdown(ShutdownReason.RELOAD);
|
|
384
388
|
mainWindow.location.reload();
|
|
385
389
|
}
|
|
386
390
|
async close() {
|
|
387
|
-
await this.handleExpectedShutdown(
|
|
391
|
+
await this.handleExpectedShutdown(ShutdownReason.CLOSE);
|
|
388
392
|
mainWindow.close();
|
|
389
393
|
}
|
|
390
394
|
async withExpectedShutdown(expectedShutdownTask) {
|
|
@@ -402,7 +406,7 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
402
406
|
return this.lifecycleService.withExpectedShutdown(reason);
|
|
403
407
|
}
|
|
404
408
|
async getScreenshot() {
|
|
405
|
-
const store = (
|
|
409
|
+
const store = ( new DisposableStore());
|
|
406
410
|
const video = document.createElement('video');
|
|
407
411
|
store.add(toDisposable(() => video.remove()));
|
|
408
412
|
let stream;
|
|
@@ -414,8 +418,8 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
414
418
|
video.srcObject = stream;
|
|
415
419
|
video.play();
|
|
416
420
|
await Promise.all([
|
|
417
|
-
(
|
|
418
|
-
(
|
|
421
|
+
( new Promise(r => store.add(addDisposableListener(video, 'loadedmetadata', () => r())))),
|
|
422
|
+
( new Promise(r => store.add(addDisposableListener(video, 'canplaythrough', () => r()))))
|
|
419
423
|
]);
|
|
420
424
|
const canvas = document.createElement('canvas');
|
|
421
425
|
canvas.width = video.videoWidth;
|
|
@@ -425,9 +429,9 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
425
429
|
return undefined;
|
|
426
430
|
}
|
|
427
431
|
ctx.drawImage(video, 0, 0, canvas.width, canvas.height);
|
|
428
|
-
const blob = await (
|
|
432
|
+
const blob = await ( new Promise((resolve) => canvas.toBlob((blob) => resolve(blob), 'image/jpeg', 0.95)));
|
|
429
433
|
if (!blob) {
|
|
430
|
-
throw (
|
|
434
|
+
throw ( new Error('Failed to create blob from canvas'));
|
|
431
435
|
}
|
|
432
436
|
return blob.arrayBuffer();
|
|
433
437
|
}
|
|
@@ -444,28 +448,31 @@ let BrowserHostService = class BrowserHostService extends Disposable {
|
|
|
444
448
|
}
|
|
445
449
|
}
|
|
446
450
|
}
|
|
451
|
+
async getNativeWindowHandle(_windowId) {
|
|
452
|
+
return undefined;
|
|
453
|
+
}
|
|
447
454
|
};
|
|
448
|
-
BrowserHostService.__decorator = (
|
|
455
|
+
BrowserHostService.__decorator = ( __decorate([
|
|
449
456
|
memoize
|
|
450
|
-
], BrowserHostService.prototype, "onDidChangeFocus", null))
|
|
451
|
-
BrowserHostService.__decorator = (
|
|
457
|
+
], BrowserHostService.prototype, "onDidChangeFocus", null));
|
|
458
|
+
BrowserHostService.__decorator = ( __decorate([
|
|
452
459
|
memoize
|
|
453
|
-
], BrowserHostService.prototype, "onDidChangeActiveWindow", null))
|
|
454
|
-
BrowserHostService.__decorator = (
|
|
460
|
+
], BrowserHostService.prototype, "onDidChangeActiveWindow", null));
|
|
461
|
+
BrowserHostService.__decorator = ( __decorate([
|
|
455
462
|
memoize
|
|
456
|
-
], BrowserHostService.prototype, "onDidChangeFullScreen", null))
|
|
457
|
-
BrowserHostService = (
|
|
458
|
-
(
|
|
459
|
-
(
|
|
460
|
-
(
|
|
461
|
-
(
|
|
462
|
-
(
|
|
463
|
-
(
|
|
464
|
-
(
|
|
465
|
-
(
|
|
466
|
-
(
|
|
467
|
-
(
|
|
468
|
-
(
|
|
469
|
-
], BrowserHostService))
|
|
463
|
+
], BrowserHostService.prototype, "onDidChangeFullScreen", null));
|
|
464
|
+
BrowserHostService = ( __decorate([
|
|
465
|
+
( __param(0, ILayoutService)),
|
|
466
|
+
( __param(1, IConfigurationService)),
|
|
467
|
+
( __param(2, IFileService)),
|
|
468
|
+
( __param(3, ILabelService)),
|
|
469
|
+
( __param(4, IBrowserWorkbenchEnvironmentService)),
|
|
470
|
+
( __param(5, IInstantiationService)),
|
|
471
|
+
( __param(6, ILifecycleService)),
|
|
472
|
+
( __param(7, ILogService)),
|
|
473
|
+
( __param(8, IDialogService)),
|
|
474
|
+
( __param(9, IWorkspaceContextService)),
|
|
475
|
+
( __param(10, IUserDataProfilesService))
|
|
476
|
+
], BrowserHostService));
|
|
470
477
|
|
|
471
478
|
export { BrowserHostService };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Event } from "vscode/vscode/vs/base/common/event";
|
|
2
|
+
import { Disposable } from "vscode/vscode/vs/base/common/lifecycle";
|
|
3
|
+
import { IHostColorSchemeService } from "vscode/vscode/vs/workbench/services/themes/common/hostColorSchemeService.service";
|
|
4
|
+
export declare class BrowserHostColorSchemeService extends Disposable implements IHostColorSchemeService {
|
|
5
|
+
readonly _serviceBrand: undefined;
|
|
6
|
+
private readonly _onDidSchemeChangeEvent;
|
|
7
|
+
constructor();
|
|
8
|
+
private registerListeners;
|
|
9
|
+
get onDidChangeColorScheme(): Event<void>;
|
|
10
|
+
get dark(): boolean;
|
|
11
|
+
get highContrast(): boolean;
|
|
12
|
+
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
|
|
1
2
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
2
3
|
import { addMatchMediaChangeListener } from 'vscode/vscode/vs/base/browser/browser';
|
|
4
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
3
5
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
4
6
|
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
7
|
import { mainWindow } from 'vscode/vscode/vs/base/browser/window';
|
package/host.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
2
|
-
import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
|
|
3
|
-
import { IHostColorSchemeService } from 'vscode/vscode/vs/workbench/services/themes/common/hostColorSchemeService.service';
|
|
4
|
-
import { BrowserHostService } from './vscode/src/vs/workbench/services/host/browser/browserHostService.js';
|
|
5
|
-
import { BrowserHostColorSchemeService } from './vscode/src/vs/workbench/services/themes/browser/browserHostColorSchemeService.js';
|
|
6
|
-
|
|
7
|
-
function getServiceOverride() {
|
|
8
|
-
return {
|
|
9
|
-
[( IHostService.toString())]: new SyncDescriptor(BrowserHostService, [], true),
|
|
10
|
-
[( IHostColorSchemeService.toString())]: new SyncDescriptor(BrowserHostColorSchemeService, [], true)
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export { getServiceOverride as default };
|