jalvesaq / cmp-nvim-r

GNU General Public License v3.0
18 stars 1 forks source link

Function signature arguments not showing! #12

Closed drusmanbashir closed 8 months ago

drusmanbashir commented 8 months ago

Hi I have recently started using R with neovim. This plugin is so great, i dont use RStudio anymore!

I have noticed an issue: Whenever I enter the parenthesis of a function I am typing (e.g., print()), an error appears in the r console. Below is a clip:

Screencast from 03-02-24 23:26:09.webm

My cmp_nvim_r config file is:

require'cmp_nvim_r'.setup({
  filetypes = {'r', 'rmd', 'quarto'},
  doc_width = 58
  })
vim.cmd[[
set nosplitright

let R_rconsole_width = winwidth(0) / 2
let R_assign= 0
let nosplitright = 1
let R_objbr_place = 'console,below'
let R_objbr_h = 25
let R_objbr_auto_start =0
let R_auto_start=2
autocmd VimResized * let R_rconsole_width = winwidth(0) / 2
function! s:customNvimRMappings()

   nmap <buffer> <M-e> <leader>d
   " imap <buffer> <M-e> <Esc><leader>d

   imap <buffer> <M--> <-
   imap <buffer> <M-,> %>% 
   vmap <buffer> <M-e> <leader>sd
   " nmap <buffer> <M-x> <leader>mij/^# %%<CR><CR>
   nmap <buffer> <M-x> l[hv]h<leader>sd
endfunction
augroup myNvimR
   au!
   autocmd filetype r call s:customNvimRMappings()
augroup end
]]

My nvim-cmp file has the following sources section

 sources = cmp.config.sources({
    { name = "nvim_lsp",  keyword_length = 3 },
    { name = "cmp_nvim_r" },
    { name = "luasnip" }, -- For luasnip users.
    { name = "codeium" },
  }, {
    { name = "buffer" },
    { name = "path" },
  }),
  completion = {
    keyword_length = 1, -- default
  },
  confirm_opts = {
    behavior = cmp.ConfirmBehavior.Replace,
    select = false,
  },
jalvesaq commented 8 months ago

This was supposed to have been fixed by https://github.com/jalvesaq/Nvim-R/pull/800 Are all your plugins up to date?

drusmanbashir commented 8 months ago

Yes every plugin up to date. I have also put

options(languageserver.server_capabilities =
        list(completionProvider = FALSE, completionItemResolve = FALSE))

in my .Rprofile just in case.

jalvesaq commented 8 months ago

The current version of nvimcom is 0.9-162. That's what you should see with :RDebugInfo...

Note: grep -R sdq returns nothing in either Nvim-R or cmp-nvim-r directory. So, it's impossible that the bug is caused by the current versions of these plugins.

drusmanbashir commented 8 months ago

image

Yup same version. I am wondering if there may be a clashing plugin installed? I did install the r languageserver a few days ago, just before i started using R after a long time. But upon reading previous threads I uninstalled it using r remove.packages, and also Mason within neovim.

jalvesaq commented 8 months ago

I will increase nvimcom version number to force its recompilation. I think this is the cause of the problem.

jalvesaq commented 8 months ago

Could you try again, please?

drusmanbashir commented 8 months ago

Yes, that solved the problem. Thank you sir!

A side-question: Is it possible to integrate your plugin with lsp-signature, so that once inside the function parenthesis, function signature pops up.

jalvesaq commented 8 months ago

Anything specific to Neovim will be easier when "tmp-R-Nvim" becomes "R-Nvim". Please, see https://github.com/jalvesaq/Nvim-R/discussions