open-url changes

This commit is contained in:
Matt Irvine
2018-01-12 12:59:43 -08:00
parent 94bd1c4d7d
commit fcb6f7f9ee
6 changed files with 14 additions and 8 deletions

View File

@@ -83,10 +83,10 @@ export class LaunchService implements ILaunchService {
this.logService.log('Received data from other instance: ', args, userEnv);
// Check early for open-url which is handled in URL service
const openUrlArg = args['open-url'] || [];
const openUrl = typeof openUrlArg === 'string' ? [openUrlArg] : openUrlArg;
if (openUrl.length > 0) {
openUrl.forEach(url => this.urlService.open(url));
if (args['open-url'] && args._urls && args._urls.length > 0) {
// --open-url must contain -- followed by the url(s)
// process.argv is used over args._ as args._ are resolved to file paths at this point
args._urls.forEach(url => this.urlService.open(url));
return TPromise.as(null);
}

View File

@@ -49,7 +49,7 @@ function createServices(args: ParsedArgs): IInstantiationService {
services.set(IStorageService, new SyncDescriptor(StorageService));
services.set(IConfigurationService, new SyncDescriptor(ConfigurationService));
services.set(IRequestService, new SyncDescriptor(RequestService));
services.set(IURLService, new SyncDescriptor(URLService, args['open-url']));
services.set(IURLService, new SyncDescriptor(URLService, args['open-url'] ? args._urls : []));
services.set(IBackupMainService, new SyncDescriptor(BackupMainService));
return new InstantiationService(services, true);

View File

@@ -15,6 +15,11 @@ import { ParsedArgs } from 'vs/platform/environment/common/environment';
import { realpathSync } from 'vs/base/node/extfs';
export function validatePaths(args: ParsedArgs): ParsedArgs {
// Track URLs if they're going to be used
if (args['open-url']) {
args._urls = args._;
args._ = [];
}
// Realpath/normalize paths and watch out for goto line mode
const paths = doValidatePaths(args._, args.goto);