<commit_before>import { ProgressLocation, window } from "vscode";
import { initializingFlutterMessage, noAction, yesAction } from "../../shared/constants";
import { LogCategory } from "../../shared/enums";
import { Logger } from "../../shared/interfaces";
import { logProcess } from "../../shared/logging";
import { safeToolSpawn } from "../utils/processes";

export async function initializeFlutterSdk(logger: Logger, flutterScript: string, promptText?: string): Promise<void> {
	const selectedItem = promptText ? await window.showInformationMessage(promptText, yesAction, noAction) : yesAction;
	if (selectedItem === yesAction) {
		logger.info(`Flutter is not initialized, running 'flutter config --machine'...`);
		await window.withProgress(
			{
				location: ProgressLocation.Notification,
				title: initializingFlutterMessage,
			},
			async (progress, cancellationToken) => {
				const proc = safeToolSpawn(undefined, flutterScript, ["config", "--machine"]);
				cancellationToken.onCancellationRequested((e) => {
					logger.info(`User canceled!`);
					proc.kill();
				});
				logProcess(logger, LogCategory.CommandProcesses, proc);
				return new Promise((resolve, reject) => proc.on("exit", (code) => {
					if (code) {
						logger.error(`Failed to initialize Flutter: Process exited with code ${code}.`);
						window.showErrorMessage(`Failed to initialize Flutter: Process exited with code ${code}.`);
						reject();
					} else
						resolve();
				}));
			},
		);
		logger.info(`Flutter initialized!`);
	}
}<commit_msg>Log Flutter initialization to main log file<commit_after>import { ProgressLocation, window } from "vscode";
import { initializingFlutterMessage, noAction, yesAction } from "../../shared/constants";
import { LogCategory } from "../../shared/enums";
import { Logger } from "../../shared/interfaces";
import { logProcess } from "../../shared/logging";
import { safeToolSpawn } from "../utils/processes";

export async function initializeFlutterSdk(logger: Logger, flutterScript: string, promptText?: string): Promise<void> {
	const selectedItem = promptText ? await window.showInformationMessage(promptText, yesAction, noAction) : yesAction;
	if (selectedItem === yesAction) {
		logger.info(`Flutter is not initialized, running 'flutter config --machine'...`);
		await window.withProgress(
			{
				location: ProgressLocation.Notification,
				title: initializingFlutterMessage,
			},
			async (progress, cancellationToken) => {
				const proc = safeToolSpawn(undefined, flutterScript, ["config", "--machine"]);
				cancellationToken.onCancellationRequested((e) => {
					logger.info(`User canceled!`);
					proc.kill();
				});
				// Log this to general as it's startup stuff that can't be captured with
				// Capture Logs so log it to the main log file.
				logProcess(logger, LogCategory.General, proc);
				return new Promise((resolve, reject) => proc.on("exit", (code) => {
					if (code) {
						logger.error(`Failed to initialize Flutter: Process exited with code ${code}.`);
						window.showErrorMessage(`Failed to initialize Flutter: Process exited with code ${code}.`);
						reject();
					} else
						resolve();
				}));
			},
		);
		logger.info(`Flutter initialized!`);
	}
}
{'fraction_non_alphanumeric': 0.14600123992560446, 'fraction_numerical': 0.0, 'mean_word_length': 4.050078247261346, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1335133', 'n_tokens_mistral': 1028, 'n_tokens_neox': 896, 'n_words': 247}