Преглед на файлове

reformat: Use automatic formatter from vscode

Marcelo Fornet преди 5 години
родител
ревизия
53d9d61cbf
променени са 9 файла, в които са добавени 257 реда и са изтрити 256 реда
  1. 1 1
      src/companion.ts
  2. 7 7
      src/conn.ts
  3. 81 81
      src/core.ts
  4. 62 61
      src/extension.ts
  5. 3 3
      src/gwen.ts
  6. 17 17
      src/parsers/codeforces.ts
  7. 5 5
      src/parsers/util.ts
  8. 68 68
      src/test/extension.test.ts
  9. 13 13
      src/types.ts

+ 1 - 1
src/companion.ts

@@ -4,7 +4,7 @@ import { newProblemFromCompanion } from './core';
 const app = require('express')();
 const bodyParser = require('body-parser');
 
-export function startCompetitiveCompanionService(){
+export function startCompetitiveCompanionService() {
     let _port: number | undefined = vscode.workspace.getConfiguration('acmx.companion', null).get('port');
     let port: number = _port!;
 

+ 7 - 7
src/conn.ts

@@ -1,4 +1,4 @@
-import { SiteDescription, Contest, Problem } from "./types";
+import { Contest, Problem, SiteDescription } from "./types";
 // import { CODEFORCES } from "./parsers/codeforces";
 
 /**
@@ -17,7 +17,7 @@ export const PERSONAL = new SiteDescription(
         let problems = [];
 
         for (let i = 0; i < total; i++) {
-            problems.push(new Problem(`P${i+1}`, `P${i+1}`, ["0\n", "2\n", "9\n"], ["2\n", "4\n", "11\n"]));
+            problems.push(new Problem(`P${i + 1}`, `P${i + 1}`, ["0\n", "2\n", "9\n"], ["2\n", "4\n", "11\n"]));
         }
 
         return new Contest("personal", problems);
@@ -42,7 +42,7 @@ const EMPTY = new SiteDescription(
         // Where `problem-name` is current name and `10` is number of problems
         let args = problemId.split('-');
 
-        let numProblems =  args[args.length - 1];
+        let numProblems = args[args.length - 1];
         let total = Number.parseInt(numProblems);
 
         args.pop();
@@ -51,7 +51,7 @@ const EMPTY = new SiteDescription(
         let problems = [];
 
         for (let i = 0; i < total; i++) {
-            problems.push(new Problem(`P${i+1}`, `P${i+1}`, [], []));
+            problems.push(new Problem(`P${i + 1}`, `P${i + 1}`, [], []));
         }
 
         return new Contest(name, problems);
@@ -69,16 +69,16 @@ export const SITES: SiteDescription[] = [
     // CODEFORCES,
 ];
 
-export function getSite(site: string): SiteDescription  {
+export function getSite(site: string): SiteDescription {
     let result = undefined;
 
     SITES.forEach(siteDescription => {
-        if (siteDescription.name === site){
+        if (siteDescription.name === site) {
             result = siteDescription;
         }
     });
 
-    if (result !== undefined){
+    if (result !== undefined) {
         return result;
     }
 

+ 81 - 81
src/core.ts

@@ -1,11 +1,11 @@
 'use strict';
-import * as vscode from 'vscode';
-import { mkdirSync, existsSync, copyFileSync, openSync, readSync, readdirSync, writeSync, closeSync } from "fs";
-import { dirname, join, extname, basename } from "path";
 import * as child_process from 'child_process';
+import { closeSync, copyFileSync, existsSync, mkdirSync, openSync, readdirSync, readSync, writeSync } from "fs";
+import { basename, dirname, extname, join } from "path";
+import * as vscode from 'vscode';
 import * as gwen from './gwen';
-import { TestcaseResult, Verdict, SolutionResult, Problem, Contest, SiteDescription } from "./types";
 import { ceTerminal, stderrTerminal } from './terminal';
+import { Contest, Problem, SiteDescription, SolutionResult, TestcaseResult, Verdict } from "./types";
 const md5File = require('md5-file');
 
 export const TESTCASES = 'testcases';
@@ -15,13 +15,13 @@ export const SRC = dirname(__filename);
 /**
  * Name of program file. Take extension dynamically from configuration
  */
-export function solFile(){
-    let extension: string|undefined = vscode.workspace.getConfiguration('acmx.configuration', null).get('extension');
+export function solFile() {
+    let extension: string | undefined = vscode.workspace.getConfiguration('acmx.configuration', null).get('extension');
     return 'sol.' + extension;
 }
 
-export function getTimeout(){
-    let timeout: number|undefined = vscode.workspace.getConfiguration('acmx.run', null).get('timeLimit');
+export function getTimeout() {
+    let timeout: number | undefined = vscode.workspace.getConfiguration('acmx.run', null).get('timeLimit');
     timeout = timeout! * 1000;
     return timeout;
 }
@@ -29,16 +29,16 @@ export function getTimeout(){
 /**
  * Can only handle testcases of at most 512MB
  */
-function getMaxSizeInput(){
+function getMaxSizeInput() {
     return 512 * 1024;
 }
 
 function isProblemFolder(path: string) {
-    return  existsSync(join(path, solFile())) &&
-            existsSync(join(path, 'attic'));
+    return existsSync(join(path, solFile())) &&
+        existsSync(join(path, 'attic'));
 }
 
-function isTestcase(path: string){
+function isTestcase(path: string) {
     let ext = extname(path);
     return ext === '.in' || ext === '.out' || ext === '.real';
 }
@@ -47,18 +47,18 @@ export function currentTestcase() {
     let answer: string | undefined = undefined;
 
     // Try to find an open testcase
-    if (vscode.window.activeTextEditor){
+    if (vscode.window.activeTextEditor) {
         let path = vscode.window.activeTextEditor.document.uri.fsPath;
 
-        if (isTestcase(path)){
+        if (isTestcase(path)) {
             answer = removeExtension(basename(path));
         }
     }
 
     // Try to find the test case watching the current open workspace folder
-    if (vscode.workspace.workspaceFolders !== undefined){
-        vscode.workspace.workspaceFolders.forEach(function(fd){
-            if (answer === undefined && isTestcase(fd.uri.fsPath)){
+    if (vscode.workspace.workspaceFolders !== undefined) {
+        vscode.workspace.workspaceFolders.forEach(function (fd) {
+            if (answer === undefined && isTestcase(fd.uri.fsPath)) {
                 answer = removeExtension(basename(fd.uri.fsPath));
             }
         });
@@ -70,7 +70,7 @@ export function currentTestcase() {
 
 export function currentProblem() {
     // Try to find the problem using current open file
-    if (vscode.window.activeTextEditor){
+    if (vscode.window.activeTextEditor) {
         let path = vscode.window.activeTextEditor.document.uri.fsPath;
 
         const MAX_DEPTH = 3;
@@ -79,13 +79,13 @@ export function currentProblem() {
             path = dirname(path);
         }
 
-        if (isProblemFolder(path)){
+        if (isProblemFolder(path)) {
             return path;
         }
     }
 
     // Try to find the problem using the current open workspace folder
-    if (vscode.workspace.workspaceFolders !== undefined){
+    if (vscode.workspace.workspaceFolders !== undefined) {
         let path = vscode.workspace.workspaceFolders[0].uri.fsPath;
 
         const MAX_DEPTH = 1;
@@ -94,7 +94,7 @@ export function currentProblem() {
             path = dirname(path);
         }
 
-        if (isProblemFolder(path)){
+        if (isProblemFolder(path)) {
             return path;
         }
     }
@@ -103,8 +103,8 @@ export function currentProblem() {
     return undefined;
 }
 
-function createFolder(path: string){
-    if (!existsSync(path)){
+function createFolder(path: string) {
+    if (!existsSync(path)) {
         createFolder(dirname(path));
         mkdirSync(path);
     }
@@ -115,7 +115,7 @@ function createFolder(path: string){
  *
  * @param testingPath Use for unit tests
  */
-function globalAtticPath(testingPath: string | undefined = undefined){
+function globalAtticPath(testingPath: string | undefined = undefined) {
     let path: string | undefined = vscode.workspace.getConfiguration('acmx.configuration', null).get('solutionPath');
     return join(path!, ATTIC);
 }
@@ -123,7 +123,7 @@ function globalAtticPath(testingPath: string | undefined = undefined){
 /**
  * Create default environment that let acmX run properly
  */
-export function initAcmX(){
+export function initAcmX() {
     // Create global attic.
     let globalAttic = globalAtticPath();
     createFolder(globalAttic);
@@ -134,21 +134,21 @@ export function initAcmX(){
 
     // Copy testlib
     let testlib = 'testlib.h';
-    if (!existsSync(join(checkerFolder, testlib))){
+    if (!existsSync(join(checkerFolder, testlib))) {
         copyFileSync(join(SRC, 'static', 'checkers', testlib),
-                     join(checkerFolder, testlib));
+            join(checkerFolder, testlib));
     }
 
     // Create wcmp checker
     let checkerName = 'wcmp.cpp';
-    if (!existsSync(join(checkerFolder, checkerName))){
+    if (!existsSync(join(checkerFolder, checkerName))) {
         copyFileSync(join(SRC, 'static', 'checkers', checkerName),
-                     join(checkerFolder, checkerName));
+            join(checkerFolder, checkerName));
     }
 
     // Compile checker
     let compiledName = 'wcmp.exe';
-    if (!existsSync(join(checkerFolder, compiledName))){
+    if (!existsSync(join(checkerFolder, compiledName))) {
         let checkerPath = join(checkerFolder, checkerName);
         let compiledPath = join(checkerFolder, compiledName);
 
@@ -156,7 +156,7 @@ export function initAcmX(){
     }
 }
 
-export function newArena(path: string){
+export function newArena(path: string) {
     createFolder(path);
 
     let testcases = join(path, TESTCASES);
@@ -167,41 +167,41 @@ export function newArena(path: string){
 
     let templatePath: string | undefined = vscode.workspace.getConfiguration('acmx.configuration', null).get('templatePath');
 
-    if (templatePath! === ""){
+    if (templatePath! === "") {
         templatePath = join(SRC, 'static', 'template.cpp');
     }
 
     let solution = join(path, solFile());
 
-    if (!existsSync(solution)){
+    if (!existsSync(solution)) {
         copyFileSync(templatePath!, join(path, solFile()));
     }
 }
 
-export function removeExtension(name: string){
+export function removeExtension(name: string) {
     let split = name.split('.');
-    if (split.length === 0){
+    if (split.length === 0) {
         return name;
     }
-    else{
+    else {
         split.pop(); // drop extension
         return split.join('.');
     }
 }
 
-export function testcasesName(path: string){
+export function testcasesName(path: string) {
     return readdirSync(join(path, TESTCASES)).
-            filter( function (tcpath) {
-                return extname(tcpath) === '.in';
-            }).
-            map( function(tcpath) { return removeExtension(tcpath); });
+        filter(function (tcpath) {
+            return extname(tcpath) === '.in';
+        }).
+        map(function (tcpath) { return removeExtension(tcpath); });
 }
 
 export function upgradeArena(path: string) {
     // Create brute force solution
     let brute = join(path, 'brute.cpp');
 
-    if (!existsSync(brute)){
+    if (!existsSync(brute)) {
         // Create brute.cpp file
         copyFileSync(join(SRC, 'static', 'template.cpp'), brute);
     }
@@ -209,7 +209,7 @@ export function upgradeArena(path: string) {
     // Create test case generator
     let generator = join(path, 'gen.py');
 
-    if (!existsSync(generator)){
+    if (!existsSync(generator)) {
         // TODO: If generator already exist ask whether to overwrite or not.
         gwen.create(path, generator);
     }
@@ -217,14 +217,14 @@ export function upgradeArena(path: string) {
     // Create checker for multiple answers.
     let checker = join(path, ATTIC, 'checker.cpp');
 
-    if (!existsSync(checker)){
+    if (!existsSync(checker)) {
         let testlib_path = join(path, ATTIC, 'testlib.h');
         copyFileSync(join(SRC, 'static', 'checkers', 'wcmp.cpp'), checker);
         copyFileSync(join(SRC, 'static', 'checkers', 'testlib.h'), testlib_path);
     }
 }
 
-function newProblem(path: string, problem: Problem){
+function newProblem(path: string, problem: Problem) {
     newArena(path);
 
     problem.inputs!.forEach((value, index) => {
@@ -238,7 +238,7 @@ function newProblem(path: string, problem: Problem){
     });
 }
 
-export async function newProblemFromId(path: string, site: SiteDescription, problemId: string){
+export async function newProblemFromId(path: string, site: SiteDescription, problemId: string) {
     let problem = await site.problemParser(problemId);
 
     path = join(path, problem.identifier!);
@@ -248,13 +248,13 @@ export async function newProblemFromId(path: string, site: SiteDescription, prob
     return path;
 }
 
-function newContest(path: string, contest: Contest){
+function newContest(path: string, contest: Contest) {
     contest.problems!.forEach(problem => {
         newProblem(join(path, problem.identifier!), problem);
     });
 }
 
-export function newProblemFromCompanion(config: any){
+export function newProblemFromCompanion(config: any) {
     console.log(config);
 
     let _path: string | undefined = vscode.workspace.getConfiguration('acmx.configuration', null).get('solutionPath');
@@ -267,7 +267,7 @@ export function newProblemFromCompanion(config: any){
     let inputs: string[] = [];
     let outputs: string[] = [];
 
-    config.tests.forEach(function(testcase: any){
+    config.tests.forEach(function (testcase: any) {
         inputs.push(testcase.input);
         outputs.push(testcase.output);
     });
@@ -282,7 +282,7 @@ export function newProblemFromCompanion(config: any){
  *
  * @param contestId Id of the contest that user want to retrieve.
  */
-export async function newContestFromId(path: string, site: SiteDescription, contestId: string){
+export async function newContestFromId(path: string, site: SiteDescription, contestId: string) {
     let contest = await site.contestParser(contestId);
     let contestPath = join(path, site.name, contest.name);
 
@@ -317,7 +317,7 @@ function get_checker_path() {
  * @param tcName
  * @param timeout in miliseconds
  */
-export function timedRun(path: string, tcName: string, timeout: number){
+export function timedRun(path: string, tcName: string, timeout: number) {
     let tcInput = join(path, TESTCASES, `${tcName}.in`);
     let tcOutput = join(path, TESTCASES, `${tcName}.out`);
     let tcCurrent = join(path, TESTCASES, `${tcName}.real`);
@@ -350,11 +350,11 @@ export function timedRun(path: string, tcName: string, timeout: number){
     }
 
     // Check if an error happened
-    if (xresult.status !== 0){
-        if (spanTime < timeout){
+    if (xresult.status !== 0) {
+        if (spanTime < timeout) {
             return new TestcaseResult(Verdict.RTE);
         }
-        else{
+        else {
             return new TestcaseResult(Verdict.TLE);
         }
     }
@@ -367,10 +367,10 @@ export function timedRun(path: string, tcName: string, timeout: number){
     let checker_path = get_checker_path();
     let checker_result = child_process.spawnSync(checker_path, [tcInput, tcCurrent, tcOutput]);
 
-    if (checker_result.status !== 0){
+    if (checker_result.status !== 0) {
         return new TestcaseResult(Verdict.WA);
     }
-    else{
+    else {
         return new TestcaseResult(Verdict.OK, spanTime);
     }
 }
@@ -382,7 +382,7 @@ function escape_double_ticks(text: string) {
     return text;
 }
 
-export function compileCode(pathCode: string, pathOutput: string){
+export function compileCode(pathCode: string, pathOutput: string) {
     let pathCodeMD5 = pathCode + '.md5';
     let md5data = "";
 
@@ -398,7 +398,7 @@ export function compileCode(pathCode: string, pathOutput: string){
 
     if (codeMD5 === md5data) {
         return {
-            'status' : 0
+            'status': 0
         };
     }
 
@@ -409,14 +409,14 @@ export function compileCode(pathCode: string, pathOutput: string){
     let instruction: string | undefined = vscode.workspace.getConfiguration('acmx.execution', null).get('compile');
     let splitedInstruction = instruction!.split(' ');
 
-    for (let i = 0; i < splitedInstruction.length; ++i){
+    for (let i = 0; i < splitedInstruction.length; ++i) {
         splitedInstruction[i] = splitedInstruction[i].replace('$PROGRAM', pathCode).replace('$OUTPUT', pathOutput);
     }
 
     let program = splitedInstruction[0];
     let args = splitedInstruction.slice(1);
 
-    let result =  child_process.spawnSync(program, args);
+    let result = child_process.spawnSync(program, args);
 
     if (result.status !== 0) {
         // Write to the compile error terminal
@@ -429,24 +429,24 @@ export function compileCode(pathCode: string, pathOutput: string){
     return result;
 }
 
-export function testSolution(path: string){
+export function testSolution(path: string) {
     let sol = join(path, solFile());
     let out = join(path, ATTIC, 'sol.exe');
 
-    if (!existsSync(sol)){
+    if (!existsSync(sol)) {
         throw new Error("Open a coding environment first.");
     }
 
     // Compile solution
     let xresult = compileCode(sol, out);
 
-    if (xresult.status !== 0){
+    if (xresult.status !== 0) {
         throw new Error(`Compilation Error. ${sol}`);
     }
 
     let testcasesId = testcasesName(path);
 
-    if (testcasesId.length === 0){
+    if (testcasesId.length === 0) {
         return new SolutionResult(Verdict.NO_TESTCASES, undefined, undefined);
     }
 
@@ -456,7 +456,7 @@ export function testSolution(path: string){
     // Run current test case first (if it exists)
     let startTc = currentTestcase();
 
-    if (startTc !== undefined){
+    if (startTc !== undefined) {
         testcasesId = testcasesId.reverse().filter(name => name !== startTc);
         testcasesId.push(startTc);
         testcasesId = testcasesId.reverse();
@@ -466,31 +466,31 @@ export function testSolution(path: string){
     let fail: SolutionResult | undefined = undefined;
     testcasesId.forEach(tcId => {
         // Run while there none have failed already
-        if (fail === undefined){
+        if (fail === undefined) {
             let tcResult = timedRun(path, tcId, getTimeout());
-            if (tcResult.status !== Verdict.OK){
+            if (tcResult.status !== Verdict.OK) {
                 fail = new SolutionResult(tcResult.status, tcId);
             }
             results.push(tcResult);
         }
     });
 
-    if (fail === undefined){
+    if (fail === undefined) {
         let maxTime = 0;
-        for (let i = 0; i < results.length; i++){
-            if (results[i].spanTime! > maxTime){
+        for (let i = 0; i < results.length; i++) {
+            if (results[i].spanTime! > maxTime) {
                 maxTime = results[i].spanTime!;
             }
         }
 
         return new SolutionResult(Verdict.OK, undefined, maxTime);
     }
-    else{
+    else {
         return fail;
     }
 }
 
-function generateTestcase(path: string){
+function generateTestcase(path: string) {
     let python: string | undefined = vscode.workspace.getConfiguration('acmx.execution', null).get('pythonPath');
     let genResult = child_process.spawnSync(python!, [join(path, 'gen.py')]);
 
@@ -499,28 +499,28 @@ function generateTestcase(path: string){
     closeSync(currentFd);
 }
 
-export function stressSolution(path: string, times: number){
+export function stressSolution(path: string, times: number) {
     let sol = join(path, solFile());
     let out = join(path, ATTIC, 'sol');
     let brute = join(path, 'brute.cpp');
 
-    if (!existsSync(sol)){
+    if (!existsSync(sol)) {
         throw new Error("Open a coding environment first.");
     }
 
-    if (!existsSync(brute)){
+    if (!existsSync(brute)) {
         throw new Error("Upgrade environment first.");
     }
 
     let brout = join(path, ATTIC, 'brout.exe');
 
     let solCompileResult = compileCode(sol, out);
-    if (solCompileResult.status !== 0){
+    if (solCompileResult.status !== 0) {
         throw new Error(`Compilation Error. ${sol}`);
     }
 
     let bruteCompileResult = compileCode(brute, brout);
-    if (bruteCompileResult.status !== 0){
+    if (bruteCompileResult.status !== 0) {
         throw new Error(`Compilation Error. ${brute}`);
     }
 
@@ -551,7 +551,7 @@ export function stressSolution(path: string, times: number){
         // Check sol report same result than brute
         let result = timedRun(path, 'gen', getTimeout());
 
-        if (result.status !== Verdict.OK){
+        if (result.status !== Verdict.OK) {
             return new SolutionResult(result.status, 'gen');
         }
 
@@ -559,8 +559,8 @@ export function stressSolution(path: string, times: number){
     }
 
     let maxTime = 0;
-    for (let i = 0; i < results.length; i++){
-        if (results[i].spanTime! > maxTime){
+    for (let i = 0; i < results.length; i++) {
+        if (results[i].spanTime! > maxTime) {
             maxTime = results[i].spanTime!;
         }
     }
@@ -568,7 +568,7 @@ export function stressSolution(path: string, times: number){
     return new SolutionResult(Verdict.OK, undefined, maxTime);
 }
 
-export function verdictName(verdict: Verdict){
+export function verdictName(verdict: Verdict) {
     switch (verdict) {
         case Verdict.OK:
             return "OK";

+ 62 - 61
src/extension.ts

@@ -1,12 +1,12 @@
 'use strict';
+import { copyFileSync, existsSync, readdirSync, writeFileSync } from 'fs';
+import { extname, join } from 'path';
 import * as vscode from 'vscode';
-import { existsSync, writeFileSync, readdirSync, copyFileSync } from 'fs';
-import { join, extname } from 'path';
-import { SITES, getSite } from './conn';
-import { newContestFromId, testSolution, verdictName, stressSolution, upgradeArena, newProblemFromId, removeExtension, solFile, initAcmX, currentProblem, compileCode, ATTIC, SRC } from './core';
-import { Verdict, SiteDescription } from './types';
 import { startCompetitiveCompanionService } from './companion';
+import { getSite, SITES } from './conn';
+import { ATTIC, compileCode, currentProblem, initAcmX, newContestFromId, newProblemFromId, removeExtension, solFile, SRC, stressSolution, testSolution, upgradeArena, verdictName } from './core';
 import { hideTerminals } from './terminal';
+import { SiteDescription, Verdict } from './types';
 
 const TESTCASES = 'testcases';
 
@@ -15,9 +15,9 @@ function quickPickSites() {
 
     SITES.forEach(value => {
         sites.push({
-            "label" : value.name,
-            "target" : value.name,
-            "description" : value.description,
+            "label": value.name,
+            "target": value.name,
+            "description": value.description,
         });
     });
 
@@ -28,16 +28,16 @@ function quickPickSites() {
 async function addProblem() {
     let site_info = await vscode.window.showQuickPick(quickPickSites(), { placeHolder: 'Select contest site' });
 
-    if (site_info === undefined){
+    if (site_info === undefined) {
         vscode.window.showErrorMessage("Site not provided.");
         return;
     }
 
     let site: SiteDescription = getSite(site_info.target);
 
-    let id = await vscode.window.showInputBox({placeHolder: site.problemIdPlaceholder});
+    let id = await vscode.window.showInputBox({ placeHolder: site.problemIdPlaceholder });
 
-    if (id === undefined){
+    if (id === undefined) {
         vscode.window.showErrorMessage("Problem ID not provided.");
         return;
     }
@@ -58,7 +58,7 @@ async function addContest() {
     let path: string | undefined = vscode.workspace.getConfiguration('acmx.configuration', null).get('solutionPath');
     let site_info = await vscode.window.showQuickPick(quickPickSites(), { placeHolder: 'Select contest site' });
 
-    if (site_info === undefined){
+    if (site_info === undefined) {
         vscode.window.showErrorMessage("Site not provided.");
         return;
     }
@@ -66,27 +66,27 @@ async function addContest() {
     let site = getSite(site_info.target);
     let id = undefined;
 
-    if (site.name === "empty"){
-        let name= await vscode.window.showInputBox({placeHolder: site.contestIdPlaceholder});
+    if (site.name === "empty") {
+        let name = await vscode.window.showInputBox({ placeHolder: site.contestIdPlaceholder });
 
-        if (name === undefined){
+        if (name === undefined) {
             vscode.window.showErrorMessage("Name not provided.");
             return;
         }
 
-        let probCountStr = await vscode.window.showInputBox({placeHolder: "Number of problems"});
+        let probCountStr = await vscode.window.showInputBox({ placeHolder: "Number of problems" });
 
-        if (name === undefined){
+        if (name === undefined) {
             vscode.window.showErrorMessage("Number of problems not provided.");
             return;
         }
 
         id = name + '-' + probCountStr!;
     }
-    else{
-        id = await vscode.window.showInputBox({placeHolder: site.contestIdPlaceholder});
+    else {
+        id = await vscode.window.showInputBox({ placeHolder: site.contestIdPlaceholder });
 
-        if (id === undefined){
+        if (id === undefined) {
             vscode.window.showErrorMessage("Contest ID not provided.");
             return;
         }
@@ -97,7 +97,7 @@ async function addContest() {
     vscode.commands.executeCommand("vscode.openFolder", vscode.Uri.file(contestPath));
 }
 
-async function debugTestcase(path: string, tcId: string){
+async function debugTestcase(path: string, tcId: string) {
     // Change editor layout to show failing test
     await vscode.commands.executeCommand("vscode.setEditorLayout", { orientation: 0, groups: [{ groups: [{}], size: 0.5 }, { groups: [{}, {}, {}], size: 0.5 }] });
 
@@ -111,37 +111,37 @@ async function debugTestcase(path: string, tcId: string){
     await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(out), vscode.ViewColumn.Three);
 
     // This file might not exist!
-    if (existsSync(cur)){
+    if (existsSync(cur)) {
         await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(cur), vscode.ViewColumn.Four);
     }
 }
 
-async function runSolution(){
+async function runSolution() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
 
     let result = testSolution(path);
 
-    if (result.status === Verdict.OK){
+    if (result.status === Verdict.OK) {
         vscode.window.showInformationMessage(`OK. Time ${result.maxTime!}ms`);
     }
-    else if (result.status === Verdict.NO_TESTCASES){
+    else if (result.status === Verdict.NO_TESTCASES) {
         vscode.window.showErrorMessage(`No testcases.`);
     }
-    else{
+    else {
         vscode.window.showErrorMessage(`${verdictName(result.status)} on test ${result.failTcId}`);
         debugTestcase(path, result.failTcId!);
     }
 }
 
-async function compile(){
+async function compile() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
@@ -149,17 +149,17 @@ async function compile(){
     let sol = join(path, solFile());
     let out = join(path, ATTIC, 'sol');
 
-    if (!existsSync(sol)){
+    if (!existsSync(sol)) {
         throw new Error("Open a coding environment first.");
     }
 
     // Compile solution
     let xresult = compileCode(sol, out);
 
-    if (xresult.status !== 0){
+    if (xresult.status !== 0) {
         throw new Error(`Compilation Error. ${sol}`);
     }
-    else{
+    else {
         vscode.window.showInformationMessage("Compilation successfully.");
     }
 }
@@ -167,7 +167,7 @@ async function compile(){
 async function openTestcase() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
@@ -176,24 +176,25 @@ async function openTestcase() {
 
     // Read testcases
     readdirSync(join(path, TESTCASES)).
-        filter( function (tcpath) {
-            return extname(tcpath) === '.in';}).
-        map( function(tcpath) {
+        filter(function (tcpath) {
+            return extname(tcpath) === '.in';
+        }).
+        map(function (tcpath) {
             let name = removeExtension(tcpath);
 
             tcs.push({
-                'label' : name,
-                'target' : name,
+                'label': name,
+                'target': name,
             });
         });
 
     let tc = await vscode.window.showQuickPick(tcs, { placeHolder: 'Select testcase' });
 
-    if (tc !== undefined){
+    if (tc !== undefined) {
         let inp = join(path, TESTCASES, `${tc.target}.in`);
         let out = join(path, TESTCASES, `${tc.target}.out`);
 
-        await vscode.commands.executeCommand("vscode.setEditorLayout", { orientation: 0, groups: [{}, {}]});
+        await vscode.commands.executeCommand("vscode.setEditorLayout", { orientation: 0, groups: [{}, {}] });
         await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(inp), vscode.ViewColumn.One);
         await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(out), vscode.ViewColumn.Two);
     }
@@ -202,13 +203,13 @@ async function openTestcase() {
 async function addTestcase() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
 
     let index = 0;
-    while (existsSync(join(path, TESTCASES, `${index}.hand.in`))){
+    while (existsSync(join(path, TESTCASES, `${index}.hand.in`))) {
         index += 1;
     }
 
@@ -218,7 +219,7 @@ async function addTestcase() {
     writeFileSync(inp, "");
     writeFileSync(out, "");
 
-    await vscode.commands.executeCommand("vscode.setEditorLayout", { orientation: 0, groups: [{}, {}]});
+    await vscode.commands.executeCommand("vscode.setEditorLayout", { orientation: 0, groups: [{}, {}] });
     await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(inp), vscode.ViewColumn.One);
     await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(out), vscode.ViewColumn.Two);
 }
@@ -228,22 +229,22 @@ async function coding() {
 
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
 
-    await vscode.commands.executeCommand("vscode.setEditorLayout", { groups: [{}]});
+    await vscode.commands.executeCommand("vscode.setEditorLayout", { groups: [{}] });
 
     let sol = join(path, solFile());
 
     await vscode.commands.executeCommand("vscode.open", vscode.Uri.file(sol), vscode.ViewColumn.One);
 }
 
-async function stress(){
+async function stress() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
@@ -251,25 +252,25 @@ async function stress(){
     let stressTimes: number | undefined = vscode.workspace.getConfiguration('acmx.stress', null).get('times');
 
     // Use default
-    if (stressTimes === undefined){
+    if (stressTimes === undefined) {
         stressTimes = 10;
     }
 
     let result = stressSolution(path, stressTimes);
 
-    if (result.status === Verdict.OK){
+    if (result.status === Verdict.OK) {
         vscode.window.showInformationMessage(`OK. Time ${result.maxTime!}ms`);
     }
-    else{
+    else {
         vscode.window.showErrorMessage(`${verdictName(result.status)} on test ${result.failTcId}`);
         debugTestcase(path, result.failTcId!);
     }
 }
 
-async function upgrade(){
+async function upgrade() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
@@ -277,34 +278,34 @@ async function upgrade(){
     upgradeArena(path);
 }
 
-function fileList(dir: string): string[]{
+function fileList(dir: string): string[] {
     return readdirSync(dir).reduce((list: string[], file: string) => {
         return list.concat([file]);
     }, []);
 }
 
-async function setChecker(){
+async function setChecker() {
     let path = currentProblem();
 
-    if (path === undefined){
+    if (path === undefined) {
         vscode.window.showErrorMessage("No active problem");
         return;
     }
 
     let all_checkers_plain = fileList(join(SRC, 'static', 'checkers'))
-                                .filter((name: string) => name !== 'testlib.h')
-                                .map((name: string) => name.slice(0, name.length - 4));
+        .filter((name: string) => name !== 'testlib.h')
+        .map((name: string) => name.slice(0, name.length - 4));
 
     let all_checkers = all_checkers_plain.map((value: string) => {
         return {
-            'label' : value,
-            'target' : value + '.cpp'
+            'label': value,
+            'target': value + '.cpp'
         };
     });
 
     let checker_info = await vscode.window.showQuickPick(all_checkers, { placeHolder: 'Select custom checker.' });
 
-    if (checker_info === undefined){
+    if (checker_info === undefined) {
         vscode.window.showErrorMessage("Checker not provided.");
         return;
     }
@@ -317,7 +318,7 @@ async function setChecker(){
     copyFileSync(checker_path, checker_dest);
 }
 
-async function debugTest(){
+async function debugTest() {
     console.log("no bugs :O");
 }
 

+ 3 - 3
src/gwen.ts

@@ -1,8 +1,8 @@
-import { openSync, writeSync } from "fs";
 import { spawnSync } from "child_process";
+import { openSync, writeSync } from "fs";
+import { join } from "path";
 import * as vscode from 'vscode';
 import { TESTCASES } from "./core";
-import { join } from "path";
 
 const DEFAULT = 'import random\n\nprint(random.randint(1, 100))\n';
 
@@ -13,7 +13,7 @@ export function create(problemPath: string, outputPath: string) {
 
     console.log("exticode:", exitCode);
 
-    if (exitCode.status !== 0){
+    if (exitCode.status !== 0) {
         let generator_fd = openSync(outputPath, 'w');
         writeSync(generator_fd, DEFAULT);
     }

+ 17 - 17
src/parsers/codeforces.ts

@@ -1,10 +1,10 @@
-import { SiteDescription, Contest, Problem } from "../types";
-
-import * as vscode from 'vscode';
-import JSSoup from 'jssoup';
 import * as got from 'got';
+import JSSoup from 'jssoup';
+import * as vscode from 'vscode';
+import { Contest, Problem, SiteDescription } from "../types";
 import { getText } from './util';
 
+
 /**
  * contestId: ${contest}
  * http://codeforces.com/contest/${contest}/
@@ -16,7 +16,7 @@ export async function parseContest(contestId: string) {
     let url = `http://codeforces.com/contest/${contestId}`;
     let response = await got.get(url);
 
-    if (response.statusCode !== 200){
+    if (response.statusCode !== 200) {
         throw new Error(`Contest ${url} not downloaded. ${response.statusCode}`);
     }
 
@@ -24,14 +24,14 @@ export async function parseContest(contestId: string) {
 
     let soup = new JSSoup(response.body);
 
-    let name: string = soup.find("div", {"id" : "sidebar"}).find("a").text;
+    let name: string = soup.find("div", { "id": "sidebar" }).find("a").text;
     name = name.toLowerCase().replace(' ', '-');
 
     let problemsTable = soup.find("table", "problems");
     let problems: Problem[] = [];
     let problemSection = problemsTable.findAll("td", "id");
 
-    for (let i = 0; i < problemSection.length; i++){
+    for (let i = 0; i < problemSection.length; i++) {
         let section = problemSection[i];
         let hrefData = section.find("a").attrs.href.split('/');
         let pid = hrefData[hrefData.length - 1];
@@ -59,7 +59,7 @@ export async function parseProblem(problemId: string) {
     let url = `http://codeforces.com/contest/${contest}/problem/${pid}`;
     let response = await got.get(url);
 
-    if (response.statusCode !== 200){
+    if (response.statusCode !== 200) {
         throw new Error(`Problem ${url} not downloaded. ${response.statusCode}`);
     }
 
@@ -71,12 +71,12 @@ export async function parseProblem(problemId: string) {
     let inputTC: string[] = [];
     let outputTC: string[] = [];
 
-    problemDescription.findAll("div", "input").forEach((element: any) =>{
+    problemDescription.findAll("div", "input").forEach((element: any) => {
         let tc = element.find("pre");
         inputTC.push(getText(tc));
     });
 
-    problemDescription.findAll("div", "output").forEach((element: any) =>{
+    problemDescription.findAll("div", "output").forEach((element: any) => {
         let tc = element.find("pre");
         outputTC.push(getText(tc));
     });
@@ -87,10 +87,10 @@ export async function parseProblem(problemId: string) {
 }
 
 export const CODEFORCES = new SiteDescription(
-        "codeforces",
-        "codeforces.com",
-        "{contest id} (Ex: 1095)",
-        "{contest id}-{problem id} (Ex: 1095-A)",
-        parseContest,
-        parseProblem,
-    );
+    "codeforces",
+    "codeforces.com",
+    "{contest id} (Ex: 1095)",
+    "{contest id}-{problem id} (Ex: 1095-A)",
+    parseContest,
+    parseProblem,
+);

+ 5 - 5
src/parsers/util.ts

@@ -1,17 +1,17 @@
 import * as unescape from 'unescape';
 
-export function getText(htmlNode: any){
+export function getText(htmlNode: any) {
     let data: string[] = [];
 
     htmlNode.contents.forEach((element: any) => {
-        if (element._text === undefined){
+        if (element._text === undefined) {
             data.push('\n');
         }
-        else{
-            if (data.length === 0 && element._text[0] === '\n'){
+        else {
+            if (data.length === 0 && element._text[0] === '\n') {
                 data.push(element._text.slice(1));
             }
-            else{
+            else {
                 data.push(element._text);
             }
         }

+ 68 - 68
src/test/extension.test.ts

@@ -5,11 +5,11 @@
 
 // The module 'assert' provides assertion methods from node
 import * as assert from 'assert';
+import { closeSync, existsSync, openSync, readdirSync, rmdirSync, unlinkSync, writeSync } from 'fs';
 import { dirname, join } from 'path';
-import { timedRun, testcasesName, testSolution, newArena, ATTIC, TESTCASES, upgradeArena, stressSolution, newProblemFromId, newContestFromId, getTimeout } from '../core';
+import { getSite, PERSONAL, SITES } from '../conn';
+import { ATTIC, getTimeout, newArena, newContestFromId, newProblemFromId, stressSolution, TESTCASES, testcasesName, testSolution, timedRun, upgradeArena } from '../core';
 import { TestcaseResult, Verdict } from '../types';
-import { rmdirSync, existsSync, readdirSync, unlinkSync, openSync, writeSync, closeSync } from 'fs';
-import { getSite, SITES, PERSONAL } from '../conn';
 
 const SRC = join(dirname(dirname(dirname(__filename))), 'src', 'test');
 const ARENA = join(SRC, 'arena');
@@ -20,15 +20,15 @@ suite("Extension Tests", function () {
     /**
      * Recursive remove
      */
-    function recRmdir(path: string){
-        if (existsSync(path)){
+    function recRmdir(path: string) {
+        if (existsSync(path)) {
             readdirSync(path).forEach(name => {
                 let cPath = join(path, name);
 
-                try{
+                try {
                     unlinkSync(cPath);
                 }
-                catch(err){
+                catch (err) {
                     recRmdir(cPath);
                 }
             });
@@ -37,7 +37,7 @@ suite("Extension Tests", function () {
         }
     }
 
-    function writeFile(path: string, content: string){
+    function writeFile(path: string, content: string) {
         let currentFd = openSync(path, 'w');
         writeSync(currentFd, content);
         closeSync(currentFd);
@@ -46,17 +46,17 @@ suite("Extension Tests", function () {
     /**
      * core::initAcmX
      */
-    test("initAcmX", function(){
+    test("initAcmX", function () {
         // TODO
     });
 
     /**
      * core::newArena
      */
-    test("newArena", function(){
+    test("newArena", function () {
         let path = join(ARENA, "testNew");
 
-        if (existsSync(path)){
+        if (existsSync(path)) {
             recRmdir(path);
         }
 
@@ -74,10 +74,10 @@ suite("Extension Tests", function () {
     /**
      * core::upgradeArena
      */
-    test("upgradeArena", function(){
+    test("upgradeArena", function () {
         let path = join(ARENA, "testUpgrade");
 
-        if (existsSync(path)){
+        if (existsSync(path)) {
             recRmdir(path);
         }
 
@@ -95,7 +95,7 @@ suite("Extension Tests", function () {
     /**
      * core::testcasesName
      */
-    test("testcasesName", function(){
+    test("testcasesName", function () {
         let path = join(ARENA, 'exampleContest', 'A');
         let result = testcasesName(path);
         let target = ["0", "1", "2"];
@@ -104,7 +104,7 @@ suite("Extension Tests", function () {
 
         result.sort();
 
-        for (let i = 0; i < 3; ++i){
+        for (let i = 0; i < 3; ++i) {
             assert.equal(target[i], result[i]);
         }
     });
@@ -112,7 +112,7 @@ suite("Extension Tests", function () {
     /**
      * core::newProblem
      */
-    test("newProblemFromId", async function(){
+    test("newProblemFromId", async function () {
         let problemId = 'testProblemFromId';
         let path = join(ARENA, problemId);
 
@@ -130,11 +130,11 @@ suite("Extension Tests", function () {
     /**
      * core::newContestFromId
      */
-    test("newContestFromId", async function(){
+    test("newContestFromId", async function () {
         let contestId = 'testContestFromId';
         let path = join(ARENA, contestId);
 
-        if (existsSync(path)){
+        if (existsSync(path)) {
             recRmdir(path);
         }
 
@@ -152,7 +152,7 @@ suite("Extension Tests", function () {
      *
      * Test running one single test cases, and receiving all different verdicts
      */
-    test("timedRunOk", function() {
+    test("timedRunOk", function () {
         let exampleContest = join(ARENA, 'exampleContest');
         let problem = join(exampleContest, 'A');
         let testcaseId = '0';
@@ -160,7 +160,7 @@ suite("Extension Tests", function () {
         assert.equal(result.status, Verdict.OK);
     });
 
-    test("timedRunWA", function() {
+    test("timedRunWA", function () {
         let exampleContest = join(ARENA, 'exampleContest');
         let problem = join(exampleContest, 'B');
         let testcaseId = '0';
@@ -168,7 +168,7 @@ suite("Extension Tests", function () {
         assert.equal(result.status, Verdict.WA);
     });
 
-    test("timedRunRTE", function() {
+    test("timedRunRTE", function () {
         let exampleContest = join(ARENA, 'exampleContest');
         let problem = join(exampleContest, 'C');
         let testcaseId = '0';
@@ -176,7 +176,7 @@ suite("Extension Tests", function () {
         assert.equal(result.status, Verdict.RTE);
     });
 
-    test("timedRunTLE", function() {
+    test("timedRunTLE", function () {
         let exampleContest = join(ARENA, 'exampleContest');
         let problem = join(exampleContest, 'D');
         let testcaseId = '0';
@@ -189,14 +189,14 @@ suite("Extension Tests", function () {
      *
      * Test running one single test cases, and receiving all different verdicts
      */
-    test("testSolutionOK", function() {
+    test("testSolutionOK", function () {
         let exampleContest = join(ARENA, 'exampleContest');
         let problem = join(exampleContest, 'A');
         let result: TestcaseResult = testSolution(problem);
         assert.equal(result.status, Verdict.OK);
     });
 
-    test("testSolutionCE", function() {
+    test("testSolutionCE", function () {
         let exampleContest = join(ARENA, 'exampleContest');
         let problem = join(exampleContest, 'E');
         try {
@@ -210,10 +210,10 @@ suite("Extension Tests", function () {
     /**
      * core::stressSolution
      */
-    test("stressSolutionOK", function() {
+    test("stressSolutionOK", function () {
         let path = join(ARENA, 'testStressOK');
 
-        if (existsSync(path)){
+        if (existsSync(path)) {
             recRmdir(path);
         }
 
@@ -224,34 +224,34 @@ suite("Extension Tests", function () {
 
         // populate sol.cpp
         writeFile(join(path, "sol.cpp"),
-        `#include <iostream>\n` +
-        `\n` +
-        `using namespace std;\n` +
-        `\n` +
-        `int main(){\n` +
-        `   int n; cin >> n;\n` +
-        `   cout << n + 2 << endl;\n` +
-        `   return 0;\n` +
-        `}\n`
+            `#include <iostream>\n` +
+            `\n` +
+            `using namespace std;\n` +
+            `\n` +
+            `int main(){\n` +
+            `   int n; cin >> n;\n` +
+            `   cout << n + 2 << endl;\n` +
+            `   return 0;\n` +
+            `}\n`
         );
 
         // populate brute.cpp
         writeFile(join(path, "brute.cpp"),
-        `#include <iostream>\n` +
-        `\n` +
-        `using namespace std;\n` +
-        `\n` +
-        `int main(){\n` +
-        `   int n; cin >> n;\n` +
-        `   cout << n + 2 << endl;\n` +
-        `   return 0;\n` +
-        `}\n`
+            `#include <iostream>\n` +
+            `\n` +
+            `using namespace std;\n` +
+            `\n` +
+            `int main(){\n` +
+            `   int n; cin >> n;\n` +
+            `   cout << n + 2 << endl;\n` +
+            `   return 0;\n` +
+            `}\n`
         );
 
         // populate gen.py
         writeFile(join(path, 'gen.py'),
-        `import random\n` +
-        `print(random.randint(0, 99))\n`
+            `import random\n` +
+            `print(random.randint(0, 99))\n`
         );
 
         let result = stressSolution(path, 10);
@@ -261,10 +261,10 @@ suite("Extension Tests", function () {
         recRmdir(path);
     });
 
-    test("stressSolutionWA", function() {
+    test("stressSolutionWA", function () {
         let path = join(ARENA, 'testStressWA');
 
-        if (existsSync(path)){
+        if (existsSync(path)) {
             recRmdir(path);
         }
 
@@ -275,34 +275,34 @@ suite("Extension Tests", function () {
 
         // populate sol.cpp
         writeFile(join(path, "sol.cpp"),
-        `#include <iostream>\n` +
-        `\n` +
-        `using namespace std;\n` +
-        `\n` +
-        `int main(){\n` +
-        `   int n; cin >> n;\n` +
-        `   cout << n + 3 << endl;\n` +
-        `   return 0;\n` +
-        `}\n`
+            `#include <iostream>\n` +
+            `\n` +
+            `using namespace std;\n` +
+            `\n` +
+            `int main(){\n` +
+            `   int n; cin >> n;\n` +
+            `   cout << n + 3 << endl;\n` +
+            `   return 0;\n` +
+            `}\n`
         );
 
         // populate brute.cpp
         writeFile(join(path, "brute.cpp"),
-        `#include <iostream>\n` +
-        `\n` +
-        `using namespace std;\n` +
-        `\n` +
-        `int main(){\n` +
-        `   int n; cin >> n;\n` +
-        `   cout << n + 2 << endl;\n` +
-        `   return 0;\n` +
-        `}\n`
+            `#include <iostream>\n` +
+            `\n` +
+            `using namespace std;\n` +
+            `\n` +
+            `int main(){\n` +
+            `   int n; cin >> n;\n` +
+            `   cout << n + 2 << endl;\n` +
+            `   return 0;\n` +
+            `}\n`
         );
 
         // populate gen.py
         writeFile(join(path, ATTIC, 'gen.py'),
-        `import random\n` +
-        `print(random.randint(0, 99))\n`
+            `import random\n` +
+            `print(random.randint(0, 99))\n`
         );
 
         let result = stressSolution(path, 10);

+ 13 - 13
src/types.ts

@@ -1,4 +1,4 @@
-export enum Verdict{
+export enum Verdict {
     OK,     // Accepted
     WA,     // Wrong Answer
     TLE,    // Time Limit Exceeded
@@ -7,36 +7,36 @@ export enum Verdict{
     NO_TESTCASES,
 }
 
-export class TestcaseResult{
+export class TestcaseResult {
     status: Verdict;
     spanTime?: number;
 
-    constructor(status: Verdict, spanTime?: number){
+    constructor(status: Verdict, spanTime?: number) {
         this.status = status;
         this.spanTime = spanTime;
     }
 }
 
-export class SolutionResult{
+export class SolutionResult {
     status: Verdict;
     failTcId?: string;
     maxTime?: number;
 
-    constructor(status: Verdict, failTcId?: string, maxTime?: number){
+    constructor(status: Verdict, failTcId?: string, maxTime?: number) {
         this.status = status;
         this.failTcId = failTcId;
         this.maxTime = maxTime;
     }
 }
 
-export class Problem{
+export class Problem {
     // Identifier will be used as folder name
     identifier?: string;
     name?: string;
     inputs?: string[];
     outputs?: string[];
 
-    constructor(identifier?: string, name?: string, inputs?: string[], outputs?: string[]){
+    constructor(identifier?: string, name?: string, inputs?: string[], outputs?: string[]) {
         this.identifier = identifier;
         this.name = name;
         this.inputs = inputs;
@@ -44,17 +44,17 @@ export class Problem{
     }
 }
 
-export class Contest{
+export class Contest {
     name: string;
     problems: Problem[];
 
-    constructor(name: string, problems: Problem[]){
+    constructor(name: string, problems: Problem[]) {
         this.name = name;
         this.problems = problems;
     }
 }
 
-export class SiteDescription{
+export class SiteDescription {
     name: string;
     description: string;
     contestIdPlaceholder: string;
@@ -63,9 +63,9 @@ export class SiteDescription{
     problemParser: (problemId: string) => Promise<Problem>;
 
     constructor(name: string, description: string,
-                contestIdPlaceholder: string, problemIdPlaceholder: string,
-                contestParser: (contestId: string) => Promise<Contest>,
-                problemParser: (problemId: string) => Promise<Problem>){
+        contestIdPlaceholder: string, problemIdPlaceholder: string,
+        contestParser: (contestId: string) => Promise<Contest>,
+        problemParser: (problemId: string) => Promise<Problem>) {
         this.name = name;
         this.description = description;