petertriho / cmp-git

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

[bug] commits trigger blocks cmp if there are very many commits in a repository #38

Closed akinsho closed 2 years ago

akinsho commented 2 years ago

Hi 👋🏿

Been using this cmp source and really enjoying it. One issue I've had with it though is that I use the conventional commits for my commit messages and often hit : e.g. feat: which triggers the commit completion. Which is fine, although even if I wanted to disable or remap the trigger looking through the source code I'd have to basically overwrite the list of trigger actions completely rather than being able to change just one field. So since that is cumbersome, and technically I don't mind the trigger I keep the : but in repositories with a lot of commits this visibly blocks cmp's character input for like a sec or two which given how frequently I commit is quite frustrating.

I don't know if this is a cmp limitation or something to do with how this plugin fetches commits.

petertriho commented 2 years ago

Hi akinsho, love your bufferline plugin!

I haven't given this plugin much love in a while, but I suspect it's the direct system call (https://github.com/petertriho/cmp-git/blob/68989838898c3af1c7c00e5200ce6f98aa38bc86/lua/cmp_git/git.lua#L83) instead of using something like plenary.Jobs

You're right about the trigger_actions, I might just make a breaking change and change it to a dictionary table instead.

I'm not sure when I'll have the time to fix this (maybe in a few weeks or a month) but I'm open to PRs!

akinsho commented 2 years ago

Thanks for the kind words @petertriho. Makes sense re. the system call causing the blocking. Yeah I think plenary or a plain old vim.fn.jobstart would be good. I'm not in a rush but won't really have the time to raise a PR for it, I've definitely already overstretched myself on nvim plugin stuff 😅

petertriho commented 2 years ago

And it shows! Really well documented/performant bufferline plugin.

I'll try and make the trigger_actions change sometime next week, shouldn't be too difficult to refactor. I'll see if the system call change is easy, will investigate if vim.fn.jobstart is easier.

petertriho commented 2 years ago

@akinsho Sorry this took so long. Moved the command to use plenary.job. Hopefully that fixes the issue for you

akinsho commented 2 years ago

@petertriho thanks for the heads-up, that's much improved now 👍🏿