vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Incorrect syntax highlighting of named function arguments with aligned `=`

Open Darxor opened this issue 1 year ago • 2 comments

Describe the bug In some function calls named arguments with = padded by leading spaces/tabs are not highlighted as usual named arguments. I suspect this is an issue with https://github.com/REditorSupport/vscode-R/blob/master/syntax/r.json, so posting it here.

To Reproduce Any custom, i.e. not differently highlighted function call (not base-R? I don't really understand why they are different, really) experience this issue:

# Arguments with padded `=` are not highlighted correctly
mutate(
  df,
  b   = 1L,
  baa = 1L,
  c   = 1L
)
myfun(
  b   = 1L,
  baa = 1L,
  c   = 1L
)

But does work as expected with some (again, base-R?) function calls.

# Arguments with padded `=` ARE highlighted correctly
list(
  b   = 1L,
  baa = 1L,
  c   = 1L
)
paste0(
  b   = 1L,
  baa = 1L,
  c   = 1L
)

Expected behavior Named function arguments are highlighted in the same way, despite

Screenshots Theme like Monokai makes the issue especially apparent, because it has styles for both the name and the =: image

Environment:

  • OS: Windows 11
  • VSCode Version: 1.77.3
  • R Version: 4.2.3
  • vscode-R version: 2.7.2

Darxor avatar Apr 25 '23 12:04 Darxor