Skip to content

Commit f673fb7

Browse files
authored
Merge pull request #17 from LPCIC/next
Next
2 parents b17489b + 9c8c51c commit f673fb7

File tree

7 files changed

+65
-27
lines changed

7 files changed

+65
-27
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Change Log
22

3+
### 0.2.5
4+
5+
- Colorblind friendly color schema
6+
- Fix display of (moltiple) additional attempts for the same goal
7+
38
### 0.2.4
49

510
- Fix search for binaries in $PATH

media/main.css

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ html, body
234234
{
235235
height: 16px;
236236
width: 16px;
237-
background-color: var(--vscode-charts-green);
237+
background-color: var(--vscode-charts-blue);
238238
border-radius: 50%;
239239
border: 2px solid #999999;
240240
display: inline-block;
@@ -264,7 +264,7 @@ html, body
264264
{
265265
height: 16px;
266266
width: 16px;
267-
background: linear-gradient(90deg, var(--vscode-charts-yellow), 80%, var(--vscode-charts-green));
267+
background: linear-gradient(90deg, var(--vscode-charts-yellow), 50%, var(--vscode-charts-blue));
268268
border-radius: 50%;
269269
border: 2px solid #999999;
270270
display: inline-block;
@@ -274,7 +274,7 @@ html, body
274274
{
275275
height: 16px;
276276
width: 16px;
277-
background: linear-gradient(90deg, var(--vscode-charts-yellow), 80%, var(--vscode-charts-red));
277+
background: linear-gradient(90deg, var(--vscode-charts-yellow), 50%, var(--vscode-charts-red));
278278
border-radius: 50%;
279279
border: 2px solid #999999;
280280
display: inline-block;
@@ -369,8 +369,8 @@ hr
369369

370370
.panel-heading
371371
{
372-
color: var(--vscode-foreground);
373-
background-color: var(--vscode-charts-blue);
372+
background-color: var(--vscode-editor-background);
373+
color: var(--vscode-editor-foreground);
374374
}
375375

376376
.panel.is-danger .panel-heading
@@ -380,7 +380,7 @@ hr
380380

381381
.panel.is-success .panel-heading
382382
{
383-
background-color: var(--vscode-charts-green);
383+
background-color: var(--vscode-charts-blue);
384384
}
385385

386386
.tag:not(body)
@@ -398,7 +398,7 @@ hr
398398
.tag.tag-green
399399
{
400400
color: #ffffff;
401-
background-color: var(--vscode-charts-green);
401+
background-color: var(--vscode-charts-blue);
402402
}
403403

404404
.tag.tag-yellow
@@ -410,13 +410,13 @@ hr
410410
.tag.tag-yellowgreen
411411
{
412412
color: #000000;
413-
background: linear-gradient(90deg, var(--vscode-charts-yellow), 80%, var(--vscode-charts-green));
413+
background: linear-gradient(90deg, var(--vscode-charts-yellow), 50%, var(--vscode-charts-blue));
414414
}
415415

416416
.tag.tag-yellowred
417417
{
418418
color: #000000;
419-
background: linear-gradient(90deg, var(--vscode-charts-yellow), 80%, var(--vscode-charts-red));
419+
background: linear-gradient(90deg, var(--vscode-charts-yellow), 50%, var(--vscode-charts-red));
420420
}
421421

422422
.tag.tag-grey
@@ -588,7 +588,7 @@ a.dropdown-item:hover
588588

589589
.card-footer-green
590590
{
591-
background-color: var(--vscode-charts-green);
591+
background-color: var(--vscode-charts-blue);
592592
}
593593

594594
.card-footer-yellow
@@ -603,12 +603,12 @@ a.dropdown-item:hover
603603

604604
.card-footer-yellowgreen
605605
{
606-
background: linear-gradient(90deg, var(--vscode-charts-yellow), 80%, var(--vscode-charts-green));
606+
background: linear-gradient(90deg, var(--vscode-charts-yellow), 50%, var(--vscode-charts-blue));
607607
}
608608

609609
.card-footer-yellowred
610610
{
611-
background: linear-gradient(90deg, var(--vscode-charts-yellow), 80%, var(--vscode-charts-red));
611+
background: linear-gradient(90deg, var(--vscode-charts-yellow), 50%, var(--vscode-charts-red));
612612
}
613613

614614
/* ***************************************************************************
@@ -623,12 +623,12 @@ a.dropdown-item:hover
623623
--shiki-color-text: var(--vscode-symbolIcon-textForeground);
624624
--shiki-color-background: var(--vscode-sideBar-background);
625625
--shiki-token-constant: var(--vscode-charts-blue);
626-
--shiki-token-string: var(--vscode-charts-green);
626+
--shiki-token-string: var(--vscode-charts-blue);
627627
--shiki-token-comment: var(--vscode-charts-lines);
628628
--shiki-token-keyword: var(--vscode-charts-purple);
629629
--shiki-token-parameter: var(--vscode-charts-purple);
630630
--shiki-token-function: var(--vscode-charts-blue);
631-
--shiki-token-string-expression: var(--vscode-charts-green);
631+
--shiki-token-string-expression: var(--vscode-charts-blue);
632632
--shiki-token-punctuation: var(--vscode-charts-orange) ;
633633
--shiki-token-link: var(--vscode-charts-blue);
634634
}

media/main.js

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -302,8 +302,33 @@
302302
let ds_s = -1;
303303
let ds_g = -1;
304304

305-
for(var i = 0; i < card.step.value.more_successful_attempts.length; i++) {
306-
let step_id = card.step.value.more_successful_attempts[i];
305+
let all_attempts = card.step.value.more_successful_attempts.concat(card.step.value.more_failing_attempts);
306+
307+
308+
for(var i = 0; i < all_attempts.length; i++) {
309+
let step_id = all_attempts[i];
310+
let runt_id = card.runtime_id;
311+
let goal_ds = [];
312+
313+
goal_ds[0] = step_id;
314+
315+
for(var j = 0; j < trace.length; j++) {
316+
if(trace[j].step_id == step_id
317+
&& trace[j].runtime_id == runt_id) {
318+
goal_ds[1] = goal_id(trace[j].step);
319+
break;
320+
}
321+
}
322+
323+
goal_ds[2] = ids_for_rt_st_gl(ds_r, goal_ds[0], goal_ds[1])[0];
324+
destinations.push(goal_ds);
325+
326+
}
327+
return destinations;
328+
329+
330+
for(var i = 0; i < all_attempts.length; i++) {
331+
let step_id = all_attempts[i];
307332
let runt_id = card.runtime_id;
308333

309334
// console.log('goal_status_label', 'seeking goal id for', step_id, runt_id);
@@ -510,7 +535,7 @@
510535
contents += format_successful_attempts(step.value.successful_attempts, r_id, s_id);
511536
if (status.includes("Yellow") && card.step.kind == "Inference")
512537
{
513-
contents += format_more_successful_attempts(msg.data, window.trace, r_id, s_id);
538+
contents += format_more_attempts(msg.data, window.trace, r_id, s_id);
514539
}
515540
contents += format_stack(step.value.stack, r_id, s_id);
516541

@@ -811,19 +836,23 @@ ${step.value.findall_solution_text}
811836
return contents;
812837
}
813838

814-
function format_more_successful_attempts(card, trace, r_id, s_id)
839+
function format_more_attempts(card, trace, r_id, s_id)
815840
{
816-
// console.log('Formatting more successful attempts', JSON.stringify(card.step.value.more_successful_attempts));
841+
// console.log('Formatting more attempts', JSON.stringify(card.step.value.more_successful_attempts), JSON.stringify(card.step.value.more_failing_attempts));
817842

818843
let contents = "";
819844

820-
if(card.step.value.more_successful_attempts == undefined)
845+
if(card.step.value.more_successful_attempts == undefined && card.step.value.more_failing_attempts == undefined)
821846
return contents;
822847

848+
let panel_class = "is-success";
849+
if (card.step.value.more_successful_attempts.length == 0)
850+
panel_class = "is-danger";
851+
823852
contents = `
824-
<article class="panel is-success">
853+
<article class="panel ${panel_class}">
825854
<div class="panel-heading">
826-
More successful attempts (${card.step.value.more_successful_attempts.length})
855+
More attempts (${card.step.value.more_successful_attempts.length} / ${card.step.value.more_failing_attempts.length})
827856
<span id="toggle_ms" class="tag" style="float:right;">Toggle</span>
828857
</div>
829858
<div>

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"displayName": "Elpi lang",
44
"publisher": "gares",
55
"description": "Elpi programming language support",
6-
"version": "0.2.4",
6+
"version": "0.2.5",
77
"homepage": "https://github.com/LPCIC/elpi-lang",
88
"repository": {
99
"type": "git",
@@ -91,7 +91,7 @@
9191
},
9292
"elpi.elpi_trace_view.syntax_highlighting": {
9393
"type": "boolean",
94-
"default": "true",
94+
"default": "false",
9595
"markdownDescription": "Highlight elpi code statements"
9696
}
9797
}

src/trace.atd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ type inference = {
5656
failed_attempts : attempt list;
5757
successful_attempts : successful_attempt list;
5858
more_successful_attempts : step_id list;
59+
more_failing_attempts : step_id list;
5960
stack : stack;
6061
}
6162

src/trace.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ export type Inference = {
6161
failed_attempts: Attempt[];
6262
successful_attempts: SuccessfulAttempt[];
6363
more_successful_attempts: StepId[];
64+
more_failing_attempts: StepId[];
6465
stack: Stack;
6566
}
6667

@@ -369,6 +370,7 @@ export function writeInference(x: Inference, context: any = x): any {
369370
'failed_attempts': _atd_write_required_field('Inference', 'failed_attempts', _atd_write_array(writeAttempt), x.failed_attempts, x),
370371
'successful_attempts': _atd_write_required_field('Inference', 'successful_attempts', _atd_write_array(writeSuccessfulAttempt), x.successful_attempts, x),
371372
'more_successful_attempts': _atd_write_required_field('Inference', 'more_successful_attempts', _atd_write_array(writeStepId), x.more_successful_attempts, x),
373+
'more_failing_attempts': _atd_write_field_with_default(_atd_write_array(writeStepId), [], x.more_failing_attempts, x),
372374
'stack': _atd_write_required_field('Inference', 'stack', writeStack, x.stack, x),
373375
};
374376
}
@@ -381,6 +383,7 @@ export function readInference(x: any, context: any = x): Inference {
381383
failed_attempts: _atd_read_required_field('Inference', 'failed_attempts', _atd_read_array(readAttempt), x['failed_attempts'], x),
382384
successful_attempts: _atd_read_required_field('Inference', 'successful_attempts', _atd_read_array(readSuccessfulAttempt), x['successful_attempts'], x),
383385
more_successful_attempts: _atd_read_required_field('Inference', 'more_successful_attempts', _atd_read_array(readStepId), x['more_successful_attempts'], x),
386+
more_failing_attempts: _atd_read_field_with_default(_atd_read_array(readStepId), [], x['more_failing_attempts'], x),
384387
stack: _atd_read_required_field('Inference', 'stack', readStack, x['stack'], x),
385388
};
386389
}
@@ -1059,7 +1062,7 @@ function _atd_write_option<T>(write_elt: (x: T, context: any) => any):
10591062
return write_option
10601063
}
10611064

1062-
function _atd_write_nullable<T>(write_elt: (x: T | null, context: any) => any):
1065+
function _atd_write_nullable<T>(write_elt: (x: T, context: any) => any):
10631066
(x: T | null, context: any) => any {
10641067
function write_option(x: T | null, context: any): any {
10651068
if (x === null)

0 commit comments

Comments
 (0)