Skip to content

Commit 7b5d34d

Browse files
committed
Feat: reset functionality for vsc
1 parent 31b6461 commit 7b5d34d

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/commons/assessmentWorkspace/AssessmentWorkspace.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,11 @@ It is safe to close this window.`}
929929
(assessment!.questions[questionId] as IProgrammingQuestion).solutionTemplate
930930
);
931931
handleUpdateHasUnsavedChanges(true);
932+
if (isVscode) {
933+
934+
sendToWebview(Messages.ResetEditor(workspaceLocation,
935+
(assessment!.questions[questionId] as IProgrammingQuestion).solutionTemplate));
936+
}
932937
}}
933938
options={{ minimal: false, intent: Intent.DANGER }}
934939
/>

src/features/vscode/messages.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ const Messages = createMessages({
9090
questionId,
9191
chapter,
9292
variant
93+
}),
94+
ResetEditor: (
95+
workspaceLocation: VscWorkspaceLocation,
96+
initialCode: string,
97+
) => ({
98+
workspaceLocation,
99+
initialCode,
93100
})
94101
});
95102

0 commit comments

Comments
 (0)