Skip to content

Commit

Permalink
docs: update old comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Saghen committed Oct 4, 2024
1 parent b1004ab commit 13304d4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 1 addition & 3 deletions lua/blink/cmp/sources/lib/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ function sources_context:get_completions(context)
end
self.last_sources_group_idx = response.sources_group_idx

-- todo: when the queued request results in 100% cached content, we end up
-- calling the on_completions_callback with the same data, which triggers
-- unnecessary fuzzy + render updates
-- run the queued request, if it exists
if self.queued_request_context ~= nil then
local queued_context = self.queued_request_context
self.queued_request_context = nil
Expand Down
8 changes: 5 additions & 3 deletions lua/blink/cmp/sources/lib/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ function sources.listen_on_completions(callback) sources.on_completions_callback

--- @param context blink.cmp.Context
function sources.request_completions(context)
-- a new context means we should refetch everything
-- create a new context if the id changed or if we haven't created one yet
local is_new_context = sources.current_context == nil or context.id ~= sources.current_context.id
if is_new_context then
if sources.current_context ~= nil then sources.current_context:destroy() end
Expand All @@ -52,8 +52,10 @@ function sources.request_completions(context)
end

function sources.cancel_completions()
if sources.current_context ~= nil then sources.current_context:destroy() end
sources.current_context = nil
if sources.current_context ~= nil then
sources.current_context:destroy()
sources.current_context = nil
end
end

--- @param item blink.cmp.CompletionItem
Expand Down

0 comments on commit 13304d4

Please sign in to comment.