jmbuhr / otter.nvim

Just ask an otter! 🦦
MIT License
502 stars 11 forks source link

Cmp not working #173

Closed n6v26r closed 1 month ago

n6v26r commented 1 month ago

I get the following error:

Error detected while processing TextChangedI Autocommands for "*":                            
Error executing lua callback: ....local/share/nvim/lazy/otter.nvim/lua/otter/lsp/init.lua:107:
 attempt to index a nil value                                                                 
stack traceback:                                                                              
        ....local/share/nvim/lazy/otter.nvim/lua/otter/lsp/init.lua:107: in function 'request'

        /usr/share/nvim/runtime/lua/vim/lsp/client.lua:679: in function 'request'             
        ...share/nvim/lazy/cmp-nvim-lsp/lua/cmp_nvim_lsp/source.lua:139: in function '_request
'                                                                                             
        ...share/nvim/lazy/cmp-nvim-lsp/lua/cmp_nvim_lsp/source.lua:71: in function 'complete'

        .../razv/.local/share/nvim/lazy/nvim-cmp/lua/cmp/source.lua:326: in function 'complete
'                                                                                             
        /home/razv/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:299: in function 'complete
'                                                                                             
        /home/razv/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:169: in function 'callback
'                                                                                             
        /home/razv/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:229: in function 'autoinde
nt'                                                                                           
        /home/razv/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:161: in function 'on_chang
e'                                                                                            
        /home/razv/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:346: in function 'callback
'                                                                                             
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:49: in function 'emit'    
        ...local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:23: in function <...local/
share/nvim/lazy/nvim-cmp/lua/cmp/utils/autocmd.lua:22>

This is my config:

    config = function()
      local otter = require("otter")
      otter.setup{
        lsp = {
          diagnostic_update_events = {"InsertLeave"}
        },
        buffers = {
          set_filetype = true
        }
      }
    end,
    init = function()
      vim.api.nvim_create_autocmd("BufWritePost", {
        pattern = {"*.md", "*.mdx", "*.org", "*.norg", "*.ipynb"},
        callback = function() require('otter').activate() end,
      })
    end,
jmbuhr commented 1 month ago

Please update to the latest Neovim stable and you are good to go. See https://github.com/jmbuhr/otter.nvim?tab=readme-ov-file#dependencies

n6v26r commented 1 month ago

@jmbuhr I'm on arch linux (nvim version 0.10.1)

jmbuhr commented 1 month ago

why are you activating otter every time you write a file? What document produces this error?

n6v26r commented 1 month ago

It was just to test this easier, as the error only happens the first time cmp tries to access otter. And to get it again, I have to recall activate. After that it just ignores it i guess.

I tried it in a markdown file.

n6v26r commented 1 month ago

Never mind, I deleted the .local/share/nvim folder and reinstalled all packages and it works now. Idk why, I'm certain it was not a update thing as all packages were up to date. Anyway, it works now... 🤷