R syntax highlighting broken: variables not recognized as token, appear as plain white
Bug Description
After updating all my VSCode extensions today (including the R extension by REditorSupport), I noticed that R variables are no longer highlighted correctly. All variables appear as plain white text, while other elements (e.g., strings, functions, comments) are highlighted properly.
Using Developer: Inspect Editor Tokens and Scopes, I found that variables are only assigned the scope source.r, with no variable.other.r or other fine-grained scopes. As a result, my theme does not apply any color to variables.
Environment
- VSCode version: 1.102.2.0
- R extension version: R 2.8.6
- R Syntax extension version: 0.1.3
- Operating system: Windows 11 Pro (build 26100.4770)
- Color theme: Pink Cat Boo
Steps to Reproduce
- Install the latest
RandR Syntaxextensions - Open any
.Rfile in VSCode - Highlight any variable and run
Developer: Inspect Editor Tokens and Scopes - Observe that the scope is only
source.r, with no variable-specific token - Variable remains white regardless of theme
Additional Info
- Reinstalling / downgrading the R extension does not help
- Changing color themes does not solve the issue
- This issue did not occur before I updated all extensions today
- Other users have reported similar issues recently
Expected Behavior
Variables in R files should be recognized with appropriate token scopes like variable.other.r, so that themes can apply custom colors.
Please let me know if I can help test or trace further.
Thank you for maintaining this extension!
I encountered similar problem, but its function syntax hightlight. The base R got function syntax highlight, but the the definied function and tidyverse functions are no syntax highlight.
Environment
- VSCode version: 1.103.0
- R extension version: R 2.8.6
- R Syntax extension version: 0.1.3
- Operating system: Windows 11 Enterprise, 24H2, 26100.4770, WSL2 Ubuntu 24.04.1 LTS
- Color theme: Github Dark
I encountered the same problem, have you found a solution?I currently only use the following statement in the setting.json
I encountered the same problem, have you found a solution?I currently only use the following statement in the setting.json
![]()
Unfortunately, the issue still persists for me. I’ve already updated both VSCode and the relevant extensions (R and R Syntax) to their latest versions, but variables are still not being highlighted — they only appear as plain white text. So far, I haven’t found a workaround that restores the previous variable highlighting.
I think this is duplicate of REditorSupport/languageserver#692
I encountered the same problem, have you found a solution?I currently only use the following statement in the setting.json
![]()
I mostly copy-pasted from @rxz1l and tweaked a little, and finally got the following that seems to be working (and seems to be roughly replicating RStudio function coloring):
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"scope": [
"support.function.r",
"entity.name.function.r",
"meta.function-call.r",
],
"settings": {
"foreground": "#61AFEF",
"fontStyle": "",
},
},
{
"scope": "meta.function-call.arguments.r",
"settings": { "foreground": "#ABB2BF" },
},
],
},
Here's the result (with Atom One Dark theme):
The second scope for "meta.function-call.arguments.r" is to set the foreground color back to the default foreground color for the arguments, because those arguments are both "meta.function-call.arguments.r" and "meta.function-call.r". Without this override, the arguments will be colored in the same way as the function calls. If you have other default foreground colors, you might need to change it.
Hope it helps.
Why not revert to the original behavior and wait for the language server to implement semanticTokens? This kind of breaking change is quite frustrating to use.

