vscode--add-interface-method.md

  1+++
  2repository_url = "https://github.com/microsoft/vscode"
  3revision = "b64eaf598008e2d600a81d846108f72cb37b48e2"
  4+++
  5
  6## Edit History
  7
  8```diff
  9--- a/src/vs/platform/window/electron-main/window.ts
 10+++ b/src/vs/platform/window/electron-main/window.ts
 11@@ -1,49 +1,50 @@
 12 export interface ICodeWindow extends IDisposable {
 13 
 14 	readonly onWillLoad: Event<ILoadEvent>;
 15 	readonly onDidSignalReady: Event<void>;
 16+	readonly onDidTriggerSystemContextMenu: Event<{ x: number; y: number }>;
 17 	readonly onDidClose: Event<void>;
 18 	readonly onDidDestroy: Event<void>;
 19 
 20 	readonly whenClosedOrLoaded: Promise<void>;
 21--- a/src/vs/platform/windows/electron-main/window.ts
 22+++ b/src/vs/platform/windows/electron-main/window.ts
 23@@ -63,60 +63,63 @@ const enum ReadyState {
 24 export class CodeWindow extends Disposable implements ICodeWindow {
 25 
 26 	//#region Events
 27 
 28 	private readonly _onWillLoad = this._register(new Emitter<ILoadEvent>());
 29 	readonly onWillLoad = this._onWillLoad.event;
 30 
 31 	private readonly _onDidSignalReady = this._register(new Emitter<void>());
 32 	readonly onDidSignalReady = this._onDidSignalReady.event;
 33 
 34+	private readonly _onDidTriggerSystemContextMenu = this._register(new Emitter<{ x: number; y: number }>());
 35+	readonly onDidTriggerSystemContextMenu = this._onDidTriggerSystemContextMenu.event;
 36+
 37 	private readonly _onDidClose = this._register(new Emitter<void>());
 38 	readonly onDidClose = this._onDidClose.event;
 39 
 40 	private readonly _onDidDestroy = this._register(new Emitter<void>());
 41 	readonly onDidDestroy = this._onDidDestroy.event;
 42 
 43 	//#endregion
 44--- a/src/vs/platform/windows/electron-main/windows.ts
 45+++ b/src/vs/platform/windows/electron-main/windows.ts
 46@@ -1,54 +1,55 @@
 47 export interface IWindowsMainService {
 48 
 49 	readonly _serviceBrand: undefined;
 50 
 51 	readonly onDidChangeWindowsCount: Event<IWindowsCountChangedEvent>;
 52 
 53 	readonly onDidOpenWindow: Event<ICodeWindow>;
 54 	readonly onDidSignalReadyWindow: Event<ICodeWindow>;
 55+	readonly onDidTriggerSystemContextMenu: Event<{ window: ICodeWindow; x: number; y: number }>;
 56 	readonly onDidDestroyWindow: Event<ICodeWindow>;
 57--- a/src/vs/platform/windows/electron-main/windowsMainService.ts
 58+++ b/src/vs/platform/windows/electron-main/windowsMainService.ts
 59@@ -160,60 +160,63 @@ interface ISingleFolderWorkspacePathToOpen extends IPathToOpen {
 60 export class WindowsMainService extends Disposable implements IWindowsMainService {
 61 
 62 	declare readonly _serviceBrand: undefined;
 63 
 64 	private static readonly WINDOWS: ICodeWindow[] = [];
 65 
 66 	private readonly _onDidOpenWindow = this._register(new Emitter<ICodeWindow>());
 67 	readonly onDidOpenWindow = this._onDidOpenWindow.event;
 68 
 69 	private readonly _onDidSignalReadyWindow = this._register(new Emitter<ICodeWindow>());
 70 	readonly onDidSignalReadyWindow = this._onDidSignalReadyWindow.event;
 71 
 72 	private readonly _onDidDestroyWindow = this._register(new Emitter<ICodeWindow>());
 73 	readonly onDidDestroyWindow = this._onDidDestroyWindow.event;
 74 
 75 	private readonly _onDidChangeWindowsCount = this._register(new Emitter<IWindowsCountChangedEvent>());
 76 	readonly onDidChangeWindowsCount = this._onDidChangeWindowsCount.event;
 77 
 78+	private readonly _onDidTriggerSystemContextMenu = this._register(new Emitter<{ window: ICodeWindow; x: number; y: number }>());
 79+	readonly onDidTriggerSystemContextMenu = this._onDidTriggerSystemContextMenu.event;
 80+
 81 	private readonly windowsStateHandler = this._register(new WindowsStateHandler(this, this.stateMainService, this.lifecycleMainService, this.logService, this.configurationService));
 82```
 83
 84## Cursor Position
 85
 86```src/vs/platform/windows/test/electron-main/windowsFinder.test.ts
 87	function createTestCodeWindow(options: { lastFocusTime: number; openedFolderUri?: URI; openedWorkspace?: IWorkspaceIdentifier }): ICodeWindow {
 88		return new class implements ICodeWindow {
 89			onWillLoad: Event<ILoadEvent> = Event.None;
 90			onDidSignalReady: Event<void> = Event.None;
 91			// <[CURSOR_POSITION]
 92			onDidClose: Event<void> = Event.None;
 93			onDidDestroy: Event<void> = Event.None;
 94			whenClosedOrLoaded: Promise<void> = Promise.resolve();
 95			id: number = -1;
 96```
 97
 98## Expected Patch
 99
100```diff
101--- a/src/vs/platform/windows/test/electron-main/windowsFinder.test.ts
102+++ b/src/vs/platform/windows/test/electron-main/windowsFinder.test.ts
103@@ -7,60 +7,61 @@ import * as assert from 'assert';
104 	function createTestCodeWindow(options: { lastFocusTime: number; openedFolderUri?: URI; openedWorkspace?: IWorkspaceIdentifier }): ICodeWindow {
105 		return new class implements ICodeWindow {
106 			onWillLoad: Event<ILoadEvent> = Event.None;
107+			onDidTriggerSystemContextMenu: Event<{ x: number; y: number }> = Event.None;
108 			onDidSignalReady: Event<void> = Event.None;
109 			onDidClose: Event<void> = Event.None;
110 			onDidDestroy: Event<void> = Event.None;
111 			whenClosedOrLoaded: Promise<void> = Promise.resolve();
112 			id: number = -1;
113```