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

Commit 66fde0f

Browse files
committed
Update with dev
2 parents de43ea6 + b8fcf43 commit 66fde0f

File tree

4 files changed

+527
-427
lines changed

4 files changed

+527
-427
lines changed

src/constants.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,20 @@ export enum TelemetryEventName {
374374
MICROBIT_PERFORMANCE_DEPLOY_DEVICE = "MICROBIT.PERFORMANCE.DEPLOY.DEVICE",
375375
MICROBIT_PERFORMANCE_NEW_FILE = "MICROBIT.PERFORMANCE.NEW.FILE",
376376
MICROBIT_PERFORMANCE_OPEN_SIMULATOR = "MICROBIT.PERFORMANCE.OPEN.SIMULATOR",
377+
378+
// Venv options
379+
SETUP_VENV_CREATION_ERR = "SETUP.VENV.CREATION.ERR",
380+
SETUP_NO_PIP = "SETUP.NO.PIP",
381+
SETUP_DEP_INSTALL_FAIL = "SETUP.DEP.INSTALL.FAIL",
382+
SETUP_AUTO_RESOLVE_PYTHON_PATH = "SETUP.AUTO.RESOLVE.PYTHON.PATH",
383+
SETUP_NO_PYTHON_PATH = "SETUP.NO.PYTHON.PATH",
384+
SETUP_DOWNLOAD_PYTHON = "SETUP.DOWNLOAD.PYTHON",
385+
SETUP_INVALID_PYTHON_INTERPRETER_PATH = "SETUP.INVALID.PYTHON.INTERPRETER.PATH",
386+
SETUP_INVALID_PYTHON_VER = "SETUP.INVALID.PYTHON.VER",
387+
SETUP_INSTALL_VENV = "SETUP.INSTALL.VENV",
388+
SETUP_ORIGINAL_INTERPRETER_DEP_INSTALL = "SETUP.ORIGINAL.INTERPRETER.DEP.INSTALL",
389+
SETUP_HAS_VENV = "SETUP.HAS.VENV",
390+
SETUP_NO_DEPS_INSTALLED = "SETUP.NO.DEPS.INSTALLED",
377391
}
378392
export const DEFAULT_DEVICE = CONSTANTS.DEVICE_NAME.CPX;
379393

src/extension.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { DeviceSelectionService } from "./service/deviceSelectionService";
3030
import { FileSelectionService } from "./service/fileSelectionService";
3131
import { MessagingService } from "./service/messagingService";
3232
import { PopupService } from "./service/PopupService";
33+
import { SetupService } from "./service/SetupService";
3334
import { SimulatorDebugConfigurationProvider } from "./simulatorDebugConfigurationProvider";
3435
import getPackageInfo from "./telemetry/getPackageInfo";
3536
import TelemetryAI from "./telemetry/telemetryAI";
@@ -44,6 +45,7 @@ let inDebugMode: boolean = false;
4445
let firstTimeClosed: boolean = true;
4546
let shouldShowRunCodePopup: boolean = true;
4647

48+
let setupService: SetupService;
4749
const deviceSelectionService = new DeviceSelectionService();
4850
const messagingService = new MessagingService(deviceSelectionService);
4951
const debuggerCommunicationService = new DebuggerCommunicationService();
@@ -72,6 +74,7 @@ export async function activate(context: vscode.ExtensionContext) {
7274
console.info(CONSTANTS.INFO.EXTENSION_ACTIVATED);
7375

7476
telemetryAI = new TelemetryAI(context);
77+
setupService = new SetupService(telemetryAI);
7578
let currentPanel: vscode.WebviewPanel | undefined;
7679
let childProcess: cp.ChildProcess | undefined;
7780
let messageListener: vscode.Disposable;
@@ -84,7 +87,7 @@ export async function activate(context: vscode.ExtensionContext) {
8487
// doesn't trigger lint errors
8588
updatePylintArgs(context);
8689

87-
pythonExecutablePath = await utils.setupEnv(context);
90+
pythonExecutablePath = await setupService.setupEnv(context);
8891

8992
try {
9093
utils.generateCPXConfig();
@@ -433,7 +436,7 @@ export async function activate(context: vscode.ExtensionContext) {
433436
const installDependencies: vscode.Disposable = vscode.commands.registerCommand(
434437
"deviceSimulatorExpress.common.installDependencies",
435438
async () => {
436-
pythonExecutablePath = await utils.setupEnv(context, true);
439+
pythonExecutablePath = await setupService.setupEnv(context, true);
437440
telemetryAI.trackFeatureUsage(
438441
TelemetryEventName.COMMAND_INSTALL_EXTENSION_DEPENDENCIES
439442
);
@@ -1020,7 +1023,7 @@ export async function activate(context: vscode.ExtensionContext) {
10201023
const configsChanged = vscode.workspace.onDidChangeConfiguration(
10211024
async () => {
10221025
if (utils.checkConfig(CONFIG.CONFIG_ENV_ON_SWITCH)) {
1023-
pythonExecutablePath = await utils.setupEnv(context);
1026+
pythonExecutablePath = await setupService.setupEnv(context);
10241027
}
10251028
}
10261029
);

0 commit comments

Comments
 (0)