-
Notifications
You must be signed in to change notification settings - Fork 7
Tutorial Configuration
This is the general JSON structure which is appended at the end of the course configuration json:
"tutorials": {
"24496": { //the assignment’s id
"tasks": [
//the steps of the Tutorial
]
}
}
8. REPL input with includes check
14. Close a running application
For every step, we specify which component will be highlighted in the field “component”. It can also be an array of more than one component.
The fields “instruction” and “info” are the title and subtitle of each Task, providing directions as to what the student needs to do for the Task.
The field “action” has specific unique values that are used by the plugin in order to know what kind of Task this is and handle it accordingly.
The field "assertClosed" can be used to make sure that a component is closed before the beginning of a Task (an example is given in category 6)
{
"instruction": "Now, open Match.scala!",
"component": "projectTree",
"info": "Hint: there is a typo in the name",
"action": "openEditor",
"assertClosed": ["editor"],
"actionArguments": {
"<mark>filePath</mark>": "Football1/o1/football1/Match.scala"
}
}
“filePath”: the path of the file to be opened by the student.
{
"instruction": "Now, build the module Football1",
"component": "projectTree",
"info": "You can still see your project's files here.",
"action": "build",
"actionArguments": {
"actionName": "Build Module 'Football1'"
}
}
“actionName”: The name of the build action that is used by IntelliJ
{
"instruction": "Now, comment out the line!",
"component": "editor",
"info": "Hint: this.velocity = this.velocity.switchY",
"action": "comment",
"actionArguments": {
"filePath": "Pong/o1/pong/Ball.scala",
"text": "this.velocity = this.velocity.switchY"
}
}
“filePath”: the file that should be edited
“text”: the text that the commented-out line should have.
{
"instruction": "Now, run PongApp",
"component": "projectTree",
"info": "You can still see your project's files here.",
"action": "run",
"actionArguments": {
"actionNames": [
"Run 'PongApp'"
],
"filePath": "PongApp"
}
}
"actionNames": the accepted names of the triggered IntelliJ actions.
"filePath": the name of the application to be run (more specifically the file through which it is initiated).
{
"instruction": "Now, observe PongApp, close it and come back here.",
"component": [
"build",
"editor"
],
"freeRange": true,
"info": "You can click on this button when you are done with this step.",
"action": "null",
"actionArguments": {
"filePath": "Football1/o1/football1/MatchTest.scala"
}
}
By adding the field “freeRange” set to true, this Task will not have listeners registered and instead, there will be a button available that the students will click to signal that they are done with the described Task.
The field “filePath” will be used only if necessary for one of the highlighted areas. E.g. in the above Task, the editor should be highlighted so we provide also the path of the file that should be open in the editor.
{
"instruction": "open repl for GoodStuff",
"component": "projectTree",
"info": "",
"action": "openRepl",
"assertClosed": [
"repl"
],
"actionArguments": {
"module": "GoodStuff"
}
}
The field “assertClosed” makes sure that any existing REPL windows are closed so that the students will have to complete the step on their own and not by accident.
The “module” field specifies which module the REPL will be opened for.
{
"instruction": "enter '1 + 1'",
"component": "repl",
"info": "",
"action": "replInput",
"actionArguments": {
"module": "GoodStuff",
"input": "1+1",
"output": "Int = 2"
}
}
“input”: the command to be given by the user.
“output”: the output to be displayed by the REPL console.
The “module” field specifies which module the REPL will be opened for.
{
"instruction": "try more arithmetic operations 1/3",
"component": "repl",
"info": "enter expression containing either +, -, * or /",
"action": "replInputContains",
"actionArguments": {
"module": "GoodStuff",
"inputs": [
"+",
"-",
"*",
"/"
],
"output": "Int ="
}
}
“module”: The “module” field specified which module the REPL will be opened for.
“inputs”: An array of the tokens at least one of which needs to be included in the REPL command given by the student.
“output”: This text should be contained in the REPL’s output.
{
"instruction": "Now, change the value assigned to BallRadius!",
"component": "editor",
"info": "Hint: change to 50",
"action": "declareVariable",
"actionArguments": {
"filePath": "Pong/o1/pong/package.scala",
"variableName": "BallRadius",
"variableType": "val",
"valueTokens": [
"50"
]
}
}
“filePath”: the file that should be edited to contain the variable
“variableName”: the name of the variable
“variableType”: whether the variable should be var or val
“valueTokens”: the lexical tokens that describe the value that should be assigned to the variable (without the equals sign)
{
"instruction": "Now fix the title at CategoryDisplayWin.scala!",
"component": "editor",
"info": "Hint: there is a typo in the name",
"action": "assignStatement",
"actionArguments": {
"filePath": "GoodStuff/o1/goodstuff/gui/CategoryDisplayWindow.scala",
"variableName": "this.title",
"valueTokens": [
"\"GoodStuff Diary - Category: \"",
"+",
"category",
".",
"name",
"+",
"\" Experiences\""
]
}
}
Used to assign a value to an already declared variable.
“filePath”: the file that should be edited to contain the variable
“variableName”: the name of the variable
“valueTokens”: the lexical tokens that describe the value that should be assigned to the variable (without the equals sign)
{
"instruction": "Now, fix Match’s declaration!",
"component": "editor",
"info": "Something is missing.",
"action": "classDeclScala",
"actionArguments": {
"className": "Match",
"classArguments": [
"val home:String",
"val away:String"
],
"classHierarchy": "",
"traitHierarchy": [],
"typeParamClause": "",
"modifiers": [
"",
""
],
"annotations": [
"",
""
],
"filePath": "Football1/o1/football1/Match.scala"
}
}
“filePath”: the file that should be edited to contain the variable
“className”: the name of the declared class
“classArguments”: the arguments to be given to the constructor
“classHierarchy”: can be left empty, any classes that our class extends
“traitHierarchy”: any traits that our class incorporates using the “with” keyword
“typeParamClause”: any type parameters for the class
“modifiers”: an array where each value corresponds to each of the arguments specified previously, used to define the modifiers of each argument.
“annotations”: an array where each value corresponds to each of the arguments specified previously, used to define the annotations of each argument.
{
"instruction": "Now, fix the totalGoals method's definition!",
"component": "editor",
"info": "You can still see your project's files here.",
"action": "functionDefinition",
"actionArguments": {
"methodName": "totalGoals",
"methodArguments": [],
"methodBody": [
"{",
"this.homeGoals",
"+",
"this.awayGoals",
"}"
],
"typeParamClause": "",
"filePath": "/Football1/o1/football1/Match.scala",
"checkEquals": "true"
}
}
“filePath”: the file that should be edited to contain the function
“methodName”: the name of the method
“methodArguments”: an array that includes the arguments of the method.
“methodBody”: the contents of the method. To be specified by a developer according to how the PSI interprets the code.
“typeParamClause”: possible type parameters
“checkEquals”: set to true if the existence of an “=” sign between the function’s signature and body is necessary.
{
"instruction": "Now, fix the println method call at MatchTest.scala!",
"component": "editor",
"info": "Hint: you should call clubs' methods",
"action": "methodCall",
"actionArguments": {
"filePath": "Football1/o1/football1/MatchTest.scala",
"methodName": "println",
"argsList": [
"match1.goalDifference"
]
}
}
“filePath”: the file that should be edited to contain the method call
“methodName”: the name of the method to be called
“argsList”: an array with the arguments that should be passed to the method
{
"instruction": "Now, stop PongApp",
"component": "projectTree",
"info": "You can still see your project's files here.",
"action": "stop",
"actionArguments": {
"appName": "PongApp"
}
}
“appName”: the name of the application to be stopped