Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,12 @@ export type SubmitCf = {
export type SubmitCSES = {
command: 'submitCSES';
} & WebviewMessageCommon;

export type SubmitCodeChef = {
command: 'submitCodeChef';
} & WebviewMessageCommon;
export type SubmitAtcoder = {
command: 'submitAtcoder';
} & WebviewMessageCommon;
export type SubmitKattis = {
command: 'submitKattis';
} & WebviewMessageCommon;
Expand Down Expand Up @@ -229,6 +234,8 @@ export type WebviewToVSEvent =
| DeleteTcsCommand
| SubmitCf
| SubmitCSES
| SubmitCodeChef
| SubmitAtcoder
| OnlineJudgeEnv
| SubmitKattis
| OpenUrl
Expand Down
8 changes: 8 additions & 0 deletions src/webview/JudgeView.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ class JudgeViewProvider implements vscode.WebviewViewProvider {
storeSubmitProblem(message.problem);
break;
}
case 'submitCodeChef': {
storeSubmitProblem(message.problem);
break;
}
case 'submitAtcoder': {
storeSubmitProblem(message.problem);
break;
}
case 'submitKattis': {
submitKattisProblem(message.problem);
break;
Expand Down
38 changes: 37 additions & 1 deletion src/webview/frontend/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,22 @@ function Judge(props: {

setWaitingForSubmit(true);
};
const submitCodeChef = () => {
sendMessageToVSCode({
command: 'submitCodeChef',
problem,
});

setWaitingForSubmit(true);
};
const submitAtcoder = () => {
sendMessageToVSCode({
command: 'submitAtcoder',
problem,
});

setWaitingForSubmit(true);
};
const debounceFocusLast = () => {
setTimeout(() => {
setFocusLast(false);
Expand Down Expand Up @@ -572,7 +588,9 @@ function Judge(props: {
if (
!url.hostname.endsWith('codeforces.com') &&
url.hostname !== 'open.kattis.com' &&
!url.hostname.endsWith('cses.fi')
!url.hostname.endsWith('cses.fi') &&
!url.hostname.endsWith('codechef.com') &&
!url.hostname.endsWith('atcoder.jp')
) {
return null;
}
Expand Down Expand Up @@ -622,6 +640,24 @@ function Judge(props: {
{t('submit')}
</button>
);
} else if (url.hostname.endsWith('codechef.com')) {
return (
<button className="btn btn-block" onClick={submitCodeChef}>
<span className="icon">
<i className="codicon codicon-cloud-upload"></i>
</span>{' '}
{t('submit')}
</button>
);
} else if (url.hostname.endsWith('atcoder.jp')) {
return (
<button className="btn btn-block" onClick={submitAtcoder}>
<span className="icon">
<i className="codicon codicon-cloud-upload"></i>
</span>{' '}
{t('submit')}
</button>
);
}
};

Expand Down
Loading