petertriho / cmp-git

Git source for nvim-cmp
MIT License
397 stars 23 forks source link

Support for Octo.nvim #43

Closed pwntester closed 2 years ago

pwntester commented 2 years ago

Hi! author of octo.nvim here. I was going to work on a nvim-cmp source for octo (issue/prs and metions) and found out your plugin. I think it would be much better to add support for Octo directly on this source rather than writing a new one. Would you be open to support Octo buffers (filetype: octo)?

I tried to use your source and got:

Error detected while processing TextChangedI Autocommands for "*":
E5108: Error executing lua ...vim/site/pack/packer/start/cmp-git/lua/cmp_git/utils.lua:104: ...vim/site/pack/packer/start/cmp-git/lua/cmp_git/utils.lua:100: Vim(lcd):E472: Command
 failed
stack traceback:
        [C]: in function 'error'
        ...vim/site/pack/packer/start/cmp-git/lua/cmp_git/utils.lua:105: in function 'run_in_cwd'
        ...vim/site/pack/packer/start/cmp-git/lua/cmp_git/utils.lua:86: in function 'get_git_info'
        ...im/site/pack/packer/start/cmp-git/lua/cmp_git/source.lua:55: in function 'complete'
        .../nvim/site/pack/packer/start/nvim-cmp/lua/cmp/source.lua:296: in function 'complete'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:295: in function 'complete'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:169: in function 'callback'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:219: in function 'autoindent'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/core.lua:161: in function 'on_change'
        ...re/nvim/site/pack/packer/start/nvim-cmp/lua/cmp/init.lua:314: in function 'callback'
        ...ite/pack/packer/start/nvim-cmp/lua/cmp/utils/autocmd.lua:31: in function 'emit'
        [string ":lua"]:1: in main chunk

For an octo buffer, the cwd variable in utils.lua:104 is octo://OWNER/REPO/issue so I guess, special handing of octo buffer names is needed

petertriho commented 2 years ago

Hi @pwntester! Love your plugin, I use it almost every day for work. Shouldn't be a difficult change, I'll see what I can do

petertriho commented 2 years ago

Let me know if that fixes the issue for you

pwntester commented 2 years ago

Awesome! thanks very much! I added it to the Octo docs

sQVe commented 6 months ago

I cannot, weirdly enough, get this to work. I have tried specifying the filetype explicitly in both cmp and cmp-git, but still not getting any completions for the octo filetype.

Am I missing something, or should this just work out of the box for octo filetypes?