debt - extract node pieces to node layer (window)
This commit is contained in:
parent
9f1aa3c9fe
commit
b644d803d1
18 changed files with 215 additions and 135 deletions
|
@ -530,21 +530,94 @@
|
|||
// xterm and its addons are strictly browser-only components
|
||||
"xterm",
|
||||
"xterm-addon-*",
|
||||
"**/vs/**"
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/{common,browser}/**",
|
||||
"**/vs/platform/**/{common,browser}/**",
|
||||
"**/vs/editor/**",
|
||||
"**/vs/workbench/{common,browser}/**",
|
||||
"**/vs/workbench/services/**/{common,browser}/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "**/vs/workbench/contrib/extensions/browser/**",
|
||||
"restrictions": [
|
||||
"semver-umd",
|
||||
"**/vs/**"
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/{common,browser}/**",
|
||||
"**/vs/platform/**/{common,browser}/**",
|
||||
"**/vs/editor/**",
|
||||
"**/vs/workbench/{common,browser}/**",
|
||||
"**/vs/workbench/services/**/{common,browser}/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "**/vs/workbench/contrib/update/browser/update.ts",
|
||||
"restrictions": [
|
||||
"semver-umd",
|
||||
"**/vs/**"
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/{common,browser}/**",
|
||||
"**/vs/platform/**/{common,browser}/**",
|
||||
"**/vs/editor/**",
|
||||
"**/vs/workbench/{common,browser}/**",
|
||||
"**/vs/workbench/services/**/{common,browser}/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "**/vs/workbench/contrib/**/common/**",
|
||||
"restrictions": [
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/common/**",
|
||||
"**/vs/platform/**/common/**",
|
||||
"**/vs/editor/**/common/**",
|
||||
"**/vs/workbench/common/**",
|
||||
"**/vs/workbench/services/**/common/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "**/vs/workbench/contrib/**/browser/**",
|
||||
"restrictions": [
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/{common,browser}/**",
|
||||
"**/vs/platform/**/{common,browser}/**",
|
||||
"**/vs/editor/**",
|
||||
"**/vs/workbench/{common,browser}/**",
|
||||
"**/vs/workbench/services/**/{common,browser}/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "**/vs/workbench/contrib/**/node/**",
|
||||
"restrictions": [
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/{common,node}/**",
|
||||
"**/vs/platform/**/{common,node}/**",
|
||||
"**/vs/editor/**/common/**",
|
||||
"**/vs/workbench/{common,node}/**",
|
||||
"**/vs/workbench/services/**/{common,node}/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
"target": "**/vs/workbench/contrib/**/electron-browser/**",
|
||||
"restrictions": [
|
||||
"vs/nls",
|
||||
"vs/css!./**/*",
|
||||
"**/vs/base/**/{common,browser,worker,node,electron-browser}/**",
|
||||
"**/vs/platform/**/{common,browser,node,electron-browser}/**",
|
||||
"**/vs/editor/**",
|
||||
"**/vs/workbench/{common,browser,node,electron-browser,api}/**",
|
||||
"**/vs/workbench/services/**/{common,browser,node,electron-browser}/**",
|
||||
"!path" // node modules (except path where we have our own impl)
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -6,7 +6,8 @@
|
|||
import { app, ipcMain as ipc, systemPreferences, shell, Event, contentTracing, protocol, powerMonitor, IpcMainEvent, BrowserWindow } from 'electron';
|
||||
import { IProcessEnvironment, isWindows, isMacintosh } from 'vs/base/common/platform';
|
||||
import { WindowsMainService } from 'vs/platform/windows/electron-main/windowsMainService';
|
||||
import { OpenContext, IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
import { OpenContext } from 'vs/platform/windows/node/window';
|
||||
import { ActiveWindowManager } from 'vs/code/node/activeWindowTracker';
|
||||
import { ILifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { getShellEnvironment } from 'vs/code/node/shellEnv';
|
||||
|
|
|
@ -15,7 +15,7 @@ import { ILogService } from 'vs/platform/log/common/log';
|
|||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { parseArgs, OPTIONS, ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IWindowSettings, MenuBarVisibility, ReadyState, getTitleBarStyle, getMenuBarVisibility } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowSettings, MenuBarVisibility, getTitleBarStyle, getMenuBarVisibility } from 'vs/platform/windows/common/windows';
|
||||
import { Disposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
import { isLinux, isMacintosh, isWindows } from 'vs/base/common/platform';
|
||||
import { ICodeWindow, IWindowState, WindowMode } from 'vs/platform/windows/electron-main/windows';
|
||||
|
@ -61,6 +61,29 @@ const enum WindowError {
|
|||
CRASHED = 2
|
||||
}
|
||||
|
||||
const enum ReadyState {
|
||||
|
||||
/**
|
||||
* This window has not loaded any HTML yet
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* This window is loading HTML
|
||||
*/
|
||||
LOADING,
|
||||
|
||||
/**
|
||||
* This window is navigating to another HTML
|
||||
*/
|
||||
NAVIGATING,
|
||||
|
||||
/**
|
||||
* This window is done loading HTML
|
||||
*/
|
||||
READY
|
||||
}
|
||||
|
||||
export class CodeWindow extends Disposable implements ICodeWindow {
|
||||
|
||||
private static readonly MIN_WIDTH = 600;
|
||||
|
|
|
@ -6,9 +6,9 @@
|
|||
import { Event } from 'vs/base/common/event';
|
||||
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, shell, OpenDevToolsOptions, SaveDialogOptions, SaveDialogReturnValue, OpenDialogOptions, OpenDialogReturnValue, CrashReporterStartOptions, crashReporter, Menu, BrowserWindow, app } from 'electron';
|
||||
import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window';
|
||||
import { INativeOpenWindowOptions, IOpenedWindow, OpenContext } from 'vs/platform/windows/node/window';
|
||||
import { ILifecycleMainService } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { IOpenedWindow, OpenContext, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
|
||||
import { isMacintosh } from 'vs/base/common/platform';
|
||||
import { IElectronService } from 'vs/platform/electron/node/electron';
|
||||
|
|
|
@ -6,10 +6,10 @@
|
|||
import { Event } from 'vs/base/common/event';
|
||||
import { MessageBoxOptions, MessageBoxReturnValue, OpenDevToolsOptions, SaveDialogOptions, OpenDialogOptions, OpenDialogReturnValue, SaveDialogReturnValue, CrashReporterStartOptions } from 'electron';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IWindowOpenable, IOpenEmptyWindowOptions, IOpenedWindow } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { INativeOpenDialogOptions } from 'vs/platform/dialogs/node/dialogs';
|
||||
import { ISerializableCommandAction } from 'vs/platform/actions/common/actions';
|
||||
import { INativeOpenWindowOptions } from 'vs/platform/windows/node/window';
|
||||
import { INativeOpenWindowOptions, IOpenedWindow } from 'vs/platform/windows/node/window';
|
||||
|
||||
export const IElectronService = createDecorator<IElectronService>('electronService');
|
||||
|
||||
|
|
|
@ -9,7 +9,8 @@ import { IProcessEnvironment, isMacintosh } from 'vs/base/common/platform';
|
|||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { OpenContext, IWindowSettings } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowSettings } from 'vs/platform/windows/common/windows';
|
||||
import { OpenContext } from 'vs/platform/windows/node/window';
|
||||
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
|
||||
import { whenDeleted } from 'vs/base/node/pfs';
|
||||
import { IWorkspacesMainService } from 'vs/platform/workspaces/electron-main/workspacesMainService';
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { Barrier } from 'vs/base/common/async';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { ILifecycleService, BeforeShutdownEvent, WillShutdownEvent, StartupKind, LifecyclePhase, LifecyclePhaseToString } from 'vs/platform/lifecycle/common/lifecycle';
|
||||
|
@ -15,13 +15,13 @@ export abstract class AbstractLifecycleService extends Disposable implements ILi
|
|||
_serviceBrand: undefined;
|
||||
|
||||
protected readonly _onBeforeShutdown = this._register(new Emitter<BeforeShutdownEvent>());
|
||||
readonly onBeforeShutdown: Event<BeforeShutdownEvent> = this._onBeforeShutdown.event;
|
||||
readonly onBeforeShutdown = this._onBeforeShutdown.event;
|
||||
|
||||
protected readonly _onWillShutdown = this._register(new Emitter<WillShutdownEvent>());
|
||||
readonly onWillShutdown: Event<WillShutdownEvent> = this._onWillShutdown.event;
|
||||
readonly onWillShutdown = this._onWillShutdown.event;
|
||||
|
||||
protected readonly _onShutdown = this._register(new Emitter<void>());
|
||||
readonly onShutdown: Event<void> = this._onShutdown.event;
|
||||
readonly onShutdown = this._onShutdown.event;
|
||||
|
||||
protected _startupKind: StartupKind = StartupKind.NewWindow;
|
||||
get startupKind(): StartupKind { return this._startupKind; }
|
||||
|
@ -29,7 +29,7 @@ export abstract class AbstractLifecycleService extends Disposable implements ILi
|
|||
private _phase: LifecyclePhase = LifecyclePhase.Starting;
|
||||
get phase(): LifecyclePhase { return this._phase; }
|
||||
|
||||
private phaseWhen = new Map<LifecyclePhase, Barrier>();
|
||||
private readonly phaseWhen = new Map<LifecyclePhase, Barrier>();
|
||||
|
||||
constructor(
|
||||
@ILogService protected readonly logService: ILogService
|
||||
|
|
|
@ -141,7 +141,28 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
|||
|
||||
private static readonly QUIT_FROM_RESTART_MARKER = 'quit.from.restart'; // use a marker to find out if the session was restarted
|
||||
|
||||
private windowToCloseRequest: Set<number> = new Set();
|
||||
private readonly _onBeforeShutdown = this._register(new Emitter<void>());
|
||||
readonly onBeforeShutdown = this._onBeforeShutdown.event;
|
||||
|
||||
private readonly _onWillShutdown = this._register(new Emitter<ShutdownEvent>());
|
||||
readonly onWillShutdown = this._onWillShutdown.event;
|
||||
|
||||
private readonly _onBeforeWindowClose = this._register(new Emitter<ICodeWindow>());
|
||||
readonly onBeforeWindowClose = this._onBeforeWindowClose.event;
|
||||
|
||||
private readonly _onBeforeWindowUnload = this._register(new Emitter<IWindowUnloadEvent>());
|
||||
readonly onBeforeWindowUnload = this._onBeforeWindowUnload.event;
|
||||
|
||||
private _quitRequested = false;
|
||||
get quitRequested(): boolean { return this._quitRequested; }
|
||||
|
||||
private _wasRestarted: boolean = false;
|
||||
get wasRestarted(): boolean { return this._wasRestarted; }
|
||||
|
||||
private _phase = LifecycleMainPhase.Starting;
|
||||
get phase(): LifecycleMainPhase { return this._phase; }
|
||||
|
||||
private readonly windowToCloseRequest = new Set<number>();
|
||||
private oneTimeListenerTokenGenerator = 0;
|
||||
private windowCounter = 0;
|
||||
|
||||
|
@ -150,28 +171,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe
|
|||
|
||||
private pendingWillShutdownPromise: Promise<void> | null = null;
|
||||
|
||||
private _quitRequested = false;
|
||||
get quitRequested(): boolean { return this._quitRequested; }
|
||||
|
||||
private _wasRestarted: boolean = false;
|
||||
get wasRestarted(): boolean { return this._wasRestarted; }
|
||||
|
||||
private readonly _onBeforeShutdown = this._register(new Emitter<void>());
|
||||
readonly onBeforeShutdown: Event<void> = this._onBeforeShutdown.event;
|
||||
|
||||
private readonly _onWillShutdown = this._register(new Emitter<ShutdownEvent>());
|
||||
readonly onWillShutdown: Event<ShutdownEvent> = this._onWillShutdown.event;
|
||||
|
||||
private readonly _onBeforeWindowClose = this._register(new Emitter<ICodeWindow>());
|
||||
readonly onBeforeWindowClose: Event<ICodeWindow> = this._onBeforeWindowClose.event;
|
||||
|
||||
private readonly _onBeforeWindowUnload = this._register(new Emitter<IWindowUnloadEvent>());
|
||||
readonly onBeforeWindowUnload: Event<IWindowUnloadEvent> = this._onBeforeWindowUnload.event;
|
||||
|
||||
private _phase: LifecycleMainPhase = LifecycleMainPhase.Starting;
|
||||
get phase(): LifecycleMainPhase { return this._phase; }
|
||||
|
||||
private phaseWhen = new Map<LifecycleMainPhase, Barrier>();
|
||||
private readonly phaseWhen = new Map<LifecycleMainPhase, Barrier>();
|
||||
|
||||
constructor(
|
||||
@ILogService private readonly logService: ILogService,
|
||||
|
|
|
@ -7,7 +7,8 @@ import * as nls from 'vs/nls';
|
|||
import { isMacintosh, language } from 'vs/base/common/platform';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { app, shell, Menu, MenuItem, BrowserWindow, MenuItemConstructorOptions, WebContents, Event, KeyboardEvent } from 'electron';
|
||||
import { OpenContext, IRunActionInWindowRequest, getTitleBarStyle, IRunKeybindingInWindowRequest, IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
import { getTitleBarStyle, IWindowOpenable } from 'vs/platform/windows/common/windows';
|
||||
import { OpenContext, IRunActionInWindowRequest, IRunKeybindingInWindowRequest } from 'vs/platform/windows/node/window';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IUpdateService, StateType } from 'vs/platform/update/common/update';
|
||||
|
|
|
@ -5,19 +5,9 @@
|
|||
|
||||
import { isMacintosh, isLinux, isWeb } from 'vs/base/common/platform';
|
||||
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
|
||||
import { IWorkspaceIdentifier, ISingleFolderWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
export interface IOpenedWindow {
|
||||
id: number;
|
||||
workspace?: IWorkspaceIdentifier;
|
||||
folderUri?: ISingleFolderWorkspaceIdentifier;
|
||||
title: string;
|
||||
filename?: string;
|
||||
dirty: boolean;
|
||||
}
|
||||
|
||||
export interface IBaseOpenWindowsOptions {
|
||||
forceReuseWindow?: boolean;
|
||||
}
|
||||
|
@ -130,66 +120,12 @@ export function getTitleBarStyle(configurationService: IConfigurationService, en
|
|||
return isLinux ? 'native' : 'custom'; // default to custom on all macOS and Windows
|
||||
}
|
||||
|
||||
export const enum OpenContext {
|
||||
|
||||
// opening when running from the command line
|
||||
CLI,
|
||||
|
||||
// macOS only: opening from the dock (also when opening files to a running instance from desktop)
|
||||
DOCK,
|
||||
|
||||
// opening from the main application window
|
||||
MENU,
|
||||
|
||||
// opening from a file or folder dialog
|
||||
DIALOG,
|
||||
|
||||
// opening from the OS's UI
|
||||
DESKTOP,
|
||||
|
||||
// opening through the API
|
||||
API
|
||||
}
|
||||
|
||||
export const enum ReadyState {
|
||||
|
||||
/**
|
||||
* This window has not loaded any HTML yet
|
||||
*/
|
||||
NONE,
|
||||
|
||||
/**
|
||||
* This window is loading HTML
|
||||
*/
|
||||
LOADING,
|
||||
|
||||
/**
|
||||
* This window is navigating to another HTML
|
||||
*/
|
||||
NAVIGATING,
|
||||
|
||||
/**
|
||||
* This window is done loading HTML
|
||||
*/
|
||||
READY
|
||||
}
|
||||
|
||||
export interface IPath extends IPathData {
|
||||
|
||||
// the file path to open within the instance
|
||||
fileUri?: URI;
|
||||
}
|
||||
|
||||
export interface IPathsToWaitFor extends IPathsToWaitForData {
|
||||
paths: IPath[];
|
||||
waitMarkerFileUri: URI;
|
||||
}
|
||||
|
||||
export interface IPathsToWaitForData {
|
||||
paths: IPathData[];
|
||||
waitMarkerFileUri: UriComponents;
|
||||
}
|
||||
|
||||
export interface IPathData {
|
||||
|
||||
// the file path to open within the instance
|
||||
|
@ -210,12 +146,6 @@ export interface IPathData {
|
|||
export interface IOpenFileRequest {
|
||||
filesToOpenOrCreate?: IPathData[];
|
||||
filesToDiff?: IPathData[];
|
||||
filesToWait?: IPathsToWaitForData;
|
||||
termProgram?: string;
|
||||
}
|
||||
|
||||
export interface IAddFoldersRequest {
|
||||
foldersToAdd: UriComponents[];
|
||||
}
|
||||
|
||||
export interface IWindowConfiguration {
|
||||
|
@ -228,13 +158,3 @@ export interface IWindowConfiguration {
|
|||
filesToOpenOrCreate?: IPath[];
|
||||
filesToDiff?: IPath[];
|
||||
}
|
||||
|
||||
export interface IRunActionInWindowRequest {
|
||||
id: string;
|
||||
from: 'menu' | 'touchbar' | 'mouse';
|
||||
args?: any[];
|
||||
}
|
||||
|
||||
export interface IRunKeybindingInWindowRequest {
|
||||
userSettingsLabel: string;
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { OpenContext, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { INativeWindowConfiguration } from 'vs/platform/windows/node/window';
|
||||
import { IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { INativeWindowConfiguration, OpenContext } from 'vs/platform/windows/node/window';
|
||||
import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
|
|
@ -20,8 +20,8 @@ import { parseLineAndColumnAware } from 'vs/code/node/paths';
|
|||
import { ILifecycleMainService, UnloadReason, LifecycleMainService, LifecycleMainPhase } from 'vs/platform/lifecycle/electron-main/lifecycleMainService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IWindowSettings, OpenContext, IPath, IPathsToWaitFor, isFileToOpen, isWorkspaceToOpen, isFolderToOpen, IWindowOpenable, IOpenEmptyWindowOptions, IAddFoldersRequest } from 'vs/platform/windows/common/windows';
|
||||
import { getLastActiveWindow, findBestWindowOrFolderForFile, findWindowOnWorkspace, findWindowOnExtensionDevelopmentPath, findWindowOnWorkspaceOrFolderUri, INativeWindowConfiguration } from 'vs/platform/windows/node/window';
|
||||
import { IWindowSettings, IPath, isFileToOpen, isWorkspaceToOpen, isFolderToOpen, IWindowOpenable, IOpenEmptyWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { getLastActiveWindow, findBestWindowOrFolderForFile, findWindowOnWorkspace, findWindowOnExtensionDevelopmentPath, findWindowOnWorkspaceOrFolderUri, INativeWindowConfiguration, OpenContext, IAddFoldersRequest, IPathsToWaitFor } from 'vs/platform/windows/node/window';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
import { IWindowsMainService, IOpenConfiguration, IWindowsCountChangedEvent, ICodeWindow, IWindowState as ISingleWindowState, WindowMode } from 'vs/platform/windows/electron-main/windows';
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { OpenContext, IOpenWindowOptions, IWindowConfiguration, IPathsToWaitFor } from 'vs/platform/windows/common/windows';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IOpenWindowOptions, IWindowConfiguration, IPath, IOpenFileRequest, IPathData } from 'vs/platform/windows/common/windows';
|
||||
import { URI, UriComponents } from 'vs/base/common/uri';
|
||||
import * as platform from 'vs/base/common/platform';
|
||||
import * as extpath from 'vs/base/common/extpath';
|
||||
import { IWorkspaceIdentifier, IResolvedWorkspace, ISingleFolderWorkspaceIdentifier, isSingleFolderWorkspaceIdentifier, isWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
|
@ -13,6 +13,50 @@ import { LogLevel } from 'vs/platform/log/common/log';
|
|||
import { ExportData } from 'vs/base/common/performance';
|
||||
import { ParsedArgs } from 'vs/platform/environment/node/argv';
|
||||
|
||||
export interface IOpenedWindow {
|
||||
id: number;
|
||||
workspace?: IWorkspaceIdentifier;
|
||||
folderUri?: ISingleFolderWorkspaceIdentifier;
|
||||
title: string;
|
||||
filename?: string;
|
||||
dirty: boolean;
|
||||
}
|
||||
|
||||
export const enum OpenContext {
|
||||
|
||||
// opening when running from the command line
|
||||
CLI,
|
||||
|
||||
// macOS only: opening from the dock (also when opening files to a running instance from desktop)
|
||||
DOCK,
|
||||
|
||||
// opening from the main application window
|
||||
MENU,
|
||||
|
||||
// opening from a file or folder dialog
|
||||
DIALOG,
|
||||
|
||||
// opening from the OS's UI
|
||||
DESKTOP,
|
||||
|
||||
// opening through the API
|
||||
API
|
||||
}
|
||||
|
||||
export interface IRunActionInWindowRequest {
|
||||
id: string;
|
||||
from: 'menu' | 'touchbar' | 'mouse';
|
||||
args?: any[];
|
||||
}
|
||||
|
||||
export interface IRunKeybindingInWindowRequest {
|
||||
userSettingsLabel: string;
|
||||
}
|
||||
|
||||
export interface IAddFoldersRequest {
|
||||
foldersToAdd: UriComponents[];
|
||||
}
|
||||
|
||||
export interface INativeWindowConfiguration extends IWindowConfiguration, ParsedArgs {
|
||||
mainPid: number;
|
||||
|
||||
|
@ -41,6 +85,21 @@ export interface INativeWindowConfiguration extends IWindowConfiguration, Parsed
|
|||
filesToWait?: IPathsToWaitFor;
|
||||
}
|
||||
|
||||
export interface INativeOpenFileRequest extends IOpenFileRequest {
|
||||
termProgram?: string;
|
||||
filesToWait?: IPathsToWaitForData;
|
||||
}
|
||||
|
||||
export interface IPathsToWaitFor extends IPathsToWaitForData {
|
||||
paths: IPath[];
|
||||
waitMarkerFileUri: URI;
|
||||
}
|
||||
|
||||
export interface IPathsToWaitForData {
|
||||
paths: IPathData[];
|
||||
waitMarkerFileUri: UriComponents;
|
||||
}
|
||||
|
||||
export interface INativeOpenWindowOptions extends IOpenWindowOptions {
|
||||
diffMode?: boolean;
|
||||
addMode?: boolean;
|
||||
|
|
|
@ -4,8 +4,7 @@
|
|||
*--------------------------------------------------------------------------------------------*/
|
||||
import * as assert from 'assert';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { IBestWindowOrFolderOptions, IWindowContext, findBestWindowOrFolderForFile } from 'vs/platform/windows/node/window';
|
||||
import { OpenContext } from 'vs/platform/windows/common/windows';
|
||||
import { IBestWindowOrFolderOptions, IWindowContext, findBestWindowOrFolderForFile, OpenContext } from 'vs/platform/windows/node/window';
|
||||
import { IWorkspaceIdentifier } from 'vs/platform/workspaces/common/workspaces';
|
||||
import { toWorkspaceFolders } from 'vs/platform/workspace/common/workspace';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
|
|
@ -26,7 +26,9 @@ import { FindReplaceState } from 'vs/editor/contrib/find/findState';
|
|||
import { escapeNonWindowsPath } from 'vs/workbench/contrib/terminal/common/terminalEnvironment';
|
||||
import { isWindows, isMacintosh, OperatingSystem } from 'vs/base/common/platform';
|
||||
import { basename } from 'vs/base/common/path';
|
||||
import { IOpenFileRequest } from 'vs/platform/windows/common/windows';
|
||||
// TODO@daniel code layering
|
||||
// eslint-disable-next-line code-layering
|
||||
import { INativeOpenFileRequest } from 'vs/platform/windows/node/window';
|
||||
import { find } from 'vs/base/common/arrays';
|
||||
import { timeout } from 'vs/base/common/async';
|
||||
import { IViewsService } from 'vs/workbench/common/views';
|
||||
|
@ -207,7 +209,7 @@ export class TerminalService implements ITerminalService {
|
|||
this.terminalInstances.forEach(instance => instance.dispose(true));
|
||||
}
|
||||
|
||||
private async _onOpenFileRequest(request: IOpenFileRequest): Promise<void> {
|
||||
private async _onOpenFileRequest(request: INativeOpenFileRequest): Promise<void> {
|
||||
// if the request to open files is coming in from the integrated terminal (identified though
|
||||
// the termProgram variable) and we are instructed to wait for editors close, wait for the
|
||||
// marker file to get deleted and then focus back to the integrated terminal.
|
||||
|
|
|
@ -14,7 +14,8 @@ import { IFileService } from 'vs/platform/files/common/files';
|
|||
import { toResource, IUntitledTextResourceEditorInput, SideBySideEditor, pathsToEditors } from 'vs/workbench/common/editor';
|
||||
import { IEditorService, IResourceEditorInputType } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ITelemetryService, crashReporterIdStorageKey } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWindowSettings, IOpenFileRequest, IWindowsConfiguration, IAddFoldersRequest, IRunActionInWindowRequest, IRunKeybindingInWindowRequest, getTitleBarStyle } from 'vs/platform/windows/common/windows';
|
||||
import { IWindowSettings, IOpenFileRequest, IWindowsConfiguration, getTitleBarStyle } from 'vs/platform/windows/common/windows';
|
||||
import { IRunActionInWindowRequest, IRunKeybindingInWindowRequest, IAddFoldersRequest, INativeOpenFileRequest } from 'vs/platform/windows/node/window';
|
||||
import { ITitleService } from 'vs/workbench/services/title/common/titleService';
|
||||
import { IWorkbenchThemeService, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import * as browser from 'vs/base/browser/browser';
|
||||
|
@ -594,7 +595,7 @@ export class NativeWindow extends Disposable {
|
|||
this.workspaceEditingService.addFolders(foldersToAdd);
|
||||
}
|
||||
|
||||
private async onOpenFiles(request: IOpenFileRequest): Promise<void> {
|
||||
private async onOpenFiles(request: INativeOpenFileRequest): Promise<void> {
|
||||
const inputs: IResourceEditorInputType[] = [];
|
||||
const diffMode = !!(request.filesToDiff && (request.filesToDiff.length === 2));
|
||||
|
||||
|
|
|
@ -6,8 +6,8 @@ import * as assert from 'assert';
|
|||
import 'vs/workbench/services/keybinding/browser/keyboardLayouts/en.darwin'; // 15%
|
||||
import 'vs/workbench/services/keybinding/browser/keyboardLayouts/de.darwin';
|
||||
import { KeyboardLayoutContribution } from 'vs/workbench/services/keybinding/browser/keyboardLayouts/_.contribution';
|
||||
import { BrowserKeyboardMapperFactoryBase } from '../../browser/keymapService';
|
||||
import { KeymapInfo, IKeymapInfo } from '../../common/keymapInfo';
|
||||
import { BrowserKeyboardMapperFactoryBase } from 'vs/workbench/services/keybinding/browser/keymapService';
|
||||
import { KeymapInfo, IKeymapInfo } from 'vs/workbench/services/keybinding/common/keymapInfo';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { ICommandService } from 'vs/platform/commands/common/commands';
|
||||
|
|
|
@ -25,7 +25,7 @@ import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService
|
|||
import { URI } from 'vs/base/common/uri';
|
||||
import { IReadTextFileOptions, ITextFileStreamContent, ITextFileService } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { createTextBufferFactoryFromStream } from 'vs/editor/common/model/textModel';
|
||||
import { IOpenedWindow, IOpenEmptyWindowOptions, IWindowOpenable, IOpenWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { IOpenEmptyWindowOptions, IWindowOpenable, IOpenWindowOptions } from 'vs/platform/windows/common/windows';
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { LogLevel, ILogService } from 'vs/platform/log/common/log';
|
||||
import { IRemotePathService } from 'vs/workbench/services/path/common/remotePathService';
|
||||
|
@ -37,7 +37,7 @@ import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
|
|||
import { NodeTestBackupFileService } from 'vs/workbench/services/backup/test/electron-browser/backupFileService.test';
|
||||
import { IWorkingCopyService } from 'vs/workbench/services/workingCopy/common/workingCopyService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { INativeWindowConfiguration } from 'vs/platform/windows/node/window';
|
||||
import { INativeWindowConfiguration, IOpenedWindow } from 'vs/platform/windows/node/window';
|
||||
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
|
||||
export const TestWindowConfiguration: INativeWindowConfiguration = {
|
||||
|
|
Loading…
Reference in a new issue