jalvesaq / cmp-nvim-r

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

Autocompletion after $ signs and tidyverse pipes #3

Closed joscani closed 1 year ago

joscani commented 1 year ago

In old ncm-R plugin I saw how autocompletion works after $ signs and after pipe , even autocompletion looks inside dataframe and works after tidyverse verbs like filter and suggest column names.

I'm newbie using neovim , and finally I configure nvim-cmp and cmp-nvim-r and they are fantastic, but I would like this kind of autocompletion.

Thanks in advance

jalvesaq commented 1 year ago

Autocompletion with cmp-nvim-r completes:

and when a column name is selected, Nvim-R runs either summary() or str() and displays the result in the menu's float window. So, I'm sorry, but I didn't understand what kind of autocompletion you are missing.

jalvesaq commented 1 year ago

Perhaps you have the language server package installed and has enabled it... So, I added this to the README:

Since cmp-nvim-r and the R package languageserver provide completions for the same code, and completions from the languageserver might be the first ones to be displayed by nvim-cmp, you may want to put this in your ~/.Rprofile:

# Disable completion from the language server
options(languageserver.server_capabilities =
        list(completionProvider = FALSE, completionItemResolve = FALSE))
joscani commented 1 year ago

You're right, But it's not necessary edit Rprofile, you can simply no configure r-language-server in lspconfig. I comment lspsconfig line

My config

require'cmp'.setup {
  sources = {
    { name = 'cmp_nvim_r' },
  }
}
--require'lspconfig'.r_language_server.setup{} 
jalvesaq commented 1 year ago

I like to see the diagnostics for R code from languageserver, and I use language server completions for Python, Lua, VimLanguage, C and C++. That's why I still set up the r_language_server and include nvim_lsp as a cmp source. But your solution is better for people programming in R only and who find R's languageserver diagnostics more distracting than helpful.