Open dinga92 opened 6 months ago
Yes, this is the expected behavior. We can discuss and change the expected behavior, but, currently, both the Object Browser and auto-completion reflect what is loaded in R's memory. Suppose that you are sending lines one at a time and that a specific library()
call is in the middle of the script. It would not work if you tried to call a function of the unloaded library before sending its library()
command to R. Consistent with this, auto-completion will not work before the library is loaded. In the rare circumstance when a user detaches a library, it's also unloaded from rnvimserver
.
But, as I said, we can change the default behavior to:
rnvimserver
the data of all libraries with a corresponding library()
command in the script.rnvimserver
.rnvimserver
data of libraries that were not in the script at R startup as they are loaded after R was started.Thanks for your reply.
I don't know what the expected behavior should be. I don't think that Rstudio will autocomplete objects not in the memory, on the other hand I wouldn't expect that the scope of autocompletion gets smaller after we call R.
Option 1 won't work because it will not autocomplete variables defined in the script that has not yet been committed to memory.
Anyway, thanks for your work.
1, 2, and 3 are not options. It's a sequence of how it would behave. Currently, the sequence is:
rnvimserver
the data of all libraries with a corresponding library() command in the script.rnvimserver
.rnvimserver
data of libraries as they are loaded after R was started.Objects created in the R code are not recognized before being created in R's memory because R.nvim
analysis of the code is limited to seeking library()
commands.
alright, got it
Hi, I am not sure if this is an expected behavior, or a bug, or a wrong config on my side, but I am observing the following behavior:
When I open an .R file, the completion works according to what is in the file, so for example, if the file contains
library(ggplot2)
I will be offered all ggplot variables for the completion, but then I run R using<leader>rf
completion no longer works for ggplot, it works only for base R things and it works for ggplot again only after I run the code in the R console. Sorry for a convoluted explanation, I hope it is understandable anyway.