Merge remote-tracking branch 'origin/master'

This commit is contained in:
Joao Moreno
2016-05-27 09:44:01 +02:00
255 changed files with 6233 additions and 1183 deletions
+25 -21
View File
@@ -6,6 +6,7 @@
import * as os from 'os';
import * as minimist from 'minimist';
import pkg from 'vs/platform/package';
import { localize } from 'vs/nls';
export interface ParsedArgs extends minimist.ParsedArgs {
help: boolean;
@@ -76,29 +77,32 @@ export function parseArgs(args: string[]) {
}
const executable = 'code' + (os.platform() === 'win32' ? '.exe' : '');
const indent = ' ';
export const optionsHelp: { [name: string]: string; } = {
'-d, --diff': localize('diff', "Open a diff editor. Requires to pass two file paths as arguments."),
'--disable-extensions': localize('disableExtensions', "Disable all installed extensions."),
'-g, --goto': localize('goto', "Open the file at path at the line and column (add :line[:column] to path)."),
'--locale <locale>': localize('locale', "The locale to use (e.g. en-US or zh-TW)."),
'-n, --new-window': localize('newWindow', "Force a new instance of Code."),
'-r, --reuse-window': localize('reuseWindow', "Force opening a file or folder in the last active window."),
'--user-data-dir <dir>': localize('userDataDir', "Specifies the directory that user data is kept in, useful when running as root."),
'--verbose': localize('verbose', "Print verbose output (implies --wait)."),
'-w, --wait': localize('wait', "Wait for the window to be closed before returning."),
'--list-extensions': localize('listExtensions', "List the installed extensions."),
'--install-extension <extension>': localize('installExtension', "Installs an extension."),
'--uninstall-extension <extension>': localize('uninstallExtension', "Uninstalls an extension."),
'-v, --version': localize('version', "Print version."),
'-h, --help': localize('help', "Print usage.")
};
function formatOptions(options: { [name: string]: string; }): string {
return Object.keys(options)
.reduce((r, key) => r.concat([` ${ key }`, ` ${ options[key] }`]), []).join('\n');
}
export const helpMessage = `Visual Studio Code v${ pkg.version }
Usage: ${ executable } [arguments] [paths...]
Options:
${ indent }-d, --diff Open a diff editor. Requires to pass two file paths
${ indent } as arguments.
${ indent }--disable-extensions Disable all installed extensions.
${ indent }-g, --goto Open the file at path at the line and column (add
${ indent } :line[:column] to path).
${ indent }-h, --help Print usage.
${ indent }--locale <locale> The locale to use (e.g. en-US or zh-TW).
${ indent }-n, --new-window Force a new instance of Code.
${ indent }-r, --reuse-window Force opening a file or folder in the last active
${ indent } window.
${ indent }--user-data-dir <dir> Specifies the directory that user data is kept in,
${ indent } useful when running as root.
${ indent }--verbose Print verbose output (implies --wait).
${ indent }-v, --version Print version.
${ indent }-w, --wait Wait for the window to be closed before returning.
${ indent }--list-extensions List the installed extensions.
${ indent }--install-extension <extension>
${ indent } Installs an extension.
${ indent }--uninstall-extension <extension>
${ indent } Uninstalls an extension.`;
${formatOptions(optionsHelp)}`;
+1 -1
View File
@@ -36,7 +36,7 @@ export function main(args: string[]): TPromise<void> {
delete env['ATOM_SHELL_INTERNAL_RUN_AS_NODE'];
let options = {
detacted: true,
detached: true,
env,
};
if (!argv.verbose) {
+27 -17
View File
@@ -15,7 +15,7 @@ import { IEnvironmentService } from 'vs/platform/environment/common/environment'
import { EnvironmentService } from 'vs/platform/environment/node/environmentService';
import { IEventService } from 'vs/platform/event/common/event';
import { EventService } from 'vs/platform/event/common/eventService';
import { IExtensionManagementService, IExtensionGalleryService } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionManagementService, IExtensionGalleryService, IQueryResult } from 'vs/platform/extensionManagement/common/extensionManagement';
import { getExtensionId } from 'vs/platform/extensionManagement/node/extensionManagementUtil';
import { ExtensionManagementService } from 'vs/platform/extensionManagement/node/extensionManagementService';
import { ExtensionGalleryService } from 'vs/platform/extensionManagement/node/extensionGalleryService';
@@ -27,7 +27,7 @@ import { NodeConfigurationService } from 'vs/platform/configuration/node/nodeCon
const notFound = id => localize('notFound', "Extension '{0}' not found.", id);
const notInstalled = id => localize('notInstalled', "Extension '{0}' is not installed.", id);
const useId = localize('useId', "Make sure you use the full extension id, eg: {0}", 'ms-vscode.csharp');
const useId = localize('useId', "Make sure you use the full case-sensitive extension ID, eg: {0}", 'ms-vscode.csharp');
class Main {
@@ -59,9 +59,8 @@ class Main {
}
private installExtension(ids: string[]): TPromise<any> {
return this.extensionManagementService.getInstalled().then(installed => {
return sequence(ids.map(id => () => {
return sequence(ids.map(id => () => {
return this.extensionManagementService.getInstalled().then(installed => {
const isInstalled = installed.some(e => getExtensionId(e) === id);
if (isInstalled) {
@@ -69,22 +68,33 @@ class Main {
return TPromise.as(null);
}
return this.extensionGalleryService.query({ ids: [id] }).then(result => {
const [extension] = result.firstPage;
return this.extensionGalleryService.query({ ids: [id] })
.then<IQueryResult>(null, err => {
if (err.responseText) {
try {
const response = JSON.parse(err.responseText);
return TPromise.wrapError(response.message);
} catch (e) {
return TPromise.wrapError(err);
}
}
})
.then(result => {
const [extension] = result.firstPage;
if (!extension) {
return TPromise.wrapError(`${ notFound(id) }\n${ useId }`);
}
if (!extension) {
return TPromise.wrapError(`${ notFound(id) }\n${ useId }`);
}
console.log(localize('foundExtension', "Found '{0}' in the marketplace.", id));
console.log(localize('installing', "Installing..."));
console.log(localize('foundExtension', "Found '{0}' in the marketplace.", id));
console.log(localize('installing', "Installing..."));
return this.extensionManagementService.install(extension).then(extension => {
console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version));
return this.extensionManagementService.install(extension).then(extension => {
console.log(localize('successInstall', "Extension '{0}' v{1} was successfully installed!", id, extension.version));
});
});
});
}));
});
});
}));
}
private uninstallExtension(ids: string[]): TPromise<any> {