Syntax highlighting not working in RVscode - r

I have just started using R extension for vscode (this extension). I have installed as per the steps mentioned in the installation page (install R, I am using R4.1.1, then I installed languageserver, I also installed radian).
The issue I am facing is I am not getting any syntax highlighting, look at the example below:
What I want is the type of syntax highlighting as mentioned in the installation page. In the installation page, the function calls, function parameters etc are highlighted but that's not the case with my installation.

Related

Customize R linters in VSCode

I'm trying to customize the linter settings in VSCode for R but I'm a little confused.
I've checked just about every source available, from SO questions to the lintr package vingette, but I'm stumbling on an issue. It could be that since I'm not a programmer I'm just not understanding something basic but essential.
A question about line length linter 80 characters
Disable R-linting in VScode
How to change the line length preference for warnings in Diagnostics? #3
Specify linters in lintr::lint
lintr github page
Lint R code in Visual Studio
lintr v2.0.0
Using lintr
It seems like I need to create a .lintr file in the folder that my script is in. Or possibly make changes in the .lintr file in the lintr package ~lintr/R/ folder?
I guess I'm just confused on the .lintr file. I tried creating files called "lintr", ".lintr" and "ScriptName.lintr", then added the following line to it, as described in the above sources:
linters: with_defaults(line_length_linter=line_length_linter(120L))
Then I reopened the script but whatever I do, lintr continues to default to 80 spaces. I think I'm doing something wrong with the .lintr file but I'm not sure what. I also tried changing file called "lintr" in the lintr package directory, but I can't save the file because it has no extension type (though it appears to be in the Debian Control Field Format, whatever that is). Windows keeps giving me a prompt to save as "txt".
I'd appreciate any step-by-step instructions to get past this issue.

Cannot configure rgee R package properly with ee_install()

I've searched for tutorials to help configure the package in my PC, and I've found this one: https://www.youtube.com/watch?v=_fDhRL_LBdQ
I executed every part of the code interactively with the tutorial, but when I run ee_install() (after installing miniconda with py_discover_config() and other packages previously, such as reticulate), but it keeps me returning an error saying that anaconda is mandatory for the package since I'm a windows user.
Here is the error I get:
Error in ee_install_set_pyenv_env(py_env = py_env, py_path = python_path, : Windows users must install miniconda/anaconda to use rgee. The use of a Python environment is mandatory.
I've just installed Anaconda (full version with navigator) and I set a new python environment called "py2r" and tried to use the function ee_install_set_pyenv(), passing the path to the environment created through Anaconda Navigator (which has a python.exe) as paremeter to py_path and the name "py2r" as paremeter for py_env arg. And yet, it didn't work.
What am I missing?
In case you want to take a look at the code, I can provide it, but I don't think it's necessary because is a simple test script that follows as I described.
Thanks for your attention and congratulations for the library, it will be very usefull for me at work!
I fixed the ee_install() problems bypassing them and doing every passage manually. It will require no more then 10 mins and you will probably fix the installation problems. You can find and follow the manual installation with this tutorial:
https://www.youtube.com/watch?v=1-k6wNL2hlo

How to verify if atom package launched properly in atom editor

I installed linter-php and also tried to configure it in config.cson as following
"linter-php":
executablePath: "C:\xampp\php"
but I don't see any indication that something that is related to linter affects atom display. How can I verify that this package (or any package in general) is working properly when atom is running?
To answer your question: you can find all active packages by running atom.packages.activePackages in Atom's developer console.
However, your problem could be caused by providing an invalid path. Backslashes need to be escaped in CSON, so your config should look like this:
"linter-php":
executablePath: "C:\\xampp\\php"

How to Enable Syntax Highlighting for Python in ATOM

I'm using Python 3.7, and our class has transitioned to ATOM Editor for our IDE. The Professor is running Ubuntu and his works, and a few people have had there's sporadically work but I'm unable to get any syntax highlighting or error pop-ups (Even if I make obvious errors)
To enable syntax highlighting you need to have the 'language-python' package from here. Then make sure the file you are editing ends in '.py'. If these two steps have been followed the syntax highlighting should be in effect. Also load the 'Script' package from here. This package lets you run python scripts from Atom.

Error in readRDS(file) : unknown input format

I am trying to install custom packages in my Rprofile.site file. I want to install packages in the site file because I have to install these packages on several users' computers. However, I am getting the following the error whenever I launch R.
Error in readRDS(file) : unknown input format
I have the following code added to the end of my Rprofile.site file.
if(length(grep("customPackage", installed.packages()))==0) {
install.packages("customPackage", repos=NULL, type="source")
}
The error keeps repeating itself as well until I stop the R session. If I remove that code from the site file and just install the package directly in an R session though it works fine.
The only reason I want to do it in the site file is because I will keep adding more custom packages that need to be installed on each user's machine and I would rather just call it from the site file than have each user install each custom package once.
I tried searching for the error and got a variety of answers which spoke about deleting the .Rhistory file (which I tried, but didn't work), or installing the latest version of R (I am on R-2.15.0 which is the latest version so that won't help either). I was wondering if there was any other solution to fixing this problem.
I had the same error. Simply closing RStudio, then reopening it and trying again is what worked for me. Note that restarting the R session via the RStudio menu or via rs.restartR() didn't work - only closing and reopening RStudio worked. Not sure why.

Resources