vscode-R icon indicating copy to clipboard operation
vscode-R copied to clipboard

Option to turn off diagnostics for ipynb

Open franknarf1 opened this issue 2 years ago • 0 comments

Is your feature request related to a problem? Please describe. In VS Code, with the R and Jupyter extensions, ipynb files with lintr issues get flagged with the unhelpful message:

Failed to run diagnostics: ! error in callr subprocess Caused by error: ! Full file exclusions must be character vectors of length 1. items: 1 are not! lintr

For example, my cell

options(width=120)

received this message, but it went away after I added spaces around the =.

Because the wrong message is sent, I cannot debug lintr issues in notebooks. You can see someone with the same problem here in a deleted SO post (need high rep to view):

Encountered the same issue. I haven't solved it yet, but I noticed that for me, the red underline only shows up if there is a linting issue in the block of code

Describe the solution you'd like Can there be a setting to disable diagnostics for ipynb files? Eg

"r.lsp.diagnostics_exclude_extensions": "ipynb"

Alternately, maybe this could simply be default behavior for the R VS Code extension?

Describe alternatives you've considered Maybe this is already supported via .lintr exclusions (?), but I haven't found out how from the docs and trial-and-error.

My current workaround is to disable lintr entirely as suggested here https://github.com/REditorSupport/vscode-R/issues/343#issuecomment-635205284 (with VS Code setting "r.lsp.diagnostics": false), but I would like to use lintr for R scripts.

Because Jupyter notebooks are not yet supported https://github.com/r-lib/lintr/issues/383 or https://github.com/REditorSupport/vscode-R/issues/378 I don't expect a direct fix to this problem such that lintr would work for my notebooks. Even if notebooks were supported, I would probably still want to keep linting only for my "real" code in R scripts, so I can be undistracted by lintr messages when using a notebook like an enhanced R terminal.

Additional context I have not used lintr for long (having started thanks to switching to VS Code recently), but it looks like it can be very helpful!

franknarf1 avatar Aug 17 '22 18:08 franknarf1