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
Since there's no exported functions for us to get the linters specified in the right config file, fixing it would be a little tricky. Any good idea, @randy3k?
It looks we could safely specify options(lintr.linter_file) in diagnose_file since it is run in a background process that does not affect the main process.
@pat-s Would you like to turn on the R lsp debug and see the output of the languageserver. For example, if I put a .lintr that is not ended with a newline, then the diagnostics could fail with the following log:
[2020-03-20 19:33:58.370] diagnostics_task: <callr_status_error: callr subprocess failed: Malformed config file, ensure it ends in a newline
zero-length inputs cannot be mixed with those of non-zero length>
in process
-->
<callr_remote_error: Malformed config file, ensure it ends in a newline
zero-length inputs cannot be mixed with those of non-zero length>
in process 48797
To ensure your .lintr actually work, please check if your .lintr works with your file:
d6dba1b shows the diagnostics error. Please try it and let us know the error shown in the diagnostics.
For example, if the .lintr if malformed, then the message will show like
Failed to run diagnostics: callr subprocess failed: <text>:2:0: unexpected end of input
1: with_defaults(assignment_linter = NULL, object_name_linter = NULL
^
Activity
randy3k commentedon Mar 19, 2020
What editor was it?
pat-s commentedon Mar 20, 2020
Ups sorry, forgot that you do editor-agnostic work here -> vscode.
randy3k commentedon Mar 20, 2020
By any chance, did you ever specified languageserver.default_linters in .Rprofile? That setting is now deprecated.
renkun-ken commentedon Mar 20, 2020
I could reproduce this.
It's actually a bug on our side. Since we use
lintr::lint(text)at https://github.com/REditorSupport/languageserver/blob/master/R/diagnostics.R#L94, it writes the content to a temp file and no longer finds the.lintrconfig as the original file.Since there's no exported functions for us to get the linters specified in the right config file, fixing it would be a little tricky. Any good idea, @randy3k?
randy3k commentedon Mar 20, 2020
I guess we could hack into https://github.com/jimhester/lintr/blob/1a7114b87c4d672772c74ffc30c932dcdb3ce017/R/settings.R#L64 to specify
lintr.linter_filerenkun-ken commentedon Mar 20, 2020
It looks we could safely specify
options(lintr.linter_file)indiagnose_filesince it is run in a background process that does not affect the main process.renkun-ken commentedon Mar 20, 2020
I test with setting
options(lintr.linter_file)indiagnose_fileas implemented in #236 and it works nicely.pat-s commentedon Mar 20, 2020
Thanks for taking this on so quickly.
Unfortunately, linting is now completely broken for me (with latest dev).
I get
in the "Problems" pane.
I had to roll back to b5ce3a8.
renkun-ken commentedon Mar 20, 2020
@pat-s Would you like to turn on the R lsp debug and see the output of the languageserver. For example, if I put a
.lintrthat is not ended with a newline, then the diagnostics could fail with the following log:To ensure your
.lintractually work, please check if your.lintrworks with your file:renkun-ken commentedon Mar 20, 2020
Looks like we should write the error message as the diagnostics message to make it easier to debug.
renkun-ken commentedon Mar 20, 2020
d6dba1b shows the diagnostics error. Please try it and let us know the error shown in the diagnostics.
For example, if the
.lintrif malformed, then the message will show likepat-s commentedon Mar 20, 2020
Thanks @renkun-ken for helping.
With latest dev, the diagnostic message I get is unfortunately not that much informative:
With languageserver diagnostics I get
Seems like something is wrong within the R script as I get
File
The call works with default linters, i.e.
linters: with_defaults()in.lintr.This is also fine
linters: with_defaults(assignment_linter = NULL)And the following causes the issue:
linters: with_defaults(object_name_linter = c("snake_case", "CamelCase"))I think it is an {lintr} issue: r-lib/lintr#471
Nevertheless the latest changes should help users tracking down issues in the future! Thanks.