"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.deactivate = exports.activate = void 0; const vscode = require("vscode"); const path = require("path"); const project_1 = require("./project"); function activate(context) { return __awaiter(this, void 0, void 0, function* () { let NEXT_TERM_ID = 1; const project = new project_1.Project(context); const createHyperCProjectCommand = vscode.commands.registerCommand('extension.createHyperCProject', () => { project.createProject('hyperc') .catch(error => console.log(error)); }); context.subscriptions.push(createHyperCProjectCommand); context.subscriptions.push(vscode.commands.registerCommand('extension.HyperCGenerateClass', () => { const terminal = vscode.window.createTerminal(`HyperC#${NEXT_TERM_ID++}`); terminal.sendText("if [ -f venv.tar.bz2 ]; then tar xvf venv.tar.bz2 && tar xvf pypy3.tar.bz2 && rm pypy3.tar.bz2 && rm venv.tar.bz2; fi && ./.venv/bin/python3 -m hyper_etable.runpy genclass main.xlsx"); })); context.subscriptions.push(vscode.commands.registerCommand('extension.HyperCOpenClasses', () => { vscode.workspace.openTextDocument(path.join("xlsx_to_py", 'classes.py')) .then(doc => vscode.window.showTextDocument(doc, { preview: false })); })); context.subscriptions.push(vscode.commands.registerCommand('extension.HyperCOpenOutput', () => { const xmlExtension = vscode.extensions.getExtension('GrapeCity.gc-excelviewer'); if (!xmlExtension) return; if (!vscode.workspace) return; if (!vscode.workspace.workspaceFolders) return; // is the ext loaded and ready? if (xmlExtension.isActive == false) { xmlExtension.activate().then(function () { console.log("Extension activated"); // comment next line out for release // findCommand(); if (!vscode.workspace) return; if (!vscode.workspace.workspaceFolders) return; vscode.commands.executeCommand("excel.preview", vscode.Uri.file(vscode.workspace.workspaceFolders[0].uri.path + "/out/main.xlsx")); }, function () { console.log("Extension activation failed"); }); } else { vscode.commands.executeCommand("excel.preview", vscode.Uri.file(vscode.workspace.workspaceFolders[0].uri.path + "/out/main.xlsx")); } })); context.subscriptions.push(vscode.commands.registerCommand('extension.HyperCOpenInput', () => { const xmlExtension = vscode.extensions.getExtension('GrapeCity.gc-excelviewer'); if (!xmlExtension) return; if (!vscode.workspace) return; if (!vscode.workspace.workspaceFolders) return; // is the ext loaded and ready? if (xmlExtension.isActive == false) { xmlExtension.activate().then(function () { console.log("Extension activated"); // comment next line out for release // findCommand(); if (!vscode.workspace) return; if (!vscode.workspace.workspaceFolders) return; vscode.commands.executeCommand("excel.preview", vscode.Uri.file(vscode.workspace.workspaceFolders[0].uri.path + "/main.xlsx")); }, function () { console.log("Extension activation failed"); }); } else { vscode.commands.executeCommand("excel.preview", vscode.Uri.file(vscode.workspace.workspaceFolders[0].uri.path + "/main.xlsx")); } })); context.subscriptions.push(vscode.commands.registerCommand('extension.HyperCEditModel', () => { if (!vscode.workspace) return; if (!vscode.workspace.workspaceFolders) return; vscode.workspace.openTextDocument(path.join(vscode.workspace.workspaceFolders[0].uri.path, 'main.py')) .then(doc => vscode.window.showTextDocument(doc, { preview: false })); })); }); } exports.activate = activate; function deactivate() { } exports.deactivate = deactivate; //# sourceMappingURL=extension.js.map