提交 7a67a54e 编写于 作者: M Martin Aeschlimann

extensionDevelopmentPath is string[]

上级 1cab21cf
......@@ -34,7 +34,7 @@ exports.load = function (modulePaths, resultCallback, options) {
* // configuration: IWindowConfiguration
* @type {{
* zoomLevel?: number,
* extensionDevelopmentPath?: string | string[],
* extensionDevelopmentPath?: string[],
* extensionTestsPath?: string,
* userEnv?: { [key: string]: string | undefined },
* appRoot?: string,
......
......@@ -49,7 +49,7 @@ bootstrapWindow.load([
* @param {{
* partsSplashPath?: string,
* highContrast?: boolean,
* extensionDevelopmentPath?: string | string[],
* extensionDevelopmentPath?: string[],
* folderUri?: object,
* workspace?: object
* }} configuration
......
......@@ -32,7 +32,7 @@ const RUN_TEXTMATE_IN_WORKER = false;
export interface IWindowCreationOptions {
state: IWindowState;
extensionDevelopmentPath?: string | string[];
extensionDevelopmentPath?: string[];
isExtensionTestHost?: boolean;
}
......
......@@ -1170,7 +1170,7 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
return { openFolderInNewWindow: !!openFolderInNewWindow, openFilesInNewWindow };
}
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string | string[], openConfig: IOpenConfiguration): void {
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string[], openConfig: IOpenConfiguration): void {
// Reload an existing extension development host window on the same path
// We currently do not allow more than one extension development window
......@@ -1207,10 +1207,6 @@ export class WindowsManager extends Disposable implements IWindowsMainService {
}
}
if (!Array.isArray(extensionDevelopmentPath)) {
extensionDevelopmentPath = [extensionDevelopmentPath];
}
let authority = '';
for (let p of extensionDevelopmentPath) {
if (p.match(/^[a-zA-Z][a-zA-Z0-9\+\-\.]+:/)) {
......
......@@ -83,23 +83,14 @@ export class Main {
async run(argv: ParsedArgs): Promise<void> {
if (argv['install-source']) {
await this.setInstallSource(argv['install-source']);
} else if (argv['list-extensions']) {
await this.listExtensions(!!argv['show-versions'], argv['category']);
} else if (argv['install-extension']) {
const arg = argv['install-extension'];
const args: string[] = typeof arg === 'string' ? [arg] : arg;
await this.installExtensions(args, !!argv['force']);
await this.installExtensions(argv['install-extension'], !!argv['force']);
} else if (argv['uninstall-extension']) {
const arg = argv['uninstall-extension'];
const ids: string[] = typeof arg === 'string' ? [arg] : arg;
await this.uninstallExtension(ids);
await this.uninstallExtension(argv['uninstall-extension']);
} else if (argv['locate-extension']) {
const arg = argv['locate-extension'];
const ids: string[] = typeof arg === 'string' ? [arg] : arg;
await this.locateExtension(ids);
await this.locateExtension(argv['locate-extension']);
} else if (argv['telemetry']) {
console.log(buildTelemetryMessage(this.environmentService.appRoot, this.environmentService.extensionsPath ? this.environmentService.extensionsPath : undefined));
}
......
......@@ -14,7 +14,7 @@ export interface ISimpleWindow {
openedWorkspace?: IWorkspaceIdentifier;
openedFolderUri?: URI;
extensionDevelopmentPath?: string | string[];
extensionDevelopmentPath?: string[];
lastFocusTime: number;
}
......@@ -95,30 +95,17 @@ export function findWindowOnWorkspace<W extends ISimpleWindow>(windows: W[], wor
return null;
}
export function findWindowOnExtensionDevelopmentPath<W extends ISimpleWindow>(windows: W[], extensionDevelopmentPath: string | string[]): W | null {
export function findWindowOnExtensionDevelopmentPath<W extends ISimpleWindow>(windows: W[], extensionDevelopmentPaths: string[]): W | null {
const matches = (uriString: string): boolean => {
if (Array.isArray(extensionDevelopmentPath)) {
return extensionDevelopmentPath.some(p => extpath.isEqual(p, uriString, !platform.isLinux /* ignorecase */));
} else if (extensionDevelopmentPath) {
return extpath.isEqual(extensionDevelopmentPath, uriString, !platform.isLinux /* ignorecase */);
}
return false;
return extensionDevelopmentPaths.some(p => extpath.isEqual(p, uriString, !platform.isLinux /* ignorecase */));
};
for (const window of windows) {
// match on extension development path. The path can be one or more paths or uri strings, using paths.isEqual is not 100% correct but good enough
if (window.extensionDevelopmentPath) {
if (Array.isArray(window.extensionDevelopmentPath)) {
if (window.extensionDevelopmentPath.some(p => matches(p))) {
return window;
}
} else if (window.extensionDevelopmentPath) {
if (matches(window.extensionDevelopmentPath)) {
return window;
}
}
const currPaths = window.extensionDevelopmentPath;
if (currPaths && currPaths.some(p => matches(p))) {
return window;
}
}
......
......@@ -8,8 +8,8 @@ import { URI } from 'vs/base/common/uri';
export interface ParsedArgs {
_: string[];
'folder-uri'?: string[];
'file-uri'?: string[];
'folder-uri'?: string[]; // undefined or array of 1 or more
'file-uri'?: string[]; // undefined or array of 1 or more
_urls?: string[];
help?: boolean;
version?: boolean;
......@@ -36,7 +36,7 @@ export interface ParsedArgs {
logExtensionHostCommunication?: boolean;
'extensions-dir'?: string;
'builtin-extensions-dir'?: string;
extensionDevelopmentPath?: string[]; // one or more local paths or URIs
extensionDevelopmentPath?: string[]; // // undefined or array of 1 or more local paths or URIs
extensionTestsPath?: string; // either a local path or a URI
'extension-development-confirm-save'?: boolean;
'inspect-extensions'?: string;
......@@ -45,14 +45,14 @@ export interface ParsedArgs {
'inspect-search'?: string;
'inspect-brk-search'?: string;
'disable-extensions'?: boolean;
'disable-extension'?: string[];
'disable-extension'?: string[]; // undefined or array of 1 or more
'list-extensions'?: boolean;
'show-versions'?: boolean;
'category'?: string;
'install-extension'?: string[];
'uninstall-extension'?: string[];
'locate-extension'?: string[];
'enable-proposed-api'?: string[];
'install-extension'?: string[]; // undefined or array of 1 or more
'uninstall-extension'?: string[]; // undefined or array of 1 or more
'locate-extension'?: string[]; // undefined or array of 1 or more
'enable-proposed-api'?: string[]; // undefined or array of 1 or more
'open-url'?: boolean;
'skip-getting-started'?: boolean;
'skip-release-notes'?: boolean;
......
......@@ -198,11 +198,6 @@ export class EnvironmentService implements IEnvironmentService {
}
return URI.file(path.normalize(p));
});
} else if (s) {
if (/^[^:/?#]+?:\/\//.test(s)) {
return [URI.parse(s)];
}
return [URI.file(path.normalize(s))];
}
return undefined;
}
......
......@@ -96,7 +96,7 @@ export interface IWindowsMainService {
enterWorkspace(win: ICodeWindow, path: URI): Promise<IEnterWorkspaceResult | undefined>;
closeWorkspace(win: ICodeWindow): void;
open(openConfig: IOpenConfiguration): ICodeWindow[];
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string | string[], openConfig: IOpenConfiguration): void;
openExtensionDevelopmentHostWindow(extensionDevelopmentPath: string[], openConfig: IOpenConfiguration): void;
pickFileFolderAndOpen(options: INativeOpenDialogOptions): Promise<void>;
pickFolderAndOpen(options: INativeOpenDialogOptions): Promise<void>;
pickFileAndOpen(options: INativeOpenDialogOptions): Promise<void>;
......@@ -140,4 +140,4 @@ export interface IOpenConfiguration {
export interface ISharedProcess {
whenReady(): Promise<void>;
toggle(): void;
}
\ No newline at end of file
}
......@@ -309,8 +309,9 @@ export class WindowsService extends Disposable implements IWindowsService, IURLH
async openExtensionDevelopmentHostWindow(args: ParsedArgs, env: IProcessEnvironment): Promise<void> {
this.logService.trace('windowsService#openExtensionDevelopmentHostWindow ' + JSON.stringify(args));
if (args.extensionDevelopmentPath) {
this.windowsMainService.openExtensionDevelopmentHostWindow(args.extensionDevelopmentPath, {
const extDevPaths = args.extensionDevelopmentPath;
if (extDevPaths) {
this.windowsMainService.openExtensionDevelopmentHostWindow(extDevPaths, {
context: OpenContext.API,
cli: args,
userEnv: Object.keys(env).length > 0 ? env : undefined
......
......@@ -520,18 +520,9 @@ export class SimpleWindowsService implements IWindowsService {
const f = args['folder-uri'];
if (f) {
let u: URI | undefined;
if (Array.isArray(f)) {
if (f.length > 0) {
u = URI.parse(f[0]);
}
} else {
u = URI.parse(f);
}
if (u) {
gotFolder = true;
addQueryParameter('folder', u.path);
}
const u = URI.parse(f[0]);
gotFolder = true;
addQueryParameter('folder', u.path);
}
if (!gotFolder) {
// request empty window
......@@ -540,17 +531,8 @@ export class SimpleWindowsService implements IWindowsService {
const ep = args['extensionDevelopmentPath'];
if (ep) {
let u: string | undefined;
if (Array.isArray(ep)) {
if (ep.length > 0) {
u = ep[0];
}
} else {
u = ep;
}
if (u) {
addQueryParameter('edp', u);
}
let u = ep[0];
addQueryParameter('edp', u);
}
const di = args['debugId'];
......
......@@ -235,7 +235,7 @@ suite('ExtensionsTipsService Test', () => {
});
setup(() => {
instantiationService.stub(IEnvironmentService, <Partial<IEnvironmentService>>{ extensionDevelopmentPath: false });
instantiationService.stub(IEnvironmentService, <Partial<IEnvironmentService>>{});
instantiationService.stubPromise(IExtensionManagementService, 'getInstalled', []);
instantiationService.stub(IExtensionGalleryService, 'isEnabled', true);
instantiationService.stubPromise(IExtensionGalleryService, 'query', aPage<IGalleryExtension>(...mockExtensionGallery));
......
......@@ -14,7 +14,7 @@ import { RemoteAuthorities } from 'vs/base/common/network';
export interface IGetEnvironmentDataArguments {
language: string;
remoteAuthority: string;
extensionDevelopmentPath: UriComponents | UriComponents[] | undefined;
extensionDevelopmentPath: UriComponents[] | undefined;
}
export interface IRemoteAgentEnvironmentDTO {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册