-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Text of non-'.Rmd' markdown files is analyzed as R code #930
Comments
Currently, the language server uses file extension to determine if a file is rmd. If you are editing an rmd, is there a reason you don't use |
I understand that the R language server would not treat a file as R Markdown which it does not detect as R Markdown (based on the extension). But why would it treat it as R code (instead of simply not treating it at all)? Also I think that's somewhat at odds with the language logic in VS Code. File extensions are used to detect languages, but they don't define them. Apart from explicit association of another extension in the configuration, there is also the language chooser in the status bar. This choice should ultimately determine how a file is processed.
A Markdown file that doesn't contain code chunks is not really an You may say that the extension is not meant for pure Markdown, but the functionality in RStudio (based on |
It is because language server treats In VS Code API, each document (not necessarily a stored file but also untitled document) is associated with a I check the Language Server Protocol, and we do have access to the
Yes, you are correct. Once we respect the document |
Thanks! It appears that new issue on |
No need to close this one. Will close both together in the PR. |
Would you like to try installing REditorSupport/languageserver#511? It should work now. |
I would, but I don't know how to install the unpublished modified version of an R package. |
Just run the following in your R terminal: remotes::install_github("REditorSupport/languageserver#511") |
The linting error does not occur anymore. Thanks for the quick fix! |
I 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. Insettings.json
: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
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:
.md
and open it..md
with the languagermd
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):
The text was updated successfully, but these errors were encountered: