Skip to content

Commit

Permalink
web - move help actions to browser
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Sep 16, 2019
1 parent 1d072c6 commit 5e1179f
Show file tree
Hide file tree
Showing 27 changed files with 247 additions and 236 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.39.0",
"distro": "bb5d0e1cef8b8321ebe0f7a208cf1d70720c1dec",
"distro": "fd39b7b148a928c13bdf4648e5595416c698a1df",
"author": {
"name": "Microsoft Corporation"
},
Expand Down
5 changes: 2 additions & 3 deletions src/vs/code/electron-browser/issue/issueReporterMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import * as collections from 'vs/base/common/collections';
import * as browser from 'vs/base/browser/browser';
import { escape } from 'vs/base/common/strings';
import product from 'vs/platform/product/node/product';
import pkg from 'vs/platform/product/node/package';
import * as os from 'os';
import { debounce } from 'vs/base/common/decorators';
import * as platform from 'vs/base/common/platform';
Expand Down Expand Up @@ -85,7 +84,7 @@ export class IssueReporter extends Disposable {
this.issueReporterModel = new IssueReporterModel({
issueType: configuration.data.issueType || IssueType.Bug,
versionInfo: {
vscodeVersion: `${pkg.name} ${pkg.version} (${product.commit || 'Commit unknown'}, ${product.date || 'Date unknown'})`,
vscodeVersion: `${product.nameShort} ${product.version} (${product.commit || 'Commit unknown'}, ${product.date || 'Date unknown'})`,
os: `${os.type()} ${os.arch()} ${os.release()}${isSnap ? ' snap' : ''}`
},
extensionsDisabled: !!this.environmentService.disableExtensions,
Expand Down Expand Up @@ -311,7 +310,7 @@ export class IssueReporter extends Disposable {
if (!this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
const channel = getDelayedChannel(sharedProcess.then(c => c.getChannel('telemetryAppender')));
const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(logService));
const commonProperties = resolveCommonProperties(product.commit || 'Commit unknown', pkg.version, configuration.machineId, product.msftInternalDomains, this.environmentService.installSourcePath);
const commonProperties = resolveCommonProperties(product.commit || 'Commit unknown', product.version, configuration.machineId, product.msftInternalDomains, this.environmentService.installSourcePath);
const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot];
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths };

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import * as fs from 'fs';
import * as platform from 'vs/base/common/platform';
import product from 'vs/platform/product/node/product';
import pkg from 'vs/platform/product/node/package';
import { serve, Server, connect } from 'vs/base/parts/ipc/node/ipc.net';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors';
Expand Down Expand Up @@ -148,7 +147,7 @@ async function main(server: Server, initData: ISharedProcessInitData, configurat
}
const config: ITelemetryServiceConfig = {
appender: combinedAppender(appInsightsAppender, new LogAppender(logService)),
commonProperties: resolveCommonProperties(product.commit, pkg.version, configuration.machineId, product.msftInternalDomains, installSourcePath),
commonProperties: resolveCommonProperties(product.commit, product.version, configuration.machineId, product.msftInternalDomains, installSourcePath),
piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot]
};

Expand Down
3 changes: 1 addition & 2 deletions src/vs/code/electron-main/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ import { TelemetryService, ITelemetryServiceConfig } from 'vs/platform/telemetry
import { resolveCommonProperties } from 'vs/platform/telemetry/node/commonProperties';
import { getDelayedChannel, StaticRouter } from 'vs/base/parts/ipc/common/ipc';
import product from 'vs/platform/product/node/product';
import pkg from 'vs/platform/product/node/package';
import { ProxyAuthHandler } from 'vs/code/electron-main/auth';
import { Disposable } from 'vs/base/common/lifecycle';
import { IWindowsMainService, ICodeWindow } from 'vs/platform/windows/electron-main/windows';
Expand Down Expand Up @@ -474,7 +473,7 @@ export class CodeApplication extends Disposable {
if (!this.environmentService.isExtensionDevelopment && !this.environmentService.args['disable-telemetry'] && !!product.enableTelemetry) {
const channel = getDelayedChannel(sharedProcessClient.then(client => client.getChannel('telemetryAppender')));
const appender = combinedAppender(new TelemetryAppenderClient(channel), new LogAppender(this.logService));
const commonProperties = resolveCommonProperties(product.commit, pkg.version, machineId, product.msftInternalDomains, this.environmentService.installSourcePath);
const commonProperties = resolveCommonProperties(product.commit, product.version, machineId, product.msftInternalDomains, this.environmentService.installSourcePath);
const piiPaths = this.environmentService.extensionsPath ? [this.environmentService.appRoot, this.environmentService.extensionsPath] : [this.environmentService.appRoot];
const config: ITelemetryServiceConfig = { appender, commonProperties, piiPaths, trueMachineId };

Expand Down
3 changes: 1 addition & 2 deletions src/vs/code/electron-main/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { IThemeMainService } from 'vs/platform/theme/electron-main/themeMainServ
import { endsWith } from 'vs/base/common/strings';
import { RunOnceScheduler } from 'vs/base/common/async';
import { IFileService } from 'vs/platform/files/common/files';
import pkg from 'vs/platform/product/node/package';

const RUN_TEXTMATE_IN_WORKER = false;

Expand Down Expand Up @@ -310,7 +309,7 @@ export class CodeWindow extends Disposable implements ICodeWindow {
private handleMarketplaceRequests(): void {

// Resolve marketplace headers
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(pkg.version, this.environmentService, this.fileService);
this.marketplaceHeadersPromise = resolveMarketplaceHeaders(product.version, this.environmentService, this.fileService);

// Inject headers when requests are incoming
const urls = ['https://marketplace.visualstudio.com/*', 'https://*.vsassets.io/*'];
Expand Down
5 changes: 2 additions & 3 deletions src/vs/code/node/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { buildHelpMessage, buildVersionMessage, addArg, createWaitMarkerFile, OP
import { parseCLIProcessArgv } from 'vs/platform/environment/node/argvHelper';
import { ParsedArgs } from 'vs/platform/environment/common/environment';
import product from 'vs/platform/product/node/product';
import pkg from 'vs/platform/product/node/package';
import * as paths from 'vs/base/common/path';
import * as os from 'os';
import * as fs from 'fs';
Expand Down Expand Up @@ -46,12 +45,12 @@ export async function main(argv: string[]): Promise<any> {
// Help
if (args.help) {
const executable = `${product.applicationName}${os.platform() === 'win32' ? '.exe' : ''}`;
console.log(buildHelpMessage(product.nameLong, executable, pkg.version, OPTIONS));
console.log(buildHelpMessage(product.nameLong, executable, product.version, OPTIONS));
}

// Version Info
else if (args.version) {
console.log(buildVersionMessage(pkg.version, product.commit));
console.log(buildVersionMessage(product.version, product.commit));
}

// Extensions Management
Expand Down
3 changes: 1 addition & 2 deletions src/vs/code/node/cliProcessMain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import { localize } from 'vs/nls';
import product from 'vs/platform/product/node/product';
import pkg from 'vs/platform/product/node/package';
import * as path from 'vs/base/common/path';
import * as semver from 'semver-umd';

Expand Down Expand Up @@ -350,7 +349,7 @@ export async function main(argv: ParsedArgs): Promise<void> {

const config: ITelemetryServiceConfig = {
appender: combinedAppender(...appenders),
commonProperties: resolveCommonProperties(product.commit, pkg.version, stateService.getItem('telemetry.machineId'), product.msftInternalDomains, installSourcePath),
commonProperties: resolveCommonProperties(product.commit, product.version, stateService.getItem('telemetry.machineId'), product.msftInternalDomains, installSourcePath),
piiPaths: extensionsPath ? [appRoot, extensionsPath] : [appRoot]
};

Expand Down
3 changes: 1 addition & 2 deletions src/vs/platform/diagnostics/node/diagnosticsService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { join, basename } from 'vs/base/common/path';
import { parse, ParseError } from 'vs/base/common/json';
import { listProcesses } from 'vs/base/node/ps';
import product from 'vs/platform/product/node/product';
import pkg from 'vs/platform/product/node/package';
import { repeat, pad } from 'vs/base/common/strings';
import { isWindows } from 'vs/base/common/platform';
import { URI } from 'vs/base/common/uri';
Expand Down Expand Up @@ -267,7 +266,7 @@ export class DiagnosticsService implements IDiagnosticsService {
const GB = 1024 * MB;

const output: string[] = [];
output.push(`Version: ${pkg.name} ${pkg.version} (${product.commit || 'Commit unknown'}, ${product.date || 'Date unknown'})`);
output.push(`Version: ${product.nameShort} ${product.version} (${product.commit || 'Commit unknown'}, ${product.date || 'Date unknown'})`);
output.push(`OS Version: ${osLib.type()} ${osLib.arch()} ${osLib.release()}`);
const cpus = osLib.cpus();
if (cpus && cpus.length > 0) {
Expand Down
7 changes: 3 additions & 4 deletions src/vs/platform/environment/node/environmentService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import * as os from 'os';
import * as path from 'vs/base/common/path';
import * as resources from 'vs/base/common/resources';
import { memoize } from 'vs/base/common/decorators';
import pkg from 'vs/platform/product/node/package';
import product from 'vs/platform/product/node/product';
import { toLocalISOString } from 'vs/base/common/date';
import { isWindows, isLinux } from 'vs/base/common/platform';
Expand All @@ -26,16 +25,16 @@ function getNixIPCHandle(userDataPath: string, type: string): string {

if (xdgRuntimeDir && !vscodePortable) {
const scope = crypto.createHash('md5').update(userDataPath).digest('hex').substr(0, 8);
return path.join(xdgRuntimeDir, `vscode-${scope}-${pkg.version}-${type}.sock`);
return path.join(xdgRuntimeDir, `vscode-${scope}-${product.version}-${type}.sock`);
}

return path.join(userDataPath, `${pkg.version}-${type}.sock`);
return path.join(userDataPath, `${product.version}-${type}.sock`);
}

function getWin32IPCHandle(userDataPath: string, type: string): string {
const scope = crypto.createHash('md5').update(userDataPath).digest('hex');

return `\\\\.\\pipe\\${scope}-${pkg.version}-${type}-sock`;
return `\\\\.\\pipe\\${scope}-${product.version}-${type}-sock`;
}

function getIPCHandle(userDataPath: string, type: string): string {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Limiter, createCancelablePromise, CancelablePromise, Queue } from 'vs/b
import { Event, Emitter } from 'vs/base/common/event';
import * as semver from 'semver-umd';
import { URI } from 'vs/base/common/uri';
import pkg from 'vs/platform/product/node/package';
import product from 'vs/platform/product/node/product';
import { isMacintosh, isWindows } from 'vs/base/common/platform';
import { ILogService } from 'vs/platform/log/common/log';
import { ExtensionsManifestCache } from 'vs/platform/extensionManagement/node/extensionsManifestCache';
Expand Down Expand Up @@ -203,8 +203,8 @@ export class ExtensionManagementService extends Disposable implements IExtension
.then(manifest => {
const identifier = { id: getGalleryExtensionId(manifest.publisher, manifest.name) };
let operation: InstallOperation = InstallOperation.Install;
if (manifest.engines && manifest.engines.vscode && !isEngineValid(manifest.engines.vscode, pkg.version)) {
return Promise.reject(new Error(nls.localize('incompatible', "Unable to install extension '{0}' as it is not compatible with VS Code '{1}'.", identifier.id, pkg.version)));
if (manifest.engines && manifest.engines.vscode && !isEngineValid(manifest.engines.vscode, product.version)) {
return Promise.reject(new Error(nls.localize('incompatible', "Unable to install extension '{0}' as it is not compatible with VS Code '{1}'.", identifier.id, product.version)));
}
const identifierWithVersion = new ExtensionIdentifierWithVersion(identifier, manifest.version);
return this.getInstalled(ExtensionType.User)
Expand Down Expand Up @@ -356,7 +356,7 @@ export class ExtensionManagementService extends Disposable implements IExtension
const compatibleExtension = await this.galleryService.getCompatibleExtension(extension);

if (!compatibleExtension) {
return Promise.reject(new ExtensionManagementError(nls.localize('notFoundCompatibleDependency', "Unable to install '{0}' extension because it is not compatible with the current version of VS Code (version {1}).", extension.identifier.id, pkg.version), INSTALL_ERROR_INCOMPATIBLE));
return Promise.reject(new ExtensionManagementError(nls.localize('notFoundCompatibleDependency', "Unable to install '{0}' extension because it is not compatible with the current version of VS Code (version {1}).", extension.identifier.id, product.version), INSTALL_ERROR_INCOMPATIBLE));
}

return compatibleExtension;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { FileService } from 'vs/platform/files/common/fileService';
import { NullLogService } from 'vs/platform/log/common/log';
import { DiskFileSystemProvider } from 'vs/platform/files/node/diskFileSystemProvider';
import { Schemas } from 'vs/base/common/network';
import pkg from 'vs/platform/product/node/package';
import product from 'vs/platform/product/node/product';

suite('Extension Gallery Service', () => {
const parentDir = getRandomTestPath(os.tmpdir(), 'vsctests', 'extensiongalleryservice');
Expand Down Expand Up @@ -53,10 +53,10 @@ suite('Extension Gallery Service', () => {
const args = ['--user-data-dir', marketplaceHome];
const environmentService = new EnvironmentService(parseArgs(args, OPTIONS), process.execPath);

return resolveMarketplaceHeaders(pkg.version, environmentService, fileService).then(headers => {
return resolveMarketplaceHeaders(product.version, environmentService, fileService).then(headers => {
assert.ok(isUUID(headers['X-Market-User-Id']));

return resolveMarketplaceHeaders(pkg.version, environmentService, fileService).then(headers2 => {
return resolveMarketplaceHeaders(product.version, environmentService, fileService).then(headers2 => {
assert.equal(headers['X-Market-User-Id'], headers2['X-Market-User-Id']);
});
});
Expand Down
44 changes: 37 additions & 7 deletions src/vs/platform/product/browser/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,46 @@

import { IProductConfiguration } from 'vs/platform/product/common/product';
import { assign } from 'vs/base/common/objects';
import { isWeb } from 'vs/base/common/platform';
import * as path from 'vs/base/common/path';
import { getPathFromAmdModule } from 'vs/base/common/amd';
import { env } from 'vs/base/common/process';

// Built time configuration (do NOT modify)
const product = { /*BUILD->INSERT_PRODUCT_CONFIGURATION*/ } as IProductConfiguration;
let product: IProductConfiguration;
if (isWeb) {

// Built time configuration (do NOT modify)
product = { /*BUILD->INSERT_PRODUCT_CONFIGURATION*/ } as IProductConfiguration;

// Running out of sources
if (Object.keys(product).length === 0) {
assign(product, {
version: '1.39.0-dev',
nameLong: 'Visual Studio Code Web Dev',
nameShort: 'VSCode Web Dev'
});
}
} else {

// Obtain values from product.json and package.json
const rootPath = path.dirname(getPathFromAmdModule(require, ''));
const productJsonPath = path.join(rootPath, 'product.json');
const packageJsonPath = path.join(rootPath, 'package.json');

product = assign({}, require.__$__nodeRequire(productJsonPath) as IProductConfiguration);
const pkg = require.__$__nodeRequire(packageJsonPath) as { version: string; };

// Running out of sources
if (env['VSCODE_DEV']) {
assign(product, {
nameShort: `${product.nameShort} Dev`,
nameLong: `${product.nameLong} Dev`,
dataFolderName: `${product.dataFolderName}-dev`
});
}

// Running out of sources
if (Object.keys(product).length === 0) {
assign(product, {
version: '1.39.0-dev',
nameLong: 'Visual Studio Code Web Dev',
nameShort: 'VSCode Web Dev'
version: pkg.version
});
}

Expand Down
16 changes: 0 additions & 16 deletions src/vs/platform/product/node/package.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/vs/platform/product/node/product.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@
import * as path from 'vs/base/common/path';
import { getPathFromAmdModule } from 'vs/base/common/amd';
import { IProductConfiguration } from 'vs/platform/product/common/product';
import pkg from 'vs/platform/product/node/package';
import { assign } from 'vs/base/common/objects';

const rootPath = path.dirname(getPathFromAmdModule(require, ''));
const productJsonPath = path.join(rootPath, 'product.json');
const product = require.__$__nodeRequire(productJsonPath) as IProductConfiguration;
const product = assign({}, require.__$__nodeRequire(productJsonPath) as IProductConfiguration);

const packageJsonPath = path.join(rootPath, 'package.json');
const pkg = require.__$__nodeRequire(packageJsonPath) as { version: string; };

if (process.env['VSCODE_DEV']) {
assign(product, {
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/api/node/extHostTerminalService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/

import * as vscode from 'vscode';
import pkg from 'vs/platform/product/node/package';
import product from 'vs/platform/product/node/product';
import * as os from 'os';
import { URI, UriComponents } from 'vs/base/common/uri';
import * as platform from 'vs/base/common/platform';
Expand Down Expand Up @@ -181,7 +181,7 @@ export class ExtHostTerminalService extends BaseExtHostTerminalService {
envFromConfig,
this._variableResolver,
isWorkspaceShellAllowed,
pkg.version,
product.version,
terminalConfig.get<'auto' | 'off' | 'on'>('detectLocale', 'auto'),
baseEnv
);
Expand Down
8 changes: 3 additions & 5 deletions src/vs/workbench/browser/actions/developerActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { clamp } from 'vs/base/common/numbers';
import { KeyCode } from 'vs/base/common/keyCodes';
import { IConfigurationRegistry, Extensions as ConfigurationExtensions } from 'vs/platform/configuration/common/configurationRegistry';

export class InspectContextKeysAction extends Action {
class InspectContextKeysAction extends Action {

static readonly ID = 'workbench.action.inspectContextKeys';
static LABEL = nls.localize('inspect context keys', "Inspect Context Keys");
Expand Down Expand Up @@ -91,7 +91,7 @@ export class InspectContextKeysAction extends Action {
}
}

export class ToggleScreencastModeAction extends Action {
class ToggleScreencastModeAction extends Action {

static readonly ID = 'workbench.action.toggleScreencastMode';
static LABEL = nls.localize('toggle screencast mode', "Toggle Screencast Mode");
Expand Down Expand Up @@ -195,7 +195,7 @@ export class ToggleScreencastModeAction extends Action {
}
}

export class LogStorageAction extends Action {
class LogStorageAction extends Action {

static readonly ID = 'workbench.action.logStorage';
static LABEL = nls.localize({ key: 'logStorage', comment: ['A developer only action to log the contents of the storage for the current window.'] }, "Log Storage Database Contents");
Expand Down Expand Up @@ -224,8 +224,6 @@ registry.registerWorkbenchAction(new SyncActionDescriptor(InspectContextKeysActi
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleScreencastModeAction, ToggleScreencastModeAction.ID, ToggleScreencastModeAction.LABEL), 'Developer: Toggle Screencast Mode', developerCategory);
registry.registerWorkbenchAction(new SyncActionDescriptor(LogStorageAction, LogStorageAction.ID, LogStorageAction.LABEL), 'Developer: Log Storage Database Contents', developerCategory);

// --- Menu Registration

// Screencast Mode
const configurationRegistry = Registry.as<IConfigurationRegistry>(ConfigurationExtensions.Configuration);
configurationRegistry.registerConfiguration({
Expand Down
Loading

0 comments on commit 5e1179f

Please sign in to comment.