-
Notifications
You must be signed in to change notification settings - Fork 193
Description
Hi,
I use neovim with ale + Nvim-R and it got me wondering about how lintr works.
Let's say that I have the following file called test.R
:
library(purrr)
n <- 10
map(1:n, function(x) rnorm(x))
myfun <- function(n) {
map(1:n, function(x) rnorm(x))
}
If I start a new R session and call lintr::lint("test.R")
, I get a marker related to the second map ("no visible global function definition"), whereas if I call library(purrr)
first, I do not get a marker.
- Why do I never get a marker for the first
map
? - In the second case (i.e., if I call
lintr::lint
afterlibrary
), how doeslintr
"knows" thatmap
is "available"?
While I ask the first question by curiosity, I ask the second question because, as mentioned, I use ale and Nvim-R. In this context, although I often load packages in the R session opened with Nvim-R, the markers for missing global function definitions never disappear after loading the appropriate packages.
This is obviously expected since, to the best of my knowledge, there is no connection between ale and Nvim-R. But I am trying to understand where lintr
looks for the information about the loaded namespaces with the final goal to get ale to use the current Nvim-R session to make the markers related to global function definitions from packages that are loaded disappear.
I am not sure whether I explained clearly the issue, my apologies if not.