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 2 years ago • 2 comments
trafficstars

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

Another note, maybe related. If arguments are named with a character string inside "", they are also highlighted diffrently, even in base-R calls:

list(
  "a" = 1,
  "b" = 2
  c = 3
)
image

Darxor avatar Apr 25 '23 20:04 Darxor

This issue is stale because it has been open for 365 days with no activity.

github-actions[bot] avatar Apr 25 '24 01:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 09 '24 01:05 github-actions[bot]