Skip to content

Commit 7ffa63d

Browse files
committed
Move the open interactor button to the title bar
1 parent 8343578 commit 7ffa63d

File tree

6 files changed

+35
-36
lines changed

6 files changed

+35
-36
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- Made text expansion editor's title human-friendly
1212
- Removed non-essential information pop-ups
13+
- Moved the "Open Interactor" button to the Judge's title section instead
1314

1415
### Fixed
1516

package.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@
5555
"when": "view == fastolympiccoding.judge"
5656
},
5757
{
58-
"command": "fastolympiccoding.toggleJudgeSettings",
58+
"command": "fastolympiccoding.openInteractorFile",
5959
"group": "navigation@7",
6060
"when": "view == fastolympiccoding.judge"
6161
},
62+
{
63+
"command": "fastolympiccoding.toggleJudgeSettings",
64+
"group": "navigation@8",
65+
"when": "view == fastolympiccoding.judge"
66+
},
6267
{
6368
"command": "fastolympiccoding.startStressTest",
6469
"group": "navigation@1",
@@ -383,6 +388,12 @@
383388
"category": "Fast Olympic Coding",
384389
"icon": "$(gear)"
385390
},
391+
{
392+
"command": "fastolympiccoding.openInteractorFile",
393+
"title": "Open Interactor File",
394+
"category": "Fast Olympic Coding",
395+
"icon": "$(go-to-file)"
396+
},
386397
{
387398
"command": "fastolympiccoding.toggleStressSettings",
388399
"title": "Toggle Stress Settings",

src/extension/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,12 @@ function registerCommands(context: vscode.ExtensionContext): void {
278278
)
279279
);
280280

281+
context.subscriptions.push(
282+
vscode.commands.registerTextEditorCommand("fastolympiccoding.openInteractorFile", () =>
283+
judgeViewProvider.openInteractorFile()
284+
)
285+
);
286+
281287
context.subscriptions.push(
282288
vscode.commands.registerTextEditorCommand(
283289
"fastolympiccoding.startStressTest",

src/extension/providers/JudgeViewProvider.ts

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -966,6 +966,22 @@ export default class extends BaseViewProvider<typeof ProviderMessageSchema, Webv
966966
super._postMessage({ type: "SETTINGS_TOGGLE" });
967967
}
968968

969+
openInteractorFile() {
970+
if (!this._currentFile) {
971+
return;
972+
}
973+
const settings = getFileRunSettings(this._currentFile);
974+
if (!settings) {
975+
return;
976+
}
977+
978+
if (settings.interactorFile) {
979+
void openOrCreateFile(settings.interactorFile);
980+
} else {
981+
void vscode.window.showWarningMessage("Interactor file not specified");
982+
}
983+
}
984+
969985
// Background task management
970986
getBackgroundTasksForFile(file: string): string[] {
971987
const context = this._contexts.get(file);
@@ -1051,9 +1067,6 @@ export default class extends BaseViewProvider<typeof ProviderMessageSchema, Webv
10511067
case "COMPARE":
10521068
this._compare(uuid);
10531069
break;
1054-
case "OPEN_INTERACTOR":
1055-
this._openInteractor();
1056-
break;
10571070
case "TOGGLE_INTERACTIVE":
10581071
this._toggleInteractive(uuid);
10591072
break;
@@ -1645,22 +1658,6 @@ export default class extends BaseViewProvider<typeof ProviderMessageSchema, Webv
16451658
await vscode.env.clipboard.writeText(value);
16461659
}
16471660

1648-
private _openInteractor() {
1649-
if (!this._currentFile) {
1650-
return;
1651-
}
1652-
const settings = getFileRunSettings(this._currentFile);
1653-
if (!settings) {
1654-
return;
1655-
}
1656-
1657-
if (settings.interactorFile) {
1658-
void openOrCreateFile(settings.interactorFile);
1659-
} else {
1660-
void vscode.window.showWarningMessage("Interactor file not specified");
1661-
}
1662-
}
1663-
16641661
private _stdin({ uuid, data }: v.InferOutput<typeof StdinMessageSchema>) {
16651662
const testcase = this._findTestcase(uuid);
16661663
if (!testcase) {

src/shared/judge-messages.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ export const ActionValues = [
1313
"COMPARE",
1414
"DEBUG",
1515
"REQUEST_DATA",
16-
"OPEN_INTERACTOR",
1716
"TOGGLE_INTERACTIVE",
1817
] as const;
1918

src/webview/judge/TestcaseToolbar.svelte

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -199,17 +199,6 @@
199199
>
200200
<div class="codicon codicon-trash"></div>
201201
</button>
202-
{#if testcase.mode === "interactive"}
203-
<div class="spacer"></div>
204-
<button
205-
class="toolbar-icon"
206-
data-tooltip="Open Interactor"
207-
aria-label="Open Interactor"
208-
onclick={() => handleAction("OPEN_INTERACTOR")}
209-
>
210-
<div class="codicon codicon-go-to-file"></div>
211-
</button>
212-
{/if}
213202
</div>
214203
</div>
215204
{:else if status === "COMPILING"}
@@ -366,10 +355,6 @@
366355
flex-grow: 1;
367356
}
368357
369-
.spacer {
370-
flex-grow: 1;
371-
}
372-
373358
.toolbar-icon {
374359
display: flex;
375360
align-items: center;

0 commit comments

Comments
 (0)