Conversation
…p functions (closes #508) feat(bol.R): add source reference cache building for package functions This change introduces a new function `nvim.build.srcref` to build source reference caches for functions in R packages, enhancing the goto definition feature. fix(Makefile): include definition.c in source files for build This ensures that the new definition handling logic is compiled into the rnvimserver application. fix(data_structures.c): add srcref file reading and validation This change allows the application to read and validate source reference files, supporting the new goto definition functionality. fix(data_structures.h): add srcref field to PkgData struct This addition supports storing source reference data for R packages. feat(definition): add symbol definition resolution feature Introduce a new feature to resolve symbol definitions using cached data or fallback to R for lookup. This enhances the ability to locate symbols efficiently within packages, improving the overall functionality of the application.
Add .clang-format file to enforce code style based on LLVM style.
Adjust line breaks and indentation in C files for better readability.
I ran clang-format on all c files for consistency.
In my `conform.lua`, I have this now:
```lua
clang_format = {},
```
f7b944d to
4b06caf
Compare
|
Is it ready for review? |
|
Yes, I think this is working pretty good. I do not feel any lag on my side. |
|
Starting to review it now. We have to increase the diff --git a/lua/r/config.lua b/lua/r/config.lua
index f65e674..7b04f9a 100644
--- a/lua/r/config.lua
+++ b/lua/r/config.lua
@@ -853,7 +853,7 @@ local check_readme = function()
-- Create or update the README (objls_ files will be regenerated if older than
-- the README).
local need_readme = false
- local first_line = "Last change in this file: 2026-01-17"
+ local first_line = "Last change in this file: 2026-03-01"
if
vim.fn.filereadable(config.compldir .. "/README") == 0
or vim.fn.readfile(config.compldir .. "/README")[1] ~= first_line
diff --git a/nvimcom/DESCRIPTION b/nvimcom/DESCRIPTION
index d675fe3..29d40ec 100644
--- a/nvimcom/DESCRIPTION
+++ b/nvimcom/DESCRIPTION
@@ -1,6 +1,6 @@
Package: nvimcom
-Version: 0.9.86
-Date: 2026-01-31
+Version: 0.9.87
+Date: 2026-03-01
Title: Intermediate the Communication Between R and Neovim
Author: Jakson Aquino
Maintainer: Jakson Alves de Aquino <jalvesaq@gmail.com>Also, I think it's time to add your name to the "Author" and "Maintainer" fields of nvimcom's DESCRIPTION. |
|
In a quick test, the "go to definition" works instantly, although all Perhaps, we don't need the version number in the |
|
Result of running |
chore(nvimcom/DESCRIPTION): bump version to 0.9.87 and update date to 2026-03-01
That makes sense! Should be addressed in bce6507. |
Thank you very much for proposing it :) Should I do it in this PR? |
Yes, please. |
|
Last observation, from It suggests adding (Obs: The Note on |
diff --git a/nvimcom/R/interlace.R b/nvimcom/R/interlace.R
index 1d0aa2c..6029afd 100644
--- a/nvimcom/R/interlace.R
+++ b/nvimcom/R/interlace.R
@@ -428,7 +428,7 @@ nvim.interlace.rmd <- function(Rmdfile, outform = NULL, rmddir, ...) {
} else {
if (exists("params", envir = .GlobalEnv)) {
old_params <- get("params", envir = .GlobalEnv)
- rm(params, envir = .GlobalEnv)
+ rm("params", envir = .GlobalEnv)
}
res <- rmarkdown::render(Rmdfile, outform, ...)
if (exists("old_params", inherits = FALSE)) {I think that using an unquoted name causes R CMD check to flag it as a global variable binding. Should it be changed? |
Yes, please! |
Use a string in the rm function to avoid potential issues with variable name resolution and improve code clarity.
|
Thank you for the great work! I'll squash and merge the pull request. |
|
Thank you very much! Most of it was just using your |
srcref_cache (R side): Addednvim.build.srcref()inbol.Rto pre-build a per-package cache (srcref_<pkg>_<version>) that maps functions to their source file, line, and column. Gets built at the same time as theobjls_/args_caches.New
definition.cmodule (C side): Goto-definition now lives inrnvimserverunder a new'G'command. It hits the in-memorysrcref_cache first, and only falls back to a live R call (nvimcom:::send_definition) if it doesn't find anything.PkgDatastruct: Added asrcreffield to load thesrcref_file into memory, same wayobjls_andargs_are handled.Lua cleanup: Dropped
find_in_package()andhandle_definition_response()fromdefinition.lua. The handler just sends a'G'tornvimservernow, and it works as soon asR_Nvim_status >= 2— no need to wait for R to be fully up (status7) like before.Formatting: Ran
.clang-formaton the C files. This changed code formatting in only 2-3 files.