Skip to content
This repository has been archived by the owner on Dec 23, 2021. It is now read-only.

Venv Telemetry and Structure Refactoring #240

Merged
merged 5 commits into from
Mar 5, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,20 @@ export enum TelemetryEventName {
MICROBIT_PERFORMANCE_DEPLOY_DEVICE = "MICROBIT.PERFORMANCE.DEPLOY.DEVICE",
MICROBIT_PERFORMANCE_NEW_FILE = "MICROBIT.PERFORMANCE.NEW.FILE",
MICROBIT_PERFORMANCE_OPEN_SIMULATOR = "MICROBIT.PERFORMANCE.OPEN.SIMULATOR",

// Venv options
SETUP_VENV_CREATION_ERR = "SETUP.VENV.CREATION.ERR",
andreamah marked this conversation as resolved.
Show resolved Hide resolved
SETUP_NO_PIP = "SETUP.NO.PIP",
SETUP_DEP_INSTALL_FAIL = "SETUP.DEP.INSTALL.FAIL",
SETUP_AUTO_RESOLVE_PYTHON_PATH = "SETUP.AUTO.RESOLVE.PYTHON.PATH",
SETUP_NO_PYTHON_PATH = "SETUP.NO.PYTHON.PATH",
SETUP_DOWNLOAD_PYTHON = "SETUP.DOWNLOAD.PYTHON",
SETUP_INVALID_PYTHON_INTERPRETER_PATH = "SETUP.INVALID.PYTHON.INTERPRETER.PATH",
SETUP_INVALID_PYTHON_VER = "SETUP.INVALID.PYTHON.VER",
SETUP_INSTALL_VENV = "SETUP.INSTALL.VENV",
SETUP_ORIGINAL_INTERPRETER_DEP_INSTALL = "SETUP.ORIGINAL.INTERPRETER.DEP.INSTALL",
SETUP_HAS_VENV = "SETUP.HAS.VENV",
SETUP_NO_DEPS_INSTALLED = "SETUP.NO.DEPS.INSTALLED",
}
export const DEFAULT_DEVICE = CONSTANTS.DEVICE_NAME.CPX;

Expand Down
9 changes: 6 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import { SerialMonitor } from "./serialMonitor";
import { DebuggerCommunicationService } from "./service/debuggerCommunicationService";
import { MessagingService } from "./service/messagingService";
import { PopupService } from "./service/PopupService";
import { SetupService } from "./service/SetupService";
import { SimulatorDebugConfigurationProvider } from "./simulatorDebugConfigurationProvider";
import getPackageInfo from "./telemetry/getPackageInfo";
import TelemetryAI from "./telemetry/telemetryAI";
Expand All @@ -43,6 +44,7 @@ let inDebugMode: boolean = false;
let firstTimeClosed: boolean = true;
let shouldShowRunCodePopup: boolean = true;
const messagingService = new MessagingService();
let setupService: SetupService;
const debuggerCommunicationService = new DebuggerCommunicationService();

let currentActiveDevice: string = DEFAULT_DEVICE;
Expand Down Expand Up @@ -87,6 +89,7 @@ export async function activate(context: vscode.ExtensionContext) {
console.info(CONSTANTS.INFO.EXTENSION_ACTIVATED);

telemetryAI = new TelemetryAI(context);
setupService = new SetupService(telemetryAI);
let currentPanel: vscode.WebviewPanel | undefined;
let childProcess: cp.ChildProcess | undefined;
let messageListener: vscode.Disposable;
Expand All @@ -99,7 +102,7 @@ export async function activate(context: vscode.ExtensionContext) {
// doesn't trigger lint errors
updatePylintArgs(context);

pythonExecutablePath = await utils.setupEnv(context);
pythonExecutablePath = await setupService.setupEnv(context);

try {
utils.generateCPXConfig();
Expand Down Expand Up @@ -443,7 +446,7 @@ export async function activate(context: vscode.ExtensionContext) {
const installDependencies: vscode.Disposable = vscode.commands.registerCommand(
"deviceSimulatorExpress.common.installDependencies",
async () => {
pythonExecutablePath = await utils.setupEnv(context, true);
pythonExecutablePath = await setupService.setupEnv(context, true);
telemetryAI.trackFeatureUsage(
TelemetryEventName.COMMAND_INSTALL_EXTENSION_DEPENDENCIES
);
Expand Down Expand Up @@ -1028,7 +1031,7 @@ export async function activate(context: vscode.ExtensionContext) {
const configsChanged = vscode.workspace.onDidChangeConfiguration(
async () => {
if (utils.checkConfig(CONFIG.CONFIG_ENV_ON_SWITCH)) {
pythonExecutablePath = await utils.setupEnv(context);
pythonExecutablePath = await setupService.setupEnv(context);
}
}
);
Expand Down
Loading