Syntax highlighting fails when there's a vector argument
See original GitHub issueI came here by following the link in [...]/code/resources/app/extensions/r/syntaxes/r.tmLanguage.json
so I hope I’m in the right place.
Describe the bug
A clear and concise description of what the bug is.
The following code breaks the syntax highlighting; everything after the last quote is considered part of an (unfinished) string
fun <- function(a, c = c("a", "()"), d) {
function body, not a quoted string
}
It seems to view the close bracket within the quoted string as the end of the function args.
To Reproduce Steps to reproduce the behavior:
- Open an R file
- Copy or type that code
- Observe the results
Do you want to fix by self? (We hope your help!)
I have tried to, but I’m not familiar with textmate grammars… so… maybe? I gather I’ve got to mess with function-parameters so that it no longer views the close bracket as the end of the function args, probably by allowing arguments to have default values that are the evaluation of function calls
(If yes,) what kind of help do you want? (e.g. Which file should I fix, Survey (related documents)
Expected behavior Pretty clear I think
Screenshots Above
Environment (please complete the following information):
- OS: Linux
- VSCode Version: [e.g. 1.58.2]
- not important
- also unimportant, but I’m testing with the current language definition in this repo
Issue Analytics
- State:
- Created 2 years ago
- Comments:11 (7 by maintainers)
The issue is definitely with the function declarations section, replacing the
function-declarations
match pattern with the textmate repo’s pattern fixes the issue.(to state the obvious) it looks like brackets are still being parsed as punctuation when quoted and in the presence of
function
. this leads me to think it’s an issue with thefunction-declarations
definition