You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
R notebook files have a proper syntax highlight, however, text files with extension ".R" do not have any syntax highlights. Python ".py" files, on the other hands, do have proper syntax highlight. When I'm editing ".R" files, I end up renaming them to ".py", and then back to ".R" to have some sort of syntax highlight, but obviously this is not the right solution. It would be great if this feature is added.
The text was updated successfully, but these errors were encountered:
At least on my system, they are correctly highlighted with a lowercase .r extension, but not with a capital .R extension.
We try two things to set the highlighting mode:
The server calls the Python function mimetypes.guess_type(path). If we get a mimetype, we use CodeMirror's findModeByMIME() function to get the mode. On my system, neither .r nor .R appears to have a registered mime type.
If that hasn't got us a mode, we use the file extension and call CodeMirror's findModeByExtension() function. Looking at CodeMirror's modes data, it recognises .r but not .R.
Maybe we should make all file extensions lowercase before looking them up. You could in theory differentiate an extension by case, but I can't think of any examples. My system recognises capitalised extensions as equivalent to the lowercase form, e.g. .PY. And I can't see any capitalised extensions in the CodeMirror data.
takluyver
added a commit
to takluyver/notebook
that referenced
this issue
Feb 10, 2016
R notebook files have a proper syntax highlight, however, text files with extension ".R" do not have any syntax highlights. Python ".py" files, on the other hands, do have proper syntax highlight. When I'm editing ".R" files, I end up renaming them to ".py", and then back to ".R" to have some sort of syntax highlight, but obviously this is not the right solution. It would be great if this feature is added.
The text was updated successfully, but these errors were encountered: