Skip to content

add languages r and rmarkdown - #1998

Merged
archseer merged 5 commits into
helix-editor:masterfrom
mtoohey31:r-and-rmarkdown
Apr 8, 2022
Merged

add languages r and rmarkdown#1998
archseer merged 5 commits into
helix-editor:masterfrom
mtoohey31:r-and-rmarkdown

Conversation

@mtoohey31

Copy link
Copy Markdown
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?

Comment thread runtime/queries/r/highlights.scm Outdated
Comment thread runtime/queries/r/highlights.scm Outdated
Comment thread runtime/queries/r/highlights.scm Outdated
Comment thread runtime/queries/r/highlights.scm Outdated
Comment thread runtime/queries/r/highlights.scm Outdated
@archseer

archseer commented Apr 7, 2022

Copy link
Copy Markdown
Member

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
Copy Markdown
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

pickfire commented Apr 7, 2022

Copy link
Copy Markdown
Contributor

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
Copy Markdown
Contributor Author

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

Comment thread runtime/queries/rmarkdown/highlights.scm Outdated
Comment thread runtime/queries/r/highlights.scm Outdated
Comment thread runtime/queries/r/highlights.scm Outdated
@the-mikedavis

Copy link
Copy Markdown
Member

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

@the-mikedavis the-mikedavis left a comment

Copy link
Copy Markdown
Member

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
Copy Markdown
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