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)

Open
#1,309 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
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:

  1. open an .Rmd file
  2. type $$ for math typesetting
  3. move the mouse cursor between $$
  4. 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:
image

The correctly reflected math scopes in .md files:
image

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.