-
Notifications
You must be signed in to change notification settings - Fork 310
fix: Outdated completion item with mini.snippets #1035
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This would add latency to all of the sources. We want to get the request out to the LSP ASAP. I'll read up on that issue you linked soon |
|
The ASAP part might indeed be the culprit here, because after that there might be other |
|
For So, for now, in my config I apply this hack before the setup: -- HACK: See blink cmp completion init, line 20
-- Fix outdated completion items:
local sources_lib = require("blink.cmp.sources.lib")
local orig_request_completions = sources_lib.request_completions
sources_lib.request_completions = vim.schedule_wrap(orig_request_completions)
local blink = require("blink.cmp")
blink.setup(opts)
|
|
Hello @saghen, I implemented the same approach for blink.cmp as I did for nvim-cmp. There is no vim.schedule. This is the relevant fragment in blink.cmp.config.snippets.lua: -- ... expand
mini_snippets = function(snippet)
if not _G.MiniSnippets then error('mini.snippets has not been setup') end
local insert = MiniSnippets.config.expand.insert or MiniSnippets.default_insert
insert({ body = snippet })
require('blink.cmp').resubscribe()
end,
-- ...
I profiled the solution. For each |
|
Brilliant, thank you! This does seem a bit hacky, albeit less so than |
Indeed! |
## Description When using blink.cmp and mini.snippets, the same problem regarding outdated completion items as solved in [nvim-cmp](hrsh7th/nvim-cmp#2126) can arise. [This](saghen/blink.cmp#1035) PR has been included into main. When the PR is included into the next stable release, this PR can be merged. Current blink release: 0.11.0 ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Co-authored-by: abeldekat <abel@nomail.com>
## Description When using blink.cmp and mini.snippets, the same problem regarding outdated completion items as solved in [nvim-cmp](hrsh7th/nvim-cmp#2126) can arise. [This](saghen/blink.cmp#1035) PR has been included into main. When the PR is included into the next stable release, this PR can be merged. Current blink release: 0.11.0 ## Checklist - [x] I've read the [CONTRIBUTING](https://github.com/LazyVim/LazyVim/blob/main/CONTRIBUTING.md) guidelines. Co-authored-by: abeldekat <abel@nomail.com>
Hello @saghen,
I recently fixed this issue in
nvim-cmp.The problem also occurs in
blink, and the fix is very similar.Are there any drawbacks to the following approach?
.../completion/init.lua: