Skip to content
Merged
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: 9 additions & 0 deletions src/commons/application/Application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ const Application: React.FC = () => {
case MessageTypeNames.AssessmentAnswer:
dispatch(SessionActions.submitAnswer(message.questionId, message.answer));
break;
case MessageTypeNames.SetEditorBreakpoints:
dispatch(
WorkspaceActions.setEditorBreakpoint(
message.workspaceLocation,
0,
message.newBreakpoints
)
);
break;
}
});
// eslint-disable-next-line react-hooks/exhaustive-deps
Expand Down
8 changes: 6 additions & 2 deletions src/commons/assessmentWorkspace/AssessmentWorkspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -412,14 +412,16 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
case QuestionTypes.programming || QuestionTypes.voting:
const prepend = question.prepend;
const code = question.answer ?? question.solutionTemplate;
const breakpoints = editorTabs[0]?.breakpoints ?? [];
sendToWebview(
Messages.NewEditor(
workspaceLocation,
`assessment${assessment.id}`,
props.questionId,
chapter,
prepend,
code
code,
breakpoints
)
);
break;
Expand Down Expand Up @@ -449,14 +451,16 @@ const AssessmentWorkspace: React.FC<AssessmentWorkspaceProps> = props => {
// TODO: Hardcoded to make use of the first editor tab. Refactoring is needed for this workspace to enable Folder mode.
handleEditorValueChange(0, answer);
// Hacky way to view the editor, might cause issues
const breakpoints = editorTabs[0]?.breakpoints ?? [];
sendToWebview(
Messages.NewEditor(
workspaceLocation,
`submission${_submissionId}`,
questionId,
question.library.chapter,
'',
answer
answer,
breakpoints
)
);
//
Expand Down
12 changes: 9 additions & 3 deletions src/features/vscode/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,16 @@ const Messages = createMessages({
questionId: number,
chapter: number,
prepend: string,
initialCode: string
initialCode: string,
breakpoints: string[]
) => ({
workspaceLocation,
assessmentName,
questionId,
chapter,
prepend,
initialCode
initialCode,
breakpoints
}),
Text: (workspaceLocation: VscWorkspaceLocation, code: string) => ({
workspaceLocation,
Expand Down Expand Up @@ -99,7 +101,11 @@ const Messages = createMessages({
questionId,
answer
}),
LoginWithBrowser: (route: string) => ({ route })
LoginWithBrowser: (route: string) => ({ route }),
SetEditorBreakpoints: (workspaceLocation: VscWorkspaceLocation, newBreakpoints: string[]) => ({
workspaceLocation,
newBreakpoints
})
});

export default Messages;
Expand Down
4 changes: 3 additions & 1 deletion src/pages/playground/Playground.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -381,14 +381,16 @@ const Playground: React.FC<PlaygroundProps> = props => {
return;
}
const initialCode = editorTabs[0]?.value ?? '';
const breakpoints = editorTabs[0]?.breakpoints ?? [];
sendToWebview(
Messages.NewEditor(
workspaceLocation,
'playground',
1,
playgroundSourceChapter,
'',
initialCode
initialCode,
breakpoints
)
);
// We don't want to re-send this message even when the variables change
Expand Down
Loading