Skip to content

R tokenizing glitch with c() in function args #120

@alexr00

Description

@alexr00

From @Hong-Revo in microsoft/vscode#79559

  • VSCode Version: 1.37.1 (system)
  • OS Version: Windows 10 Pro 1903

There seems to be a (rather specific) bug in how character vectors are tokenized. When you have c("a", "b", ...) as a default function argument, the strings except for the first one are not treated as text:

image

It only appears to happen when the c function is used; you can see that list doesn't have this problem. Similarly, if you have a character vector anywhere other than as a default function arg, it's coloured correctly.

Steps to reproduce

  1. Type f <- function(a=c("a", "b", "c")) {} in an R editing window.
  2. Note the colour of the strings.

The first string has the following scopes:
string.quoted.double.r
meta.function.parameters.r
meta.function.r
meta.function.r
source.r

The subsequent strings have the following scopes:
variable.parameter.r
meta.function.parameters.r
meta.function.r
meta.function.r
source.r

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions