When I open .rb
Ruby files in RStudio, they correctly (and automatically) syntax highlight. When I open a .rake
file (which is also Ruby), the file is displayed as plain text (because RStudio doesn't have a file extension mapping for .rake
to the language Ruby).
The problem is that the language type Ruby does not even appear in the file type menu (bottom right) for Rake files, only for Ruby files, so it appears I can't even manually set the file type.
Is this the expected behavior, that I can't set the file type of an arbitrary file I open UNLESS it has an extension that RStudio has a hard-coded association for? Is there a way to add or edit associations between file extensions and Knitr-supported languages? This is something I'm used to being able to do in e.g. Vim, Atom, VS Code, and most other editors.
This does not just affect syntax highlighting — it also affects RStudio's ability to navigate to files with Go to file/function (Ctrl+.
).