languageserver
languageserver copied to clipboard
Code folding won't work if there is a single grammar error in one of the code trunks
A minimum RMD to reproduce this:
```{r}
good()
```
**You need to fix the following code trunk for the code folding to work.**
```{r}
bad(
```
Ideally a single error in one of the code trunks should not affect the code folding of the entire document.
Currently, we parse the whole document rather than chunks to provide the folding ranges, which assumes that the document is syntactically correct.
If we process rmd document chunk by chunk, then it is perfectly possible to make not only the folding ranges but also some other features more error tolerant.
I think we need to at least support eval = FALSE
by the chunk options.
It would also be nice to be able to alert users of grammatical errors. How difficult is this to implement?
Diagnostics are supported for Rmarkdown documents in languageserver
's perspective. @renkun-ken would know more about vscode.