With the following settings when I try to run R: lintr it tells me that the lintr package is not installed even though it is.
any(installed.packages()[, "Package"] == "lintr")
[1] TRUE
Those are default settings:
// toggle caching of lint results
"r.lintr.cache": true,
// Enable lintr
"r.lintr.enabled": true,
// R executable path for lintr
"r.lintr.executable": "",
// If true, lintr exec lint_package() instead of lint()
"r.lintr.ispackage": false,
// list of linter functions
"r.lintr.linters": "default_linters",
// R path for Linux
"r.rterm.linux": "/usr/bin/R",
// R path for Mac OS X
"r.rterm.mac": "/usr/local/bin/R",
// R command line options (i.e: --vanilla)
"r.rterm.option": [
"--no-save",
"--vanilla"
],
// R.exe path for windows
"r.rterm.windows": "C:\\Program Files\\R\\R-3.3.3\\bin\\x64\\R.exe",
// An optional encoding to pass to R when executing the file, i.e. 'source(FILE, encoding=ENCODING)'
"r.source.encoding": "UTF-8",
// Keeping focus when running
"r.source.focus": "editor",
This is what I have in user settings
"workbench.colorTheme": "Monokai",
"r.rterm.windows": "C:\\Program Files\\R\\R-3.4.2\\bin\\x64\\R.exe",
"r.lintr.executable": "C:\\Program Files\\R\\R-3.4.2\\bin\\x64\\R.exe"
Sorry, my reply is late.
I think it is the cause of old default settings.
How is now?
I met this issue too
@zhihaolyu Thank you for info.
Are you using windows and R-3.4.2 too?
@Ikuyadeu I鈥檓 using windows but R-3.4.3. Thank you.
I have the same issue too. I am using R-3.4.2 on Windows.
OK, this issue looks very important.
Thank you for information @UpsideDownRide , @zhihaolyu and @hongyuanjia !
I was experiencing a similar bug when I first installed the plugin. Now, running the lintr command doesn't seem to do anything at all. Even when I have obvious code flaws, the lintr doesn't say anything at all. All other commands seem to work as expected. And when I remove my user r.rterm and r.lintr settings, the lintr command still doesn't do anything. It doesn't even throw an error. Meanwhile, the other commands throw the expected "cannot find R client..." error. Not sure if this is helpful but it seems potentially related?
@bpiv400 Thank you for new information.
This bug looks related https://github.com/REditorSupport/vscode-r-lsp .
I published new r-lsp version for windows user, please try it.
I have the same problem on macOS. The linting works, but I get the notification about lintr not being installed every time I save a file. It does seem to be related to vscode-r-lsp.
I should add that when I disable lintr using the vscode-r options, I still get the code linting and do not get any more error notifications. I assume this means that vscode-r-lsp is doing the linting and the problem is likely related to both extensions trying to use the linter.
@jacob-long Thank you, for awesome information!
So, I'll remove the linting function from this extension.
But it needs large changes.
It began working for me as soon as I set "r.lintr.cache": false.
I have;
And CRAN R v3.5.0
Running on Windows 10
I think this should be resolved now that linting is fully provided by the language server, so I鈥檓 going to close this. But if anyone is still having problems along these lines, please reply and we鈥檒l have another look.
@andycraig How do you set custom lintr settings now?
I've added .lintr files in my workspace root and in the folder where my R code lies, but the lintr in r-lsp ignores them.
my .lintr file looks like this:
linters: with_defaults(line_length_linter(120))
and the lintr still complains Lines should not be more than 80 characters. on lines with 80-120 lines.
@benedikt-mayer This has been recently fixed by https://github.com/REditorSupport/languageserver/pull/236. Please try the latest development version of languageserver:
devtools::install_github("REditorSupport/languageserver")
@renkun-ken That's it! Thanks so much!