add positions and contents of each 'arg' component of the code
Add in the starting position (i.e., # of characters offset from the start of the code string) and the actual contents of each 'arg' argument to the code so that we can connect the actual code to the proper part of the table
https://github.com/seankross/mario/blob/69e07116632708d371e13db6d1c25074cac706d2/inst/test/correct/mutate-2.json#L58
we discussed trying to get the start and end indices in the original code string where each argument resides, so that we can render the original code and highlight those arguments within the context of the original unmodified code
... on second thought, i just realized that the code for each stage is already 'canonicalized', so maybe it makes more sense to actually just split it into a list like sean originally suggested because it's going to be canonicalized anyways ... let's discuss more later, @seankross
The plan is for mario to provide a list containing the parsed form of the expression so that we can easily grab the arguments by index out of them
even better, it would be good to see the ENTIRE pipeline expression, along with the current stage. that way, users can see where in the pipeline the current stage is. e.g., for something like: iris %>% select(starts_with("blahblah")) %>% slice(50:45) %>% select(starts_with("foo"))
just seeing slice(50:45) by itself in a stage doesn't give that much context. what's being sliced? it would be good to also see where that operation lies in the overall pipeline, so that it can be bolded. e.g.,:
iris %>% select(starts_with("blahblah")) %>% slice(50:45) %>% select(starts_with("foo"))
[edit: this is low-priority, i've kinda gotten used to seeing each stage in isolation, and there's always the full original code for the user to refer back to anyways. so maybe this isn't so important]
Index it into the code string:
"code_step": "mutate(Three = 3, 1 + 3, Three = NULL)",
"mapping": [
{
"illustrate": "outline",
"select": "column",
"from": {
"anchor": "arg",
"start": 2,
"end": 6,
},
"to": {
"anchor": "rhs",
"index": 3
}
}
],