Skip to content

Syntax highlighting fails when there's a vector argument #713

@alanocallaghan

Description

@alanocallaghan

I 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
}

syntax

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:

  1. Open an R file
  2. Copy or type that code
  3. 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions