REditorSupport / REditorSupport/vscode-R
Textmate scopes in .Rmd files does not show relevant math scopes (correct math scopes in both .md and .latex files as a comparison)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.2k
- Forks
- 139
- Avg merge
- 2h 46m
- Merged PRs (30d)
- 5
Description
Describe the bug
I cannot use user-defined snippets to typeset math in .Rmd files because the math scopes are not correctly reflected in .Rmd files.
In .md files or .qmd files, typesetting using user-defined snippets works smoothly because the math scopes are correctly reflected.
.Rmd files should be consistent with .md and .qmd files in correctly identifying math scopes so that users can use user-defined context-specific math snippets to speed up typesetting math in .Rmd files.
To Reproduce
Steps to reproduce the behavior:
- open an .Rmd file
- type $$ for math typesetting
- move the mouse cursor between $$
- presss ctrl + shift + p, then select "developer: inspect editor tokens and scopes," inspect the output: for .Rmd files, the "textmate scopes" does not show any math scope
Repeat the same procedure for a .md file or a .qmd file, the math scopes are correctly shown.
Can you fix this issue by yourself? (We appreciate the help)
Not without some guidance.
(If yes,) can we assist you with anything?
If there is a fix that I can accomplish, I would need some help to know what I need to do, because I have searched for a solution for a while but to no avail.
(If applicable) Please attach setting.json
N/A
Expected behavior
the relevant math scopes should be correctly reflected in .Rmd files like in .md and .qmd files
Screenshots
The absence of math scopes in .Rmd files:

The correctly reflected math scopes in .md files:

Environment (please complete the following information):
- OS: Windows 11
- VSCode Version: 1.75.1
- R Version: 4.2.2
- vscode-R version: 2.7.1
Additional context
N/A
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the scope inspection in an .Rmd file, then compare its output with .md and .qmd files using Developer: Inspect Editor Tokens and Scopes. Trace the extension's TextMate grammar or language configuration for R Markdown and compare how math scopes are assigned; done means math scopes appear between $$ in .Rmd files and context-specific snippets can use them.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- markdown, r, typescript, vscode
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100