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

extensionDevelopmentPath is string[]

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