Text of non-'.Rmd' markdown files is analyzed as R code
See original GitHub issueI would like to use the VSCode R extension to “knit” plain Markdown files in addition to R Markdown files. To do so, I associated the file extension md
with the R Markdown language. In settings.json
:
"files.associations": {
"*.md": "rmd"
},
That works, and I can now press Ctrl+Shift+K to knit the document.
However, I get a strange linting (?) error:
It seems to be triggered by short words, but only by the first one in the text, later repetitions are ignored.
In this case, the error details are
[{
"resource": "/home/ca/Store/lab/pandoc-ng/notes.md",
"owner": "_generated_diagnostic_collection_name_#0",
"severity": 8,
"message": "unexpected symbol",
"source": "error",
"startLineNumber": 1,
"startColumn": 6,
"endLineNumber": 1,
"endColumn": 7
}]
Hovering over the word opens documentation for the R function is(object, class2)
. It therefore appears as if the text is analyzed as R code?
This interpretation is supported by another observation: If I write a few letters and then activate suggestions (e.g. by Ctrl+Space) I get R-language suggestions:
Describe the bug
The text of non-‘.Rmd’ markdown files is analyzed as R code
To Reproduce Steps to reproduce the behavior:
- Create a file with the extension
.md
and open it. - Associate
.md
with the languagermd
- Write “what is this”.
- A red squiggle appears under “is”.
Do you want to fix by self? (We hope your help!)
I tried to simply disable linting, but couldn’t find an option to do so.
(If yes,) what kind of help do you want? (e.g. Which file should I fix, Survey (related documents)
Since this same behavior does not appear for .Rmd
files, I suspect that some kind of exception is hard-coded for this file extension. I propose to create an option which allows to configure which file extension(s) are excepted. This would allow to use Markdown processing to be used in VS Code in the same way as it can be used in RStudio.
Environment (please complete the following information):
- OS: Debian 11.2
- VSCode Version: 1.63.2
- R Version: 4.0.4
- vscode-R version: 2.3.5
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (5 by maintainers)
No need to close this one. Will close both together in the PR.
The linting error does not occur anymore.
Thanks for the quick fix!