typo in Rmd chunk definition produces confusing error message
mkoohafkan opened this issue · 1 comments
I made a stupid typo and defined a chunk as
```{r]
i.e., I accidentally ended the chunk header with a square bracket ]
instead of a curly brace }
.
Code in the chunk is still highlighted correctly and the chunk has the standard grey background color etc. RTVS doesn't detect a coding error there either. When I try to run the chunk with Ctrl+Alt+C I get the error message
Index was outside the bounds of the array
Which doesn't really indicate the problem.
It might be helpful to improve the error message, or do a slightly more robust check that chunk header syntax is correct.
Out of bounds error is a bug obviously. The other part is semi by design. R code begins after {r
since { }
block can contain list of arguments. So highlight remains even if block is terminated by ']' or not terminated at all - highlight includes all R code from {
to the closing triple tick.