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 more R language config #1479

Merged
merged 7 commits into from
Oct 4, 2023
Merged

Add more R language config #1479

merged 7 commits into from
Oct 4, 2023

Conversation

juliasilge
Copy link
Contributor

Addresses #125

This PR will include the language highlighting config for NAMESPACE and .Rd files. An renv.lock is a JSON file so we should be able to inherit that highlighting somehow.

@juliasilge
Copy link
Contributor Author

Turns out you can contribute more stuff (like filenames or extensions) to existing languages, so I tried to make the new language IDs fairly unique.

@juliasilge juliasilge marked this pull request as ready for review October 3, 2023 22:56
@@ -179,6 +179,9 @@
"R",
"r"
],
"filenames": [
"NAMESPACE"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are two directions we can go with NAMESPACE, either treat it like R syntax or treat it like a separate language. I vote for treating it like R syntax, like Hadley says here.

Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with this. The vscode-R extension did implement their own, so in case we ever decide to revisit this, here's their PR with a little bit of discussion:

REditorSupport/vscode-R#1221

I'd say the justification for creating a NAMESPACE language configuation is pretty weak and it's reasonable to piggyback off of R.

Copy link
Member

@jennybc jennybc left a comment

Choose a reason for hiding this comment

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

LGTM!

I opened a NAMESPACE file and an .Rd file and the syntax highlighting looks good and is a nice improvement ✅

@@ -179,6 +179,9 @@
"R",
"r"
],
"filenames": [
"NAMESPACE"
Copy link
Member

Choose a reason for hiding this comment

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

I'm fine with this. The vscode-R extension did implement their own, so in case we ever decide to revisit this, here's their PR with a little bit of discussion:

REditorSupport/vscode-R#1221

I'd say the justification for creating a NAMESPACE language configuation is pretty weak and it's reasonable to piggyback off of R.

@@ -0,0 +1,114 @@
{
Copy link
Member

Choose a reason for hiding this comment

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

Is this file coming from vscode-R? This is just a curiosity / provenance question.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I started with what vscode-R does but made a few changes, based on my opinions 😆 and what RStudio does. (The vscode-R extension is very into UNDERLINING.)

Copy link
Member

Choose a reason for hiding this comment

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

Ooh, this is a very interesting folder to know about!

https://github.com/rstudio/rstudio/tree/main/src/gwt/acesupport/acemode

@juliasilge juliasilge merged commit cfc347f into main Oct 4, 2023
1 check passed
@juliasilge juliasilge deleted the more-r-language-config branch October 4, 2023 19:19
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.

2 participants