vscode-R: Failed to run diagnostics lintr

Describe the bug I couldn’t decide if this was a languageserver issue or not, sorry. Every time I open a new file, the top line shows the error Failed to run diagnostics: lintr.

Expected behavior I expect the files lints to be correctly checked and any issues display in the problems tab.

Environment (please complete the following information):

  • OS: macOS
  • Version: 1.45.1 Commit: 5763d909d5f12fe19f215cbfdd29a91c0fa9208a Date: 2020-05-14T08:33:47.663Z Electron: 7.2.4 Chrome: 78.0.3904.130 Node.js: 12.8.1 V8: 7.8.279.23-electron.0 OS: Darwin x64 19.4.0
  • R Version: 3.6.3
  • vscode-R version: 1.3.0
  • languageserver version: 0.3.5
  • lintr version: 2.0.1

Additional context I see the following in the diagnostics but I am not sure if it is related.

diagnostics_task: <callr_status_error: callr subprocess failed: attempt to apply non-function>
 in process 
-->
<callr_remote_error in linters[[linter]](expr):
 attempt to apply non-function>
 in process 78394 

I know this is all very vague, please let me know if you need any additional information.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 32 (11 by maintainers)

Most upvoted comments

Not sure what a solution is but you can disable lintr to suppress the error message I think by setting this setting in your json settings file :

"r.lsp.diagnostics": false

Thank you! It works very well!

If there’s anybody find it wrong like me, just try update languageserver package using the latest development build below:

install.packages("languageserver", repos = c(
    reditorsupport = "https://reditorsupport.r-universe.dev",
    getOption("repos")
))

I noticed for R Jupyter notebooks it happens whenever you have a comment that exceeds the gutter size. If you break up the long comments into multiple lines, the errors go away.

I noticed for R Jupyter notebooks it happens whenever you have a comment that exceeds the gutter size. If you break up the long comments into multiple lines, the errors go away.

But it also shows as I assign any variable:

image

Or just one small comment:

image

It looks in a mess and I just follow the .lintr file creation, and nothing have made any change on that.

@nathaneastwood The object_usage_linter seems problematic, see https://github.com/jimhester/lintr/issues/482.

If your lintr works with other scripts but this one, it is then most likely to be caused by some lintr bug trying to deal with malformed code.

Would you like to try parse("./R/select.R") and see if the code could be parsed without an error?

And would you like to experiment by reducing code blocks in ./R/select.R and see what’s the minimal code block that could reproduce this error?

Just to add that you can see if it is lintr (rather than the vscode extension) by manually calling lintr yourself

(from the R console)

library(lintr)
lint("./path_to_file/file_to_lint.R")