Skip to content

Commit

Permalink
Switch to shared telemetry (#350)
Browse files Browse the repository at this point in the history
* Switch to shared registerCommand

* Updates
  • Loading branch information
StephenWeatherford authored Aug 5, 2018
1 parent 084db32 commit dd99658
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 37 deletions.
72 changes: 38 additions & 34 deletions dockerExtension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import * as opn from 'opn';
import * as path from 'path';
import * as vscode from 'vscode';
import { AzureUserInput, createTelemetryReporter, registerUIExtensionVariables } from 'vscode-azureextensionui';
import { AzureUserInput, createTelemetryReporter, registerCommand, registerUIExtensionVariables } from 'vscode-azureextensionui';
import { ConfigurationParams, DidChangeConfigurationNotification, DocumentSelector, LanguageClient, LanguageClientOptions, Middleware, ServerOptions, TransportKind } from 'vscode-languageclient';
import { buildImage } from './commands/build-image';
import { composeDown, composeRestart, composeUp } from './commands/docker-compose';
Expand Down Expand Up @@ -66,8 +66,16 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
const outputChannel = util.getOutputChannel();
let azureAccount: AzureAccount;

// This allows for standard interactions with the end user (as opposed to test input)
ext.ui = new AzureUserInput(ctx.globalState);
// Set up extension variables
if (!ext.ui) {
// This allows for standard interactions with the end user (as opposed to test input)
ext.ui = new AzureUserInput(ctx.globalState);
}
ext.context = ctx;
registerUIExtensionVariables(ext);

initializeTelemetryReporter(createTelemetryReporter(ctx));
ext.reporter = reporter;

// tslint:disable-next-line:prefer-for-of // Grandfathered in
for (let i = 0; i < installedExtensions.length; i++) {
Expand All @@ -82,13 +90,9 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
}
}

registerUIExtensionVariables(ext);
initializeTelemetryReporter(createTelemetryReporter(ctx));
ext.reporter = reporter;

dockerExplorerProvider = new DockerExplorerProvider(azureAccount);
vscode.window.registerTreeDataProvider('dockerExplorer', dockerExplorerProvider);
vscode.commands.registerCommand('vscode-docker.explorer.refresh', () => dockerExplorerProvider.refresh());
registerCommand('vscode-docker.explorer.refresh', () => dockerExplorerProvider.refresh());

ctx.subscriptions.push(vscode.languages.registerCompletionItemProvider(DOCUMENT_SELECTOR, new DockerfileCompletionItemProvider(), '.'));

Expand All @@ -99,26 +103,26 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {

ctx.subscriptions.push(vscode.workspace.registerTextDocumentContentProvider(DOCKER_INSPECT_SCHEME, new DockerInspectDocumentContentProvider()));

ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.configure', configure));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.build', buildImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.inspect', inspectImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.remove', removeImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.push', pushImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.image.tag', tagImage));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.start', startContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.start.interactive', startContainerInteractive));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.start.azurecli', startAzureCLI));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.stop', stopContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.restart', restartContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.show-logs', showLogsContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.open-shell', openShellContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.container.remove', removeContainer));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.compose.up', composeUp));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.compose.down', composeDown));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.compose.restart', composeRestart));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.system.prune', systemPrune));

ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.createWebApp', async (context?: AzureImageNode | DockerHubImageNode) => {
registerCommand('vscode-docker.configure', configure);
registerCommand('vscode-docker.image.build', buildImage);
registerCommand('vscode-docker.image.inspect', inspectImage);
registerCommand('vscode-docker.image.remove', removeImage);
registerCommand('vscode-docker.image.push', pushImage);
registerCommand('vscode-docker.image.tag', tagImage);
registerCommand('vscode-docker.container.start', startContainer);
registerCommand('vscode-docker.container.start.interactive', startContainerInteractive);
registerCommand('vscode-docker.container.start.azurecli', startAzureCLI);
registerCommand('vscode-docker.container.stop', stopContainer);
registerCommand('vscode-docker.container.restart', restartContainer);
registerCommand('vscode-docker.container.show-logs', showLogsContainer);
registerCommand('vscode-docker.container.open-shell', openShellContainer);
registerCommand('vscode-docker.container.remove', removeContainer);
registerCommand('vscode-docker.compose.up', composeUp);
registerCommand('vscode-docker.compose.down', composeDown);
registerCommand('vscode-docker.compose.restart', composeRestart);
registerCommand('vscode-docker.system.prune', systemPrune);

registerCommand('vscode-docker.createWebApp', async (context?: AzureImageNode | DockerHubImageNode) => {
if (context) {
if (azureAccount) {
const azureAccountWrapper = new AzureAccountWrapper(ctx, azureAccount);
Expand All @@ -132,15 +136,15 @@ export async function activate(ctx: vscode.ExtensionContext): Promise<void> {
}
}
}
}));
});

ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.dockerHubLogout', dockerHubLogout));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.browseDockerHub', (context?: DockerHubImageNode | DockerHubRepositoryNode | DockerHubOrgNode) => {
registerCommand('vscode-docker.dockerHubLogout', dockerHubLogout);
registerCommand('vscode-docker.browseDockerHub', (context?: DockerHubImageNode | DockerHubRepositoryNode | DockerHubOrgNode) => {
browseDockerHub(context);
}));
ctx.subscriptions.push(vscode.commands.registerCommand('vscode-docker.browseAzurePortal', (context?: AzureRegistryNode | AzureRepositoryNode | AzureImageNode) => {
});
registerCommand('vscode-docker.browseAzurePortal', (context?: AzureRegistryNode | AzureRepositoryNode | AzureImageNode) => {
browseAzurePortal(context);
}));
});

ctx.subscriptions.push(vscode.debug.registerDebugConfigurationProvider('docker', new DockerDebugConfigProvider()));

Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -677,8 +677,8 @@
"opn": "^5.1.0",
"pom-parser": "^1.1.1",
"request-promise": "^4.2.2",
"vscode-azureextensionui": "^0.16.5",
"vscode-extension-telemetry": "^0.0.6",
"vscode-languageclient": "4.4.0"
"vscode-azureextensionui": "^0.16.6",
"vscode-extension-telemetry": "0.0.18",
"vscode-languageclient": "^4.4.0"
}
}

0 comments on commit dd99658

Please sign in to comment.