Skip to content

Commit

Permalink
Add better layout distribution for debugging.
Browse files Browse the repository at this point in the history
This is temporary before #40
  • Loading branch information
mfornet committed May 31, 2020
1 parent f8e9e1a commit d4ce089
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ export function initAcmX(testPath?: string) {
if (!existsSync(languagesFolder)) {
copySync(languageStaticFolder, languagesFolder);
} else {
// TODO: Set time limit from command.
// TODO: Test this is really working.
readdirSync(languageStaticFolder).forEach((languageName) => {
if (!existsSync(join(languagesFolder, languageName))) {
copySync(
Expand Down Expand Up @@ -634,6 +632,8 @@ export function testSolution(path: string): Option<SolutionResult> {
let results: TestCaseResult[] = [];
let fail = Option.none<SolutionResult>();

// Try to find time limit from local config first, otherwise use global time limit.
// TODO: Add to wiki about this feature, and how to change custom time limit.
let timeout = config.timeLimit().unwrapOr(getTimeout());

testcasesId.forEach((tcId) => {
Expand Down
16 changes: 10 additions & 6 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,13 +128,17 @@ async function debugTestCase(path: string, tcId: string) {
orientation: 0,
groups: [
{ groups: [{}], size: 0.5 },
{ groups: [{}, [{}, {}]], size: 0.5 },
{
groups: [{ groups: [{}, {}] }, {}],
size: 0.5,
},
],
});

let sol = mainSolution(path);
let inp = join(path, TESTCASES, `${tcId}.in`);
let out = join(path, TESTCASES, `${tcId}.ans`);
let cur = join(path, TESTCASES, `${tcId}.out`);
let ans = join(path, TESTCASES, `${tcId}.ans`);
let out = join(path, TESTCASES, `${tcId}.out`);

await vscode.commands.executeCommand(
"vscode.open",
Expand All @@ -147,10 +151,10 @@ async function debugTestCase(path: string, tcId: string) {
vscode.ViewColumn.Two
);
// This file might not exist!
if (existsSync(cur)) {
if (existsSync(out)) {
await vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.file(cur),
vscode.Uri.file(ans),
vscode.ViewColumn.Three
);
await vscode.commands.executeCommand(
Expand All @@ -161,7 +165,7 @@ async function debugTestCase(path: string, tcId: string) {
} else {
await vscode.commands.executeCommand(
"vscode.open",
vscode.Uri.file(out),
vscode.Uri.file(ans),
vscode.ViewColumn.Four
);
}
Expand Down

0 comments on commit d4ce089

Please sign in to comment.