Skip to content
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

add languages r and rmarkdown #1998

Merged
merged 5 commits into from
Apr 8, 2022
Merged

add languages r and rmarkdown #1998

merged 5 commits into from
Apr 8, 2022

Conversation

mtoohey31
Copy link
Contributor

A few notes:

  • The queries for r files are copied from the grammar here.
  • All the queries for rmarkdown inherit from markdown, though rmarkdown is basically pandoc markdown, so it has more syntax features that aren't supported by the plain markdown grammar. The plain markdown grammar is the best option we have though because pandoc markdown supports inline latex which makes it really complicated, so there's no complete tree-sitter grammar.
  • rmarkdown needs to be a separate language from markdown because the language server can analyze the contents of {r} code blocks but should only be enabled in rmd/Rmd files.
  • Both cases are included for file extensions because I've seen both used quite frequently.

And two questions:

  • I included a shebang definition because it technically works, since R is an interpreted language, but I've never seen someone use a shebang in an R file. Any opinion on whether I should leave it or remove it?
  • The generated lang-support.md file appears to use the name of the language server command for the default language server column. However, the name of the command for the language server in use here (this one, it's the only one I'm aware of) is just the R interpreter itself, and the arguments instruct it to invoke the languageserver package. Do we want to add in a workaround for this kind of situation so we can name the languageserver package specifically, or should we just leave it?

runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
@archseer
Copy link
Member

archseer commented Apr 7, 2022

or should we just leave it?

Let's just leave it for now

Does the user need to install the package manually?

@mtoohey31
Copy link
Contributor Author

Does the user need to install the package manually?

Yep, the command is:

R -e 'install.packages("languageserver")'

Is there somewhere that should be documented?

@pickfire
Copy link
Contributor

pickfire commented Apr 7, 2022

Is there somewhere that should be documented?

No, if the user use the language chances are they will know, unless it requires special setup then maybe you might want to note it.

@mtoohey31
Copy link
Contributor Author

Ok, sounds good. That's all the setup that's required.

runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
runtime/queries/r/highlights.scm Outdated Show resolved Hide resolved
@the-mikedavis
Copy link
Member

For the installation docs, there's a new wiki for that here if you wouldn't mind adding in a section for R.

Copy link
Member

@the-mikedavis the-mikedavis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good! thanks

@mtoohey31
Copy link
Contributor Author

For the installation docs, there's a new wiki for that here if you wouldn't mind adding in a section for R.

Done!

looks good! thanks

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants