REditorSupport / REditorSupport/languageserver
LSP diagnostics shows `lintr` error although `lintr::lint_package()` does not
Nobody has claimed this yet.
- Dominant language
- R
- Stars
- 675
- Forks
- 118
- Avg merge
- 1d 37m
- Merged PRs (30d)
- 11
Description
Hi
I am developing a package where I use .data from rlang together with dplyr.
The code snippet is
#' @export
#' @importFrom rlang .data
my_fun <- function(df) {
df |> dplyr::mutate(
x = .data[[col]]
)
}
with NAMESPACE file:
# Generated by roxygen2: do not edit by hand
export(my_fun)
importFrom(rlang,.data)
When running lintr::lint_package() inside RStudio I do not get any errors.
However, using the rlanguageserver inside Neovim gives the following error:
My sessionInfo() is:
> sessionInfo()
R version 4.3.2 (2023-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Arch Linux
Matrix products: default
BLAS: /usr/lib/libblas.so.3.12.0
LAPACK: /usr/lib/liblapack.so.3.12.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
time zone: Europe/Copenhagen
tzcode source: system (glibc)
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] lintr_3.1.1 languageserver_0.3.16 testpkg_0.0.0.9000
[4] devtools_2.4.5 usethis_2.2.2
loaded via a namespace (and not attached):
[1] generics_0.1.3 utf8_1.2.4 xml2_1.3.5 stringi_1.8.3
[5] digest_0.6.33 magrittr_2.0.3 pkgload_1.3.3 fastmap_1.1.1
[9] rprojroot_2.0.4 processx_3.8.3 pkgbuild_1.4.3 sessioninfo_1.2.2
[13] brio_1.1.4 backports_1.4.1 ps_1.7.5 urlchecker_1.0.1
[17] promises_1.2.1 purrr_1.0.2 fansi_1.0.6 codetools_0.2-19
[21] lazyeval_0.2.2 cli_3.6.2 shiny_1.8.0 crayon_1.5.2
[25] rlang_1.1.2 ellipsis_0.3.2 remotes_2.4.2.1 withr_2.5.2
[29] cachem_1.0.8 parallel_4.3.2 tools_4.3.2 memoise_2.0.1
[33] dplyr_1.1.3 httpuv_1.6.13 vctrs_0.6.5 cyclocomp_1.1.1
[37] R6_2.5.1 mime_0.12 lifecycle_1.0.4 stringr_1.5.1
[41] fs_1.6.3 htmlwidgets_1.6.3 miniUI_0.1.1.1 callr_3.7.3
[45] pkgconfig_2.0.3 desc_1.4.3 rex_1.2.1 pillar_1.9.0
[49] later_1.3.2 data.table_1.14.8 glue_1.6.2 profvis_0.3.8
[53] Rcpp_1.0.11 tidyselect_1.2.0 xfun_0.41 tibble_3.2.1
[57] rstudioapi_0.15.0 knitr_1.45 xtable_1.8-4 htmltools_0.5.7
[61] testthat_3.2.1 compiler_4.3.2 roxygen2_7.2.3 xmlparsedata_1.0.5
and I am using the newest r-languageserver:
The only way that I can make it go away is by writing in my .lintr file:
linters: linters_with_defaults(
object_usage_linter = NULL
)
but how can I do it correctly :D?
Thank you!
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the discrepancy with the reported R snippet, NAMESPACE, and .lintr configuration, comparing lintr::lint_package() with the r-languageserver diagnostics. Start by tracing how the language server invokes lintr and handles object_usage_linter; done means the diagnostics agree without requiring object_usage_linter = NULL in .lintr.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- r
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100