Skip to content

Commit a003c24

Browse files
committed
Also show testcase details on compile error status
1 parent 290ca9e commit a003c24

File tree

3 files changed

+80
-128
lines changed

3 files changed

+80
-128
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
- Trim off trailing whitespaces when requesting full data
1717
- Don't save ongoing running statuses to avoid blocking interacting with testcase on malfunction
1818
- Removed unused save all functionality
19+
- Allow showing testcase details on compiler error status
1920

2021
### Fixed
2122

src/webview/judge/Testcase.svelte

Lines changed: 76 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,7 @@
6262
let interactorSecretEditing = $state(false);
6363
</script>
6464

65-
{#if status === "CE"}
66-
<div class="testcase-container">
67-
<TestcaseToolbar {id} {testcase} {onprerun} />
68-
</div>
69-
{:else if status === "NA" || status === "AC" || status === "WA" || status === "RE" || status === "TL" || status === "ML"}
65+
{#if status === "NA" || status === "AC" || status === "WA" || status === "RE" || status === "TL" || status === "ML" || status === "CE"}
7066
<div class="testcase-container">
7167
<TestcaseToolbar {id} {testcase} {onprerun} />
7268
{#if showDetails}
@@ -90,84 +86,86 @@
9086
}}
9187
/>
9288
{/if}
93-
<AutoresizeTextarea
94-
bind:value={testcase.stdin}
95-
bind:editing={stdinEditing}
96-
placeholder="Input..."
97-
readonly={testcase.mode === "interactive"}
98-
onexpand={() => handleExpandStdio("STDIN")}
99-
onpreedit={() => {
100-
postProviderMessage({ type: "REQUEST_FULL_DATA", id, stdio: "STDIN" });
101-
}}
102-
onsave={handleSaveStdin}
103-
oncancel={() => {
104-
postProviderMessage({ type: "REQUEST_TRIMMED_DATA", id, stdio: "STDIN" });
105-
}}
106-
/>
107-
<AutoresizeTextarea
108-
value={testcase.stderr}
109-
readonly
110-
hiddenOnEmpty
111-
variant="stderr"
112-
onexpand={() => handleExpandStdio("STDERR")}
113-
/>
114-
{#if testcase.mode === "interactive" || testcase.status !== "AC"}
115-
<AutoresizeTextarea
116-
value={testcase.stdout}
117-
readonly
118-
hiddenOnEmpty
119-
onexpand={() => handleExpandStdio("STDOUT")}
120-
>
121-
{#snippet actions()}
122-
{#if (status === "NA" || status === "WA") && testcase.mode !== "interactive"}
123-
<button
124-
class="action-button action-button--always-visible codicon codicon-pass"
125-
data-tooltip="Accept Output"
126-
aria-label="Accept"
127-
onclick={() => postProviderMessage({ type: "ACTION", id, action: "ACCEPT" })}
128-
></button>
129-
{/if}
130-
{#if status === "WA" && testcase.mode !== "interactive"}
131-
<button
132-
class="action-button action-button--always-visible codicon codicon-diff-single"
133-
data-tooltip="Compare Answers"
134-
aria-label="Compare"
135-
onclick={() => postProviderMessage({ type: "ACTION", id, action: "COMPARE" })}
136-
></button>
137-
{/if}
138-
{/snippet}
139-
</AutoresizeTextarea>
140-
{/if}
141-
{#if testcase.mode !== "interactive"}
89+
{#if status !== "CE"}
14290
<AutoresizeTextarea
143-
bind:value={testcase.acceptedStdout}
144-
bind:editing={acceptedStdoutEditing}
145-
placeholder="Accepted output..."
146-
variant="accepted"
147-
onexpand={() => handleExpandStdio("ACCEPTED_STDOUT")}
91+
bind:value={testcase.stdin}
92+
bind:editing={stdinEditing}
93+
placeholder="Input..."
94+
readonly={testcase.mode === "interactive"}
95+
onexpand={() => handleExpandStdio("STDIN")}
14896
onpreedit={() => {
149-
postProviderMessage({ type: "REQUEST_FULL_DATA", id, stdio: "ACCEPTED_STDOUT" });
97+
postProviderMessage({ type: "REQUEST_FULL_DATA", id, stdio: "STDIN" });
15098
}}
151-
onsave={handleSaveAcceptedStdout}
99+
onsave={handleSaveStdin}
152100
oncancel={() => {
153-
postProviderMessage({
154-
type: "REQUEST_TRIMMED_DATA",
155-
id,
156-
stdio: "ACCEPTED_STDOUT",
157-
});
101+
postProviderMessage({ type: "REQUEST_TRIMMED_DATA", id, stdio: "STDIN" });
158102
}}
159-
>
160-
{#snippet actions()}
161-
{#if status === "AC" && testcase.mode !== "interactive"}
162-
<button
163-
class="action-button action-button--always-visible codicon codicon-close"
164-
data-tooltip="Decline Answer"
165-
aria-label="Decline"
166-
onclick={() => postProviderMessage({ type: "ACTION", id, action: "DECLINE" })}
167-
></button>
168-
{/if}
169-
{/snippet}
170-
</AutoresizeTextarea>
103+
/>
104+
<AutoresizeTextarea
105+
value={testcase.stderr}
106+
readonly
107+
hiddenOnEmpty
108+
variant="stderr"
109+
onexpand={() => handleExpandStdio("STDERR")}
110+
/>
111+
{#if testcase.mode === "interactive" || testcase.status !== "AC"}
112+
<AutoresizeTextarea
113+
value={testcase.stdout}
114+
readonly
115+
hiddenOnEmpty
116+
onexpand={() => handleExpandStdio("STDOUT")}
117+
>
118+
{#snippet actions()}
119+
{#if (status === "NA" || status === "WA") && testcase.mode !== "interactive"}
120+
<button
121+
class="action-button action-button--always-visible codicon codicon-pass"
122+
data-tooltip="Accept Output"
123+
aria-label="Accept"
124+
onclick={() => postProviderMessage({ type: "ACTION", id, action: "ACCEPT" })}
125+
></button>
126+
{/if}
127+
{#if status === "WA" && testcase.mode !== "interactive"}
128+
<button
129+
class="action-button action-button--always-visible codicon codicon-diff-single"
130+
data-tooltip="Compare Answers"
131+
aria-label="Compare"
132+
onclick={() => postProviderMessage({ type: "ACTION", id, action: "COMPARE" })}
133+
></button>
134+
{/if}
135+
{/snippet}
136+
</AutoresizeTextarea>
137+
{/if}
138+
{#if testcase.mode !== "interactive"}
139+
<AutoresizeTextarea
140+
bind:value={testcase.acceptedStdout}
141+
bind:editing={acceptedStdoutEditing}
142+
placeholder="Accepted output..."
143+
variant="accepted"
144+
onexpand={() => handleExpandStdio("ACCEPTED_STDOUT")}
145+
onpreedit={() => {
146+
postProviderMessage({ type: "REQUEST_FULL_DATA", id, stdio: "ACCEPTED_STDOUT" });
147+
}}
148+
onsave={handleSaveAcceptedStdout}
149+
oncancel={() => {
150+
postProviderMessage({
151+
type: "REQUEST_TRIMMED_DATA",
152+
id,
153+
stdio: "ACCEPTED_STDOUT",
154+
});
155+
}}
156+
>
157+
{#snippet actions()}
158+
{#if status === "AC" && testcase.mode !== "interactive"}
159+
<button
160+
class="action-button action-button--always-visible codicon codicon-close"
161+
data-tooltip="Decline Answer"
162+
aria-label="Decline"
163+
onclick={() => postProviderMessage({ type: "ACTION", id, action: "DECLINE" })}
164+
></button>
165+
{/if}
166+
{/snippet}
167+
</AutoresizeTextarea>
168+
{/if}
171169
{/if}
172170
{/if}
173171
</div>

src/webview/judge/TestcaseToolbar.svelte

Lines changed: 3 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -54,56 +54,7 @@
5454
const showDetails = $derived(!skipped && visible && !(status === "AC" && !toggled));
5555
</script>
5656

57-
{#if status === "CE"}
58-
<div class="toolbar" class:toolbar--hidden={skipped}>
59-
<div class="toolbar-badges">
60-
<div class="toolbar-badge-container toolbar-badge" data-status={status}>
61-
<div class="toolbar-icon toolbar-icon-exclude-highlight">
62-
<div class="codicon codicon-bolded codicon-terminal-bash"></div>
63-
</div>
64-
<p class="toolbar-badge-text">CE</p>
65-
</div>
66-
{#if testcase.mode === "interactive"}
67-
<div class="toolbar-badge-container toolbar-badge" data-status="CE">
68-
<div class="toolbar-icon toolbar-icon-exclude-highlight">
69-
<div class="codicon codicon-bolded codicon-chat-sparkle"></div>
70-
</div>
71-
</div>
72-
{/if}
73-
</div>
74-
<div class="testcase-buttons">
75-
<button class="toolbar-icon" data-tooltip="Run Testcase" aria-label="Run" onclick={handleRun}>
76-
<div class="codicon codicon-run-below"></div>
77-
</button>
78-
<button
79-
class="toolbar-icon"
80-
data-tooltip="Debug Testcase"
81-
aria-label="Debug"
82-
onclick={handleDebug}
83-
>
84-
<div class="codicon codicon-debug-alt"></div>
85-
</button>
86-
<button
87-
class="toolbar-icon"
88-
data-tooltip="Delete Testcase"
89-
aria-label="Delete"
90-
onclick={handleDelete}
91-
>
92-
<div class="codicon codicon-trash"></div>
93-
</button>
94-
<button
95-
class="toolbar-icon toolbar-icon--visibility"
96-
data-tooltip={skipped ? "Unskip Testcase" : "Skip Testcase"}
97-
aria-label={skipped ? "Unskip" : "Skip"}
98-
onclick={handleToggleSkip}
99-
>
100-
<div
101-
class="codicon {skipped ? 'codicon-debug-connected' : 'codicon-debug-disconnect'}"
102-
></div>
103-
</button>
104-
</div>
105-
</div>
106-
{:else if status === "NA" || status === "AC" || status === "WA" || status === "RE" || status === "TL" || status === "ML"}
57+
{#if status === "NA" || status === "AC" || status === "WA" || status === "RE" || status === "TL" || status === "ML" || status === "CE"}
10758
<div class="toolbar" class:toolbar--hidden={skipped}>
10859
<div class="toolbar-badges">
10960
<div
@@ -137,6 +88,8 @@
13788
<div class="codicon codicon-bolded codicon-clock"></div>
13889
{:else if status === "ML"}
13990
<div class="codicon codicon-bolded codicon-chip"></div>
91+
{:else if status === "CE"}
92+
<div class="codicon codicon-bolded codicon-terminal-bash"></div>
14093
{/if}
14194
</div>
14295
<p class="toolbar-badge-text">

0 commit comments

Comments
 (0)