pathArguments => paths
This commit is contained in:
parent
14a2d834a7
commit
d657555c0b
|
@ -28,7 +28,7 @@ export interface IProcessEnvironment {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ICommandLineArguments extends ParsedArgs {
|
export interface ICommandLineArguments extends ParsedArgs {
|
||||||
pathArguments?: string[];
|
paths?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export const IEnvService = createDecorator<IEnvService>('mainEnvironmentService');
|
export const IEnvService = createDecorator<IEnvService>('mainEnvironmentService');
|
||||||
|
@ -147,13 +147,13 @@ export class EnvService implements IEnvService {
|
||||||
const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870);
|
const debugExtensionHostPort = getNumericValue(argv.debugPluginHost, 5870, this.isBuilt ? void 0 : 5870);
|
||||||
const debugPluginHost = debugBrkExtensionHostPort ? String(debugBrkExtensionHostPort) : debugExtensionHostPort ? String(debugExtensionHostPort): void 0;
|
const debugPluginHost = debugBrkExtensionHostPort ? String(debugBrkExtensionHostPort) : debugExtensionHostPort ? String(debugExtensionHostPort): void 0;
|
||||||
const debugBrkPluginHost = debugBrkExtensionHostPort ? String(true) : void 0;
|
const debugBrkPluginHost = debugBrkExtensionHostPort ? String(true) : void 0;
|
||||||
const pathArguments = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
|
const paths = parsePathArguments(this._currentWorkingDirectory, argv._, argv.goto);
|
||||||
const timestamp = parseInt(argv.timestamp);
|
const timestamp = parseInt(argv.timestamp);
|
||||||
const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0);
|
const debugBrkFileWatcherPort = getNumericValue(argv.debugBrkFileWatcherPort, void 0);
|
||||||
|
|
||||||
this._cliArgs = Object.freeze({
|
this._cliArgs = Object.freeze({
|
||||||
_: [],
|
_: [],
|
||||||
pathArguments,
|
paths,
|
||||||
timestamp: types.isNumber(timestamp) ? String(timestamp) : '0',
|
timestamp: types.isNumber(timestamp) ? String(timestamp) : '0',
|
||||||
performance: argv.performance,
|
performance: argv.performance,
|
||||||
verbose: argv.verbose,
|
verbose: argv.verbose,
|
||||||
|
@ -164,7 +164,7 @@ export class EnvService implements IEnvService {
|
||||||
'new-window': argv['new-window'],
|
'new-window': argv['new-window'],
|
||||||
'reuse-window': argv['reuse-window'],
|
'reuse-window': argv['reuse-window'],
|
||||||
goto: argv.goto,
|
goto: argv.goto,
|
||||||
diff: argv.diff && pathArguments.length === 2,
|
diff: argv.diff && paths.length === 2,
|
||||||
extensionHomePath: normalizePath(argv.extensionHomePath),
|
extensionHomePath: normalizePath(argv.extensionHomePath),
|
||||||
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
|
extensionDevelopmentPath: normalizePath(argv.extensionDevelopmentPath),
|
||||||
extensionTestsPath: normalizePath(argv.extensionTestsPath),
|
extensionTestsPath: normalizePath(argv.extensionTestsPath),
|
||||||
|
|
|
@ -62,9 +62,9 @@ export class LaunchService implements ILaunchService {
|
||||||
let usedWindows: VSCodeWindow[];
|
let usedWindows: VSCodeWindow[];
|
||||||
if (!!args.extensionDevelopmentPath) {
|
if (!!args.extensionDevelopmentPath) {
|
||||||
this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv });
|
this.windowsService.openPluginDevelopmentHostWindow({ cli: args, userEnv });
|
||||||
} else if (args.pathArguments.length === 0 && args['new-window']) {
|
} else if (args.paths.length === 0 && args['new-window']) {
|
||||||
usedWindows = this.windowsService.open({ cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
|
usedWindows = this.windowsService.open({ cli: args, userEnv, forceNewWindow: true, forceEmpty: true });
|
||||||
} else if (args.pathArguments.length === 0) {
|
} else if (args.paths.length === 0) {
|
||||||
usedWindows = [this.windowsService.focusLastActive(args)];
|
usedWindows = [this.windowsService.focusLastActive(args)];
|
||||||
} else {
|
} else {
|
||||||
usedWindows = this.windowsService.open({
|
usedWindows = this.windowsService.open({
|
||||||
|
|
|
@ -195,9 +195,9 @@ function main(accessor: ServicesAccessor, mainIpcServer: Server, userEnv: IProce
|
||||||
updateService.initialize();
|
updateService.initialize();
|
||||||
|
|
||||||
// Open our first window
|
// Open our first window
|
||||||
if (envService.cliArgs['new-window'] && envService.cliArgs.pathArguments.length === 0) {
|
if (envService.cliArgs['new-window'] && envService.cliArgs.paths.length === 0) {
|
||||||
windowsService.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths
|
windowsService.open({ cli: envService.cliArgs, forceNewWindow: true, forceEmpty: true }); // new window if "-n" was used without paths
|
||||||
} else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.pathArguments || !envService.cliArgs.pathArguments.length)) {
|
} else if (global.macOpenFiles && global.macOpenFiles.length && (!envService.cliArgs.paths || !envService.cliArgs.paths.length)) {
|
||||||
windowsService.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup
|
windowsService.open({ cli: envService.cliArgs, pathsToOpen: global.macOpenFiles }); // mac: open-file event received on startup
|
||||||
} else {
|
} else {
|
||||||
windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs['new-window'], diffMode: envService.cliArgs.diff }); // default: read paths from cli
|
windowsService.open({ cli: envService.cliArgs, forceNewWindow: envService.cliArgs['new-window'], diffMode: envService.cliArgs.diff }); // default: read paths from cli
|
||||||
|
|
|
@ -540,7 +540,7 @@ export class WindowsManager implements IWindowsService {
|
||||||
|
|
||||||
// Otherwise infer from command line arguments
|
// Otherwise infer from command line arguments
|
||||||
else {
|
else {
|
||||||
let ignoreFileNotFound = openConfig.cli.pathArguments.length > 0; // we assume the user wants to create this file from command line
|
let ignoreFileNotFound = openConfig.cli.paths.length > 0; // we assume the user wants to create this file from command line
|
||||||
iPathsToOpen = this.cliToPaths(openConfig.cli, ignoreFileNotFound);
|
iPathsToOpen = this.cliToPaths(openConfig.cli, ignoreFileNotFound);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -705,23 +705,23 @@ export class WindowsManager implements IWindowsService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in previously opened workspace unless an explicit path is provided and we are not unit testing
|
// Fill in previously opened workspace unless an explicit path is provided and we are not unit testing
|
||||||
if (openConfig.cli.pathArguments.length === 0 && !openConfig.cli.extensionTestsPath) {
|
if (openConfig.cli.paths.length === 0 && !openConfig.cli.extensionTestsPath) {
|
||||||
let workspaceToOpen = this.windowsState.lastPluginDevelopmentHostWindow && this.windowsState.lastPluginDevelopmentHostWindow.workspacePath;
|
let workspaceToOpen = this.windowsState.lastPluginDevelopmentHostWindow && this.windowsState.lastPluginDevelopmentHostWindow.workspacePath;
|
||||||
if (workspaceToOpen) {
|
if (workspaceToOpen) {
|
||||||
openConfig.cli.pathArguments = [workspaceToOpen];
|
openConfig.cli.paths = [workspaceToOpen];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure we are not asked to open a path that is already opened
|
// Make sure we are not asked to open a path that is already opened
|
||||||
if (openConfig.cli.pathArguments.length > 0) {
|
if (openConfig.cli.paths.length > 0) {
|
||||||
res = WindowsManager.WINDOWS.filter((w) => w.openedWorkspacePath && openConfig.cli.pathArguments.indexOf(w.openedWorkspacePath) >= 0);
|
res = WindowsManager.WINDOWS.filter((w) => w.openedWorkspacePath && openConfig.cli.paths.indexOf(w.openedWorkspacePath) >= 0);
|
||||||
if (res.length) {
|
if (res.length) {
|
||||||
openConfig.cli.pathArguments = [];
|
openConfig.cli.paths = [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Open it
|
// Open it
|
||||||
this.open({ cli: openConfig.cli, forceNewWindow: true, forceEmpty: openConfig.cli.pathArguments.length === 0 });
|
this.open({ cli: openConfig.cli, forceNewWindow: true, forceEmpty: openConfig.cli.paths.length === 0 });
|
||||||
}
|
}
|
||||||
|
|
||||||
private toConfiguration(userEnv: IProcessEnvironment, cli: ICommandLineArguments, workspacePath?: string, filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], extensionsToInstall?: string[]): IWindowConfiguration {
|
private toConfiguration(userEnv: IProcessEnvironment, cli: ICommandLineArguments, workspacePath?: string, filesToOpen?: IPath[], filesToCreate?: IPath[], filesToDiff?: IPath[], extensionsToInstall?: string[]): IWindowConfiguration {
|
||||||
|
@ -814,8 +814,8 @@ export class WindowsManager implements IWindowsService {
|
||||||
|
|
||||||
// Check for pass in candidate or last opened path
|
// Check for pass in candidate or last opened path
|
||||||
let candidates: string[] = [];
|
let candidates: string[] = [];
|
||||||
if (cli.pathArguments.length > 0) {
|
if (cli.paths.length > 0) {
|
||||||
candidates = cli.pathArguments;
|
candidates = cli.paths;
|
||||||
}
|
}
|
||||||
|
|
||||||
// No path argument, check settings for what to do now
|
// No path argument, check settings for what to do now
|
||||||
|
|
Loading…
Reference in a new issue