Merge from vscode 52dcb723a39ae75bee1bd56b3312d7fcdc87aeed (#6719)

This commit is contained in:
Anthony Dresser
2019-08-12 21:31:51 -07:00
committed by GitHub
parent 00250839fc
commit 7eba8c4c03
616 changed files with 9472 additions and 7087 deletions

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
import { createDecorator, ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
import { URI } from 'vs/base/common/uri';
export interface ParsedArgs {
@@ -38,6 +38,7 @@ export interface ParsedArgs {
'builtin-extensions-dir'?: string;
extensionDevelopmentPath?: string | string[]; // one or more local paths or URIs
extensionTestsPath?: string; // either a local path or a URI
'extension-development-confirm-save'?: boolean;
'inspect-extensions'?: string;
'inspect-brk-extensions'?: string;
debugId?: string;
@@ -105,7 +106,8 @@ export interface IExtensionHostDebugParams extends IDebugParams {
export const BACKUPS = 'Backups';
export interface IEnvironmentService {
_serviceBrand: any;
_serviceBrand: ServiceIdentifier<any>;
args: ParsedArgs;

View File

@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as minimist from 'minimist';
import * as minimist from 'vscode-minimist';
import * as os from 'os';
import { localize } from 'vs/nls';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
@@ -69,6 +69,7 @@ export const options: Option[] = [
{ id: 'locate-extension', type: 'string' },
{ id: 'extensionDevelopmentPath', type: 'string' },
{ id: 'extensionTestsPath', type: 'string' },
{ id: 'extension-development-confirm-save', type: 'boolean' },
{ id: 'debugId', type: 'string' },
{ id: 'inspect-search', type: 'string', deprecates: 'debugSearch' },
{ id: 'inspect-brk-search', type: 'string', deprecates: 'debugBrkSearch' },
@@ -141,6 +142,10 @@ export function parseArgs(args: string[], isOptionSupported = (_: Option) => tru
delete parsedArgs[o.deprecates];
}
}
// https://github.com/microsoft/vscode/issues/58177
parsedArgs._ = parsedArgs._.filter(arg => arg.length > 0);
return parsedArgs;
}

View File

@@ -16,6 +16,7 @@ import { toLocalISOString } from 'vs/base/common/date';
import { isWindows, isLinux } from 'vs/base/common/platform';
import { getPathFromAmdModule } from 'vs/base/common/amd';
import { URI } from 'vs/base/common/uri';
import { ServiceIdentifier } from 'vs/platform/instantiation/common/instantiation';
// Read this before there's any chance it is overwritten
// Related to https://github.com/Microsoft/vscode/issues/30624
@@ -76,7 +77,7 @@ function getCLIPath(execPath: string, appRoot: string, isBuilt: boolean): string
export class EnvironmentService implements IEnvironmentService {
_serviceBrand: any;
_serviceBrand!: ServiceIdentifier<any>;
get args(): ParsedArgs { return this._args; }

View File

@@ -52,4 +52,15 @@ suite('EnvironmentService', () => {
assert.equal(parse(['--user-data-dir', './dir'], { cwd: () => '/foo', env: { 'VSCODE_CWD': '/bar' } }), path.resolve('/bar/dir'),
'should use VSCODE_CWD as the cwd when --user-data-dir is specified');
});
// https://github.com/microsoft/vscode/issues/78440
test('careful with boolean file names', function () {
let actual = parseArgs(['-r', 'arg.txt']);
assert(actual['reuse-window']);
assert.deepEqual(actual._, ['arg.txt']);
actual = parseArgs(['-r', 'true.txt']);
assert(actual['reuse-window']);
assert.deepEqual(actual._, ['true.txt']);
});
});