Saghen / blink.cmp

Performant, batteries-included completion plugin for Neovim
MIT License
632 stars 27 forks source link

Add basic event trigger API #31

Closed dsully closed 9 hours ago

dsully commented 2 days ago

This allows for copilot.lua (and others I'm sure) ghost text to be hidden when the completion menu is shown:

            -- Remove Copilot ghost text when the cmp menu is opened.
            ev.on_load("blink.cmp", function()
                vim.schedule(function()
                    local cmp = require("blink.cmp")

                    cmp.on_show(function()
                        require("copilot.suggestion").dismiss()
                        vim.api.nvim_buf_set_var(0, "copilot_suggestion_hidden", true)
                    end)

                    cmp.on_hide(function()
                        vim.api.nvim_buf_set_var(0, "copilot_suggestion_hidden", false)
                    end)
                end)
            end)

I'm not sure of the best place to document this at the moment.

Fix some typos and syntax issue in the README as well.

Saghen commented 2 days ago

I believe you're looking to track the cmp.autocomplete window's visibility instead of the trigger. Also please add back the new lines on the recommended configuration. Thanks for the grammar fixes on the rest of the README :smile:

dsully commented 1 day ago

You're right - let me update.

dsully commented 1 day ago

Done.

I added additional type hints, and I also left my changes to the trigger.event_triggers.

Let me know if you'd like those reverted.

Saghen commented 9 hours ago

Yeah, would be great if you could revert the changes to signature help and trigger. I'll end up extracting the event targets into their own module for #82

Saghen commented 9 hours ago

Thank you!